mirror of
https://github.com/legop3/MultiRoombaRover.git
synced 2026-09-17 10:00:46 -04:00
fixupx
This commit is contained in:
@@ -80,10 +80,11 @@ function handleSensorEvent({ roverId, sensors, batteryState }) {
|
|||||||
payload: { roverId, batteryState },
|
payload: { roverId, batteryState },
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
const currentMa = sensors?.currentMa;
|
const chargingLabel = sensors?.chargingState?.label?.toLowerCase();
|
||||||
const chargingByCurrent = typeof currentMa === 'number' && currentMa > 50;
|
const chargingByLabel =
|
||||||
const chargingByState = chargingState === 1 || chargingState === 2 || chargingState === 3;
|
chargingLabel === 'waiting' || chargingLabel === 'full charging' || chargingLabel === 'trickle charging';
|
||||||
const isCharging = chargingByState || chargingByCurrent;
|
const chargingByCode = chargingState === 2 || chargingState === 3 || chargingState === 4;
|
||||||
|
const isCharging = chargingByLabel || chargingByCode;
|
||||||
if (isCharging && !state.charging) {
|
if (isCharging && !state.charging) {
|
||||||
state.charging = true;
|
state.charging = true;
|
||||||
publishEvent({
|
publishEvent({
|
||||||
|
|||||||
Reference in New Issue
Block a user