mirror of
https://github.com/legop3/MultiRoombaRover.git
synced 2026-09-16 09:31:20 -04:00
youe
This commit is contained in:
@@ -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({
|
||||
|
||||
@@ -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':
|
||||
|
||||
Reference in New Issue
Block a user