mirror of
https://github.com/legop3/MultiRoombaRover.git
synced 2026-09-16 01:21:20 -04:00
youe
This commit is contained in:
@@ -80,7 +80,10 @@ function handleSensorEvent({ roverId, sensors, batteryState }) {
|
|||||||
payload: { roverId, 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) {
|
if (isCharging && !state.charging) {
|
||||||
state.charging = true;
|
state.charging = true;
|
||||||
publishEvent({
|
publishEvent({
|
||||||
|
|||||||
@@ -302,8 +302,8 @@ function handleBusEvent(event) {
|
|||||||
announce({
|
announce({
|
||||||
channelId: channels.adminAlerts,
|
channelId: channels.adminAlerts,
|
||||||
color: 0x2196f3,
|
color: 0x2196f3,
|
||||||
title: 'Docked & Charging',
|
title: 'Docked',
|
||||||
description: `${payload?.roverId} is docked and charging.`,
|
description: `${payload?.roverId} docked.`,
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
case 'battery.undocked':
|
case 'battery.undocked':
|
||||||
|
|||||||
Reference in New Issue
Block a user