You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
OK I did a quick and nasty: in TheThingsNetwork.cpp file I added:
`void TheThingsNetwork::Setbattery()//patricks very crude DEvstatusReq Batter percentage function
{
readResponse(SYS_TABLE, SYS_TABLE, SYS_GET_VDD, buffer, sizeof(buffer));//fetch volts reading from VDD (I dont know where this comes from!)
int val = atoi(buffer);//convert to int
debugPrint(SENDING);
debugPrintLn();
debugPrint(val);//print to debug
debugPrintLn();
//Lorawan DevStatus sends battery level up to the netwotk as a percentage, 1-254 = 1-100% , 0 and 255 are reserved for mains power on or no battery infor available
if (val < 3200){
sendMacSet(MAC_BAT, "0");
}
else if (val > 3200 && val < 3300){
sendMacSet(MAC_BAT, "64");;
}
else if (val > 3300 && val < 3400){
sendMacSet(MAC_BAT, "128");;
}
else if (val > 3400 && val < 3500){
sendMacSet(MAC_BAT, "250");;
}
else if (val > 3500){
sendMacSet(MAC_BAT, "255");;
}
}`
Cloolalang
changed the title
Lorawan 1.0.3 5.5 End-DeviceStatus(DevStatusReq, DevStatusAns. Please can we have this feature?
Lorawan 1.0.3 5.5 End-DeviceStatus(DevStatusReq, DevStatusAns. Battery Percentage
Dec 8, 2020
Hi All, I really like this library, very well documented and easy to get going.
I was wondering if I could request a feature:
I would like to check battery and DL margin using DevStatusReq.
would it be difficult to expose this in this library as the Microchip can do it MAC SET BAT.
Cheers
P
The text was updated successfully, but these errors were encountered: