mirror of
https://github.com/legop3/MultiRoombaRover.git
synced 2026-09-16 01:21:20 -04:00
unlock roomba only on waiting AND full
This commit is contained in:
@@ -93,8 +93,16 @@ function handleSensorEvent({ roverId, sensors, batteryState }) {
|
||||
});
|
||||
}
|
||||
|
||||
if (state.batteryLocked && (isFull || !dockedCharging)) {
|
||||
logger.info('Unlocking rover after charge', { roverId, isFull, docked: dockedCharging });
|
||||
const waitingState = chargingState === 4;
|
||||
const shouldUnlock = state.batteryLocked && (!dockedCharging || (isFull && waitingState));
|
||||
|
||||
if (shouldUnlock) {
|
||||
logger.info('Unlocking rover after charge', {
|
||||
roverId,
|
||||
isFull,
|
||||
docked: dockedCharging,
|
||||
waitingState,
|
||||
});
|
||||
lockRover(roverId, false, { reason: 'battery' });
|
||||
state.batteryLocked = false;
|
||||
publishEvent({
|
||||
|
||||
Reference in New Issue
Block a user