MCPcopy Create free account
hub / github.com/bmorcelli/Launcher / getBattery

Function getBattery

boards/m5stack-cplus1_1/interface.cpp:24–30  ·  view source on GitHub ↗

** Function name: getBattery() ** Description: Delivers the battery value from 1-100 ***************************************************************************************/

Source from the content-addressed store, hash-verified

22** Description: Delivers the battery value from 1-100
23***************************************************************************************/
24int getBattery() {
25 int percent = 0;
26 float b = axp192.GetBatVoltage();
27 percent = ((b - 3.0) / 1.2) * 100;
28
29 return (percent < 0) ? 0 : (percent >= 100) ? 100 : percent;
30}
31
32/*********************************************************************
33** Function: setBrightness

Callers

nothing calls this directly

Calls 1

GetBatVoltageMethod · 0.80

Tested by

no test coverage detected