handle change-led in in process-loop

This commit is contained in:
Sascha Bias 2021-09-11 11:48:59 +02:00
parent 5a28898255
commit 5623096732
3 changed files with 29 additions and 0 deletions

View File

@ -152,6 +152,14 @@ void loop()
batteryVoltage = String(powerManagement.getBatteryVoltage(), 2);
batteryChargeCurrent = String(powerManagement.getBatteryChargeDischargeCurrent(), 0);
}
if (powerManagement.isChargeing())
{
powerManagement.enableChgLed();
}
else
{
powerManagement.disableChgLed();
}
#endif
if(!send_update && gps_loc_update && Config.smart_beacon.active)

View File

@ -29,6 +29,18 @@ void PowerManagement::deactivateLoRa()
axp.setPowerOutPut(AXP192_LDO2, AXP202_OFF);
}
// cppcheck-suppress unusedFunction
void PowerManagement::disableChgLed()
{
axp.setChgLEDMode(AXP20X_LED_OFF);
}
// cppcheck-suppress unusedFunction
void PowerManagement::enableChgLed()
{
axp.setChgLEDMode(AXP20X_LED_LOW_LEVEL);
}
// cppcheck-suppress unusedFunction
void PowerManagement::activateGPS()
{
@ -89,3 +101,8 @@ bool PowerManagement::isBatteryConnect()
{
return axp.isBatteryConnect();
}
bool PowerManagement::isChargeing()
{
return axp.isChargeing();
}

View File

@ -10,6 +10,9 @@ public:
PowerManagement();
bool begin(TwoWire & port);
void enableChgLed();
void disableChgLed();
void activateLoRa();
void deactivateLoRa();
@ -26,6 +29,7 @@ public:
double getBatteryChargeDischargeCurrent();
bool isBatteryConnect();
bool isChargeing();
private:
AXP20X_Class axp;