Skip to content

Commit b66408e

Browse files
committed
Updated sketch, using Serial.flush() in test routine, instead of delay()
Changed name that is reported back to controler, to "MysensorMicro" instead of "EnvironmentSensor"
1 parent 3ab43d5 commit b66408e

File tree

1 file changed

+13
-10
lines changed

1 file changed

+13
-10
lines changed

libraries/MySensors/examples/MysensorMicro/MysensorMicro.ino

+13-10
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ void setup() {
8181

8282
humiditySensor.begin();
8383

84-
gw.sendSketchInfo("EnvironmentSensor", "1.0");
84+
gw.sendSketchInfo("MysensorMicro", "1.0");
8585

8686
gw.present(CHILD_ID_TEMP,S_TEMP);
8787
gw.present(CHILD_ID_HUM,S_HUM);
@@ -205,8 +205,9 @@ void testMode()
205205
digitalWrite(LED_PIN, HIGH); // Turn on LED.
206206

207207
Serial.println(F("Testing peripherals!"));
208+
Serial.flush();
208209
Serial.print(F("-> SI7021 : "));
209-
delay(100);
210+
Serial.flush();
210211

211212
if (humiditySensor.begin())
212213
{
@@ -217,10 +218,10 @@ void testMode()
217218
{
218219
Serial.println(F("failed!"));
219220
}
220-
delay(100);
221+
Serial.flush();
221222

222223
Serial.print(F("-> Flash : "));
223-
delay(100);
224+
Serial.flush();
224225
if (flash.initialize())
225226
{
226227
Serial.println(F("ok!"));
@@ -230,15 +231,17 @@ delay(100);
230231
{
231232
Serial.println(F("failed!"));
232233
}
233-
delay(100);
234+
Serial.flush();
235+
234236

235-
Serial.println(F("-> SHA204 : "));
237+
Serial.print(F("-> SHA204 : "));
236238
ret_code = sha204.sha204c_wakeup(rx_buffer);
239+
Serial.flush();
237240
if (ret_code != SHA204_SUCCESS)
238241
{
239242
Serial.print(F("Failed to wake device. Response: ")); Serial.println(ret_code, HEX);
240243
}
241-
244+
Serial.flush();
242245
if (ret_code == SHA204_SUCCESS)
243246
{
244247
ret_code = sha204.getSerialNumber(rx_buffer);
@@ -248,7 +251,7 @@ delay(100);
248251
}
249252
else
250253
{
251-
Serial.print(F("Device serial: "));
254+
Serial.print(F("Ok (serial : "));
252255
for (int i=0; i<9; i++)
253256
{
254257
if (rx_buffer[i] < 0x10)
@@ -257,12 +260,12 @@ delay(100);
257260
}
258261
Serial.print(rx_buffer[i], HEX);
259262
}
260-
Serial.println();
263+
Serial.println(")");
261264
tests ++;
262265
}
263266

264267
}
265-
268+
Serial.flush();
266269

267270
Serial.println(F("Test finished"));
268271

0 commit comments

Comments
 (0)