-
-
Save solars/8339a486d21545a1efdce44f6b363023 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4706 MCO:BGN:INIT OK,TSP=1 | |
4825 TSF:MSG:SEND,3-3-0-0,s=255,c=3,t=0,pt=1,l=1,sg=0,ft=0,st=OK:100 | |
5150 TSF:MSG:SEND,3-3-0-0,s=1,c=1,t=0,pt=7,l=5,sg=0,ft=0,st=OK:27.0 | |
5261 TSF:MSG:READ,0-0-3,s=1,c=1,t=0,pt=7,l=5,sg=0:27.0 | |
5267 TSF:MSG:ACK | |
5490 TSF:MSG:SEND,3-3-0-0,s=2,c=1,t=1,pt=7,l=5,sg=0,ft=0,st=OK:58.0 | |
6727 !TSF:MSG:SEND,3-3-0-0,s=2,c=1,t=1,pt=7,l=5,sg=0,ft=0,st=NACK:58.0 | |
7049 TSF:MSG:SEND,3-3-0-0,s=3,c=1,t=4,pt=7,l=5,sg=0,ft=1,st=OK:1021.9 | |
7155 TSF:MSG:READ,0-0-3,s=3,c=1,t=4,pt=7,l=5,sg=0:1021.9 | |
7161 TSF:MSG:ACK | |
7163 MCO:SLP:MS=300000,SMS=0,I1=255,M1=255,I2=255,M2=255 | |
7170 TSF:TDI:TSL |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifdef MY_IS_RFM69HW | |
int batteryPcnt = (sensorValue - 750) / 1.5; | |
#else | |
int batteryPcnt = (sensorValue - 600) / 3; | |
#endif | |
batteryPcnt = batteryPcnt > 0 ? batteryPcnt:0; // Cut down negative values. Just in case the battery goes below 2V (2.5V) and the node still working. | |
batteryPcnt = batteryPcnt < 100 ? batteryPcnt:100; // Cut down more than "100%" values. In case of ADC fluctuations. | |
if (oldBatteryPcnt != batteryPcnt ) { | |
// Power up radio after sleep | |
sendBatteryLevel(batteryPcnt); | |
oldBatteryPcnt = batteryPcnt; | |
} | |
wait(100); | |
bmeTemp = bme.readTemperature(); | |
// round to next 0.x | |
bmeTemp = round(bmeTemp * 10)/10.0; | |
if (bmeTemp != oldBmeTemp) { | |
send(msg_be_temp.set(bmeTemp, 1), true); | |
oldBmeTemp = bmeTemp; | |
} | |
wait(100); | |
// round to the next int | |
bmeHum = round(bme.readHumidity()); | |
if (bmeHum != oldBmeHum) { | |
send(msg_be_hum.set(bmeHum, 1), true); | |
send(msg_be_hum.set(bmeHum, 1), true); | |
oldBmeHum = bmeHum; | |
} | |
wait(100); | |
// Read atmospheric pressure at local altitude | |
bmePres = bme.readPressure()/100.0F; | |
// Local pressure adjusted to sea level pressure using user altitude | |
bmePres = bmePres / pow((1.0 - ( ALTITUDE / 44330.0 )), 5.255); | |
bmePres = round(bmePres * 10)/10.0; | |
if (bmePres != oldBmePres) { | |
send(msg_be_pres.set(bmePres,1), true); | |
oldBmePres = bmePres; | |
} | |
wait(100); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment