1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2024-11-29 05:16:51 +01:00

Bangle.js: handle battery charging status

This commit is contained in:
Richard de Boer 2022-02-02 21:00:11 +01:00 committed by Gitea
parent f61008c9ae
commit cec28d2442

View File

@ -194,6 +194,9 @@ public class BangleJSDeviceSupport extends AbstractBTLEDeviceSupport {
batteryInfo.level = b; batteryInfo.level = b;
batteryInfo.state = BatteryState.BATTERY_NORMAL; batteryInfo.state = BatteryState.BATTERY_NORMAL;
} }
if (json.has("chg") && json.getInt("chg") == 1) {
batteryInfo.state = BatteryState.BATTERY_CHARGING;
}
if (json.has("volt")) if (json.has("volt"))
batteryInfo.voltage = (float) json.getDouble("volt"); batteryInfo.voltage = (float) json.getDouble("volt");
handleGBDeviceEvent(batteryInfo); handleGBDeviceEvent(batteryInfo);