From a26af52b6d2d3aff5348122db327d80f6083fa75 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20M=C3=B8rch?= Date: Sat, 25 Apr 2015 22:11:38 +0200 Subject: [PATCH 1/2] Added versioning info to serial output (for production verification) --- .../examples/MysensorMicro/MysensorMicro.ino | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/libraries/MySensors/examples/MysensorMicro/MysensorMicro.ino b/libraries/MySensors/examples/MysensorMicro/MysensorMicro.ino index f78d819..5c8ca71 100644 --- a/libraries/MySensors/examples/MysensorMicro/MysensorMicro.ino +++ b/libraries/MySensors/examples/MysensorMicro/MysensorMicro.ino @@ -18,6 +18,8 @@ // Define a static node address, remove if you want auto address assignment //#define NODE_ADDRESS 3 +#define RELEASE "1.1" + // Child sensor ID's #define CHILD_ID_TEMP 1 #define CHILD_ID_HUM 2 @@ -66,6 +68,10 @@ void setup() { digitalWrite(LED_PIN, LOW); Serial.begin(115200); + Serial.print(F("Sensebender Micro FW ")); + Serial.print(RELEASE); + Serial.flush(); + // First check if we should boot into test mode pinMode(TEST_PIN,INPUT); @@ -74,7 +80,7 @@ void setup() { digitalWrite(TEST_PIN,LOW); digitalWrite(LED_PIN, HIGH); - + #ifdef NODE_ADDRESS gw.begin(NULL, NODE_ADDRESS, false); #else @@ -84,8 +90,9 @@ void setup() { digitalWrite(LED_PIN, LOW); humiditySensor.begin(); - - gw.sendSketchInfo("Sensebender Micro", "1.0"); + Serial.flush(); + Serial.println(F(" - Online!")); + gw.sendSketchInfo("Sensebender Micro", RELEASE); gw.present(CHILD_ID_TEMP,S_TEMP); gw.present(CHILD_ID_HUM,S_HUM); @@ -105,8 +112,7 @@ void loop() { // This allows us to print debug messages on startup (as serial port is dependend on oscilator settings). if (measureCount == 5) switchClock(1< FORCE_TRANSMIT_INTERVAL - ) { // force a transmission + if (measureCount > FORCE_TRANSMIT_INTERVAL) { // force a transmission forceTransmit = true; measureCount = 0; } @@ -213,7 +219,7 @@ void testMode() byte tests = 0; digitalWrite(LED_PIN, HIGH); // Turn on LED. - + Serial.println(F(" - TestMode")); Serial.println(F("Testing peripherals!")); Serial.flush(); Serial.print(F("-> SI7021 : ")); From bcce65a292ccaf23d2d212fbe8e01b8310d1c52e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20M=C3=B8rch?= Date: Sun, 26 Apr 2015 21:45:43 +0200 Subject: [PATCH 2/2] Small update, that ensures that we only switch to 1Mhz once --- libraries/MySensors/examples/MysensorMicro/MysensorMicro.ino | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/libraries/MySensors/examples/MysensorMicro/MysensorMicro.ino b/libraries/MySensors/examples/MysensorMicro/MysensorMicro.ino index 5c8ca71..7c5a074 100644 --- a/libraries/MySensors/examples/MysensorMicro/MysensorMicro.ino +++ b/libraries/MySensors/examples/MysensorMicro/MysensorMicro.ino @@ -61,6 +61,7 @@ float lastTemperature = -100; int lastHumidity = -100; long lastBattery = -100; +bool highfreq = true; void setup() { @@ -110,7 +111,7 @@ void loop() { // When we wake up the 5th time after power on, switch to 1Mhz clock // This allows us to print debug messages on startup (as serial port is dependend on oscilator settings). - if (measureCount == 5) switchClock(1< FORCE_TRANSMIT_INTERVAL) { // force a transmission forceTransmit = true; @@ -208,6 +209,7 @@ void switchClock(unsigned char clk) CLKPR = 1<