From b66408e3d471427e166a74c1385de1eb78cc77ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20M=C3=B8rch?= Date: Sat, 28 Mar 2015 11:17:52 +0100 Subject: [PATCH] Updated sketch, using Serial.flush() in test routine, instead of delay() Changed name that is reported back to controler, to "MysensorMicro" instead of "EnvironmentSensor" --- .../examples/MysensorMicro/MysensorMicro.ino | 23 +++++++++++-------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/libraries/MySensors/examples/MysensorMicro/MysensorMicro.ino b/libraries/MySensors/examples/MysensorMicro/MysensorMicro.ino index a6420d1..2d70c41 100644 --- a/libraries/MySensors/examples/MysensorMicro/MysensorMicro.ino +++ b/libraries/MySensors/examples/MysensorMicro/MysensorMicro.ino @@ -81,7 +81,7 @@ void setup() { humiditySensor.begin(); - gw.sendSketchInfo("EnvironmentSensor", "1.0"); + gw.sendSketchInfo("MysensorMicro", "1.0"); gw.present(CHILD_ID_TEMP,S_TEMP); gw.present(CHILD_ID_HUM,S_HUM); @@ -205,8 +205,9 @@ void testMode() digitalWrite(LED_PIN, HIGH); // Turn on LED. Serial.println(F("Testing peripherals!")); + Serial.flush(); Serial.print(F("-> SI7021 : ")); - delay(100); + Serial.flush(); if (humiditySensor.begin()) { @@ -217,10 +218,10 @@ void testMode() { Serial.println(F("failed!")); } - delay(100); + Serial.flush(); Serial.print(F("-> Flash : ")); -delay(100); + Serial.flush(); if (flash.initialize()) { Serial.println(F("ok!")); @@ -230,15 +231,17 @@ delay(100); { Serial.println(F("failed!")); } -delay(100); + Serial.flush(); + - Serial.println(F("-> SHA204 : ")); + Serial.print(F("-> SHA204 : ")); ret_code = sha204.sha204c_wakeup(rx_buffer); + Serial.flush(); if (ret_code != SHA204_SUCCESS) { Serial.print(F("Failed to wake device. Response: ")); Serial.println(ret_code, HEX); } - + Serial.flush(); if (ret_code == SHA204_SUCCESS) { ret_code = sha204.getSerialNumber(rx_buffer); @@ -248,7 +251,7 @@ delay(100); } else { - Serial.print(F("Device serial: ")); + Serial.print(F("Ok (serial : ")); for (int i=0; i<9; i++) { if (rx_buffer[i] < 0x10) @@ -257,12 +260,12 @@ delay(100); } Serial.print(rx_buffer[i], HEX); } - Serial.println(); + Serial.println(")"); tests ++; } } - + Serial.flush(); Serial.println(F("Test finished"));