mirror of
https://github.com/legop3/MultiRoombaRover.git
synced 2026-09-16 09:31:20 -04:00
battery manager fix and stop rovers when we should
This commit is contained in:
@@ -147,7 +147,8 @@ function handleSensorEvent({ roverId, sensors, batteryState }) {
|
||||
});
|
||||
}
|
||||
|
||||
const waitingHalfOrMore = waitingPercent != null && waitingPercent >= 0.5;
|
||||
// const waitingHalfOrMore = waitingPercent != null && waitingPercent >= 0.5;
|
||||
const waitingHalfOrMore = true;
|
||||
const shouldUnlock = state.batteryLocked && waitingLongEnough && waitingHalfOrMore;
|
||||
|
||||
if (shouldUnlock) {
|
||||
|
||||
@@ -39,6 +39,7 @@ function driverRemoved(roverId, socketId) {
|
||||
}
|
||||
idleDisarmed.delete(roverId);
|
||||
if (queue.current === socketId) {
|
||||
stopRover(roverId);
|
||||
advanceTurn(roverId);
|
||||
} else {
|
||||
scheduleIdleTimer(roverId);
|
||||
@@ -177,6 +178,7 @@ function advanceTurn(roverId) {
|
||||
const queue = driverQueues.get(roverId);
|
||||
if (!queue) return;
|
||||
if (queue.queue.length === 0) {
|
||||
stopRover(roverId);
|
||||
clearTimeout(queue.timer);
|
||||
setActiveDriver(roverId, null);
|
||||
turnDeadlines.delete(roverId);
|
||||
|
||||
Reference in New Issue
Block a user