15
15
#include < sha204_lib_return_codes.h>
16
16
#include < sha204_library.h>
17
17
#include < RunningAverage.h>
18
- #include < avr/power.h>
18
+ // #include <avr/power.h>
19
19
20
20
// Define a static node address, remove if you want auto address assignment
21
21
// #define NODE_ADDRESS 3
@@ -149,7 +149,7 @@ void loop() {
149
149
150
150
if ((measureCount == 5 ) && highfreq)
151
151
{
152
- clock_prescale_set (clock_div_8); // Switch to 1Mhz for the reminder of the sketch, save power.
152
+ // clock_prescale_set(clock_div_8); // Switch to 1Mhz for the reminder of the sketch, save power.
153
153
highfreq = false ;
154
154
}
155
155
@@ -182,21 +182,20 @@ void loop() {
182
182
void sendTempHumidityMeasurements (bool force)
183
183
{
184
184
bool tx = force;
185
-
185
+
186
186
si7021_env data = humiditySensor.getHumidityAndTemperature ();
187
- float oldAvgHum = raHum.getAverage ();
188
187
189
188
raHum.addValue (data.humidityPercent );
190
189
191
190
float diffTemp = abs (lastTemperature - (isMetric ? data.celsiusHundredths : data.fahrenheitHundredths )/100 );
192
- float diffHum = abs (oldAvgHum - raHum.getAverage ());
191
+ float diffHum = abs (lastHumidity - raHum.getAverage ());
193
192
194
193
Serial.print (F (" TempDiff :" ));Serial.println (diffTemp);
195
194
Serial.print (F (" HumDiff :" ));Serial.println (diffHum);
196
195
197
196
if (isnan (diffHum)) tx = true ;
198
197
if (diffTemp > TEMP_TRANSMIT_THRESHOLD) tx = true ;
199
- if (diffHum >= HUMI_TRANSMIT_THRESHOLD) tx = true ;
198
+ if (diffHum > HUMI_TRANSMIT_THRESHOLD) tx = true ;
200
199
201
200
if (tx) {
202
201
measureCount = 0 ;
@@ -246,7 +245,7 @@ void sendBattLevel(bool force)
246
245
* Internal battery ADC measuring
247
246
*
248
247
*******************************************/
249
- long readVcc () {
248
+ long readVcc () {/*
250
249
// Read 1.1V reference against AVcc
251
250
// set the reference to Vcc and the measurement to the internal 1.1V reference
252
251
#if defined(__AVR_ATmega32U4__) || defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__)
@@ -270,6 +269,7 @@ long readVcc() {
270
269
271
270
result = 1125300L / result; // Calculate Vcc (in mV); 1125300 = 1.1*1023*1000
272
271
return result; // Vcc in millivolts
272
+ */
273
273
}
274
274
275
275
/* ***************************************************
0 commit comments