Skip to content

Instantly share code, notes, and snippets.

@solars solars/test.ino Secret

Created Jun 28, 2019
Embed
What would you like to do?
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
#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
You can’t perform that action at this time.