mirror of
https://github.com/legop3/MultiRoombaRover.git
synced 2026-09-16 17:40:46 -04:00
hopefully fix battery locking
This commit is contained in:
@@ -172,4 +172,16 @@ function handleSensorEvent({ roverId, sensors, batteryState }) {
|
||||
}
|
||||
}
|
||||
|
||||
function handleLockEvent({ roverId, locked, reason }) {
|
||||
const state = getState(roverId);
|
||||
if (!state) return;
|
||||
if (!locked) {
|
||||
state.batteryLocked = false;
|
||||
state.waitingSince = null;
|
||||
return;
|
||||
}
|
||||
state.batteryLocked = reason === 'battery';
|
||||
}
|
||||
|
||||
managerEvents.on('sensor', handleSensorEvent);
|
||||
managerEvents.on('lock', handleLockEvent);
|
||||
|
||||
Reference in New Issue
Block a user