This commit is contained in:
legop3
2025-11-22 02:53:55 -05:00
parent a26772055a
commit d95ba09e00
2 changed files with 6 additions and 3 deletions
+4 -1
View File
@@ -80,7 +80,10 @@ function handleSensorEvent({ roverId, sensors, batteryState }) {
payload: { roverId, batteryState },
});
}
const isCharging = chargingState === 1 || chargingState === 2 || chargingState === 3;
const currentMa = sensors?.currentMa;
const chargingByCurrent = typeof currentMa === 'number' && currentMa > 50;
const chargingByState = chargingState === 1 || chargingState === 2 || chargingState === 3;
const isCharging = chargingByState || chargingByCurrent;
if (isCharging && !state.charging) {
state.charging = true;
publishEvent({
+2 -2
View File
@@ -302,8 +302,8 @@ function handleBusEvent(event) {
announce({
channelId: channels.adminAlerts,
color: 0x2196f3,
title: 'Docked & Charging',
description: `${payload?.roverId} is docked and charging.`,
title: 'Docked',
description: `${payload?.roverId} docked.`,
});
break;
case 'battery.undocked':