18
18
// Define a static node address, remove if you want auto address assignment
19
19
// #define NODE_ADDRESS 3
20
20
21
+ #define RELEASE " 1.1"
22
+
21
23
// Child sensor ID's
22
24
#define CHILD_ID_TEMP 1
23
25
#define CHILD_ID_HUM 2
@@ -59,13 +61,18 @@ float lastTemperature = -100;
59
61
int lastHumidity = -100 ;
60
62
long lastBattery = -100 ;
61
63
64
+ bool highfreq = true ;
62
65
63
66
void setup () {
64
67
65
68
pinMode (LED_PIN, OUTPUT);
66
69
digitalWrite (LED_PIN, LOW);
67
70
68
71
Serial.begin (115200 );
72
+ Serial.print (F (" Sensebender Micro FW " ));
73
+ Serial.print (RELEASE);
74
+ Serial.flush ();
75
+
69
76
// First check if we should boot into test mode
70
77
71
78
pinMode (TEST_PIN,INPUT);
@@ -74,7 +81,7 @@ void setup() {
74
81
75
82
digitalWrite (TEST_PIN,LOW);
76
83
digitalWrite (LED_PIN, HIGH);
77
-
84
+
78
85
#ifdef NODE_ADDRESS
79
86
gw.begin (NULL , NODE_ADDRESS, false );
80
87
#else
@@ -84,8 +91,9 @@ void setup() {
84
91
digitalWrite (LED_PIN, LOW);
85
92
86
93
humiditySensor.begin ();
87
-
88
- gw.sendSketchInfo (" Sensebender Micro" , " 1.0" );
94
+ Serial.flush ();
95
+ Serial.println (F (" - Online!" ));
96
+ gw.sendSketchInfo (" Sensebender Micro" , RELEASE);
89
97
90
98
gw.present (CHILD_ID_TEMP,S_TEMP);
91
99
gw.present (CHILD_ID_HUM,S_HUM);
@@ -103,10 +111,9 @@ void loop() {
103
111
104
112
// When we wake up the 5th time after power on, switch to 1Mhz clock
105
113
// This allows us to print debug messages on startup (as serial port is dependend on oscilator settings).
106
- if (measureCount == 5 ) switchClock (1 <<CLKPS2); // Switch to 1Mhz for the reminder of the sketch, save power.
114
+ if (( measureCount == 5 ) && highfreq ) switchClock (1 <<CLKPS2); // Switch to 1Mhz for the reminder of the sketch, save power.
107
115
108
- if (measureCount > FORCE_TRANSMIT_INTERVAL
109
- ) { // force a transmission
116
+ if (measureCount > FORCE_TRANSMIT_INTERVAL) { // force a transmission
110
117
forceTransmit = true ;
111
118
measureCount = 0 ;
112
119
}
@@ -202,6 +209,7 @@ void switchClock(unsigned char clk)
202
209
CLKPR = 1 <<CLKPCE; // Set CLKPCE to enable clk switching
203
210
CLKPR = clk;
204
211
sei ();
212
+ highfreq = false ;
205
213
}
206
214
207
215
@@ -213,7 +221,7 @@ void testMode()
213
221
byte tests = 0 ;
214
222
215
223
digitalWrite (LED_PIN, HIGH); // Turn on LED.
216
-
224
+ Serial. println ( F ( " - TestMode " ));
217
225
Serial.println (F (" Testing peripherals!" ));
218
226
Serial.flush ();
219
227
Serial.print (F (" -> SI7021 : " ));
0 commit comments