DevStatusReq and libxDot-mbed5
- This topic has 2 replies, 2 voices, and was last updated 5 years ago by .
Viewing 3 posts - 1 through 3 (of 3 total)
Viewing 3 posts - 1 through 3 (of 3 total)
- You must be logged in to reply to this topic.
Tagged: battery, DevStatusReq, libxDot-mbed5
Hi,
We are trying to override the MeasureBattery() function on mDotEvent.h file, but we are not able to add any custom code, as the function always returns 255 to our server:
virtual uint8_t MeasureBattery(void) {
uint8_t batteryLevel = myXdotbat.getBatteryLevel();
return batteryLevel;
}
In the other hand, if we modify the function like this, we are able to receive 128 on our server.
virtual uint8_t MeasureBattery(void) {
return 128;
}
Our custom function is working when it’s included in main() function.
Link margin value is always working as expected.
Could you please provide guidance on how to modify the function properly?
Kind regards,
What does myXdotbat.getBatteryLevel() do?
What value is it returning?
Does it change if you fix the value returned by getBatteryLevel() to 128?
Hi Jason,
myXdotbat.getBatteryLevel() reads an ADC pin, makes calculations and returns a value from 0 to 255.
We resolved the issue by calling the class member function with no object (static):
virtual uint8_t MeasureBattery(void) {
return Xdotbat::getBatteryLevel();
}
Thank you.