mirror of
https://github.com/legop3/MultiRoombaRover.git
synced 2026-09-16 17:40:46 -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)) {
|
const waitingState = chargingState === 4;
|
||||||
logger.info('Unlocking rover after charge', { roverId, isFull, docked: dockedCharging });
|
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' });
|
lockRover(roverId, false, { reason: 'battery' });
|
||||||
state.batteryLocked = false;
|
state.batteryLocked = false;
|
||||||
publishEvent({
|
publishEvent({
|
||||||
|
|||||||
Reference in New Issue
Block a user