mirror of
https://github.com/legop3/MultiRoombaRover.git
synced 2026-11-15 11:12:16 -05:00
Compare commits
2
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7bac2fc447 | ||
|
|
e8a407cd49 |
@@ -4,12 +4,15 @@
|
|||||||
const logger = require('../../globals/logger').child('idleService');
|
const logger = require('../../globals/logger').child('idleService');
|
||||||
const io = require('../../globals/io');
|
const io = require('../../globals/io');
|
||||||
const { getRole, roleEvents } = require('../roleService');
|
const { getRole, roleEvents } = require('../roleService');
|
||||||
|
const { getMode, MODES, modeEvents } = require('../modeManager');
|
||||||
|
const { isDeterred, verificationEvents } = require('../verificationService');
|
||||||
const { IDLE_TIMEOUT_MS } = require('./constants');
|
const { IDLE_TIMEOUT_MS } = require('./constants');
|
||||||
const { runtime } = require('./state');
|
const { runtime } = require('./state');
|
||||||
const { runIdleActions } = require('./actions');
|
const { runIdleActions } = require('./actions');
|
||||||
const activityControls = require('../homeAssistantActivitiesService');
|
const activityControls = require('../homeAssistantActivitiesService');
|
||||||
|
|
||||||
function getActivitySnapshot() {
|
function getActivitySnapshot() {
|
||||||
|
const mode = getMode();
|
||||||
let onlineUsers = 0;
|
let onlineUsers = 0;
|
||||||
let onlineAdmins = 0;
|
let onlineAdmins = 0;
|
||||||
let onlineSpectators = 0;
|
let onlineSpectators = 0;
|
||||||
@@ -29,12 +32,16 @@ function getActivitySnapshot() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
Lockdown admins are counted with regular admins because both represent a
|
if (
|
||||||
person with operator-level access who may be supervising the room without
|
isDeterred(socket)
|
||||||
actively driving a rover. Plain users also count even before they request
|
|| (mode === MODES.ADMIN && role !== 'admin' && role !== 'lockdown')
|
||||||
control, which is the behavior this service now needs.
|
|| (mode === MODES.LOCKDOWN && role !== 'lockdown')
|
||||||
*/
|
) {
|
||||||
|
onlineIgnored += 1;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (role === 'admin' || role === 'lockdown') {
|
if (role === 'admin' || role === 'lockdown') {
|
||||||
onlineAdmins += 1;
|
onlineAdmins += 1;
|
||||||
return;
|
return;
|
||||||
@@ -90,7 +97,7 @@ function scheduleIdleTimer() {
|
|||||||
runtime.deadlineAt = null;
|
runtime.deadlineAt = null;
|
||||||
const activity = getActivitySnapshot();
|
const activity = getActivitySnapshot();
|
||||||
if (activity.totalActive > 0) {
|
if (activity.totalActive > 0) {
|
||||||
logger.info('Idle automation skipped; user or admin online', activity);
|
logger.info('Idle automation skipped; eligible operator online', activity);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
runtime.lastTriggeredAt = Date.now();
|
runtime.lastTriggeredAt = Date.now();
|
||||||
@@ -114,18 +121,12 @@ function scheduleIdleTimer() {
|
|||||||
function refreshIdleState() {
|
function refreshIdleState() {
|
||||||
const activity = getActivitySnapshot();
|
const activity = getActivitySnapshot();
|
||||||
logger.info('Idle state refresh', activity);
|
logger.info('Idle state refresh', activity);
|
||||||
// Share the exact idle presence policy; Activity Controls must not count spectators or invent a second role filter.
|
|
||||||
activityControls.setOperatorsOnline(activity.totalActive > 0);
|
activityControls.setOperatorsOnline(activity.totalActive > 0);
|
||||||
if (activity.totalActive > 0) {
|
if (activity.totalActive > 0) {
|
||||||
clearIdleTimer();
|
clearIdleTimer();
|
||||||
if (runtime.idleActionsCompleted) {
|
if (runtime.idleActionsCompleted) {
|
||||||
logger.info('Idle action one-shot reset; operator is online again', activity);
|
logger.info('Idle action one-shot reset; operator is online again', activity);
|
||||||
}
|
}
|
||||||
/*
|
|
||||||
A user/admin coming online starts a new activity window. When the room
|
|
||||||
later becomes idle again, the cleanup pipeline should be allowed to run
|
|
||||||
once for that new idle period.
|
|
||||||
*/
|
|
||||||
runtime.idleActionsCompleted = false;
|
runtime.idleActionsCompleted = false;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -133,17 +134,13 @@ function refreshIdleState() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
io.on('connection', (socket) => {
|
io.on('connection', (socket) => {
|
||||||
/*
|
|
||||||
A user/admin can be online without ever touching rover controls, so socket
|
|
||||||
presence has to be a first-class idle signal. The disconnect hook is just as
|
|
||||||
important: it is what starts the idle timeout after the last non-spectator
|
|
||||||
leaves, even if no driving event happens around that departure.
|
|
||||||
*/
|
|
||||||
refreshIdleState();
|
refreshIdleState();
|
||||||
socket.on('disconnect', refreshIdleState);
|
socket.on('disconnect', refreshIdleState);
|
||||||
});
|
});
|
||||||
|
|
||||||
roleEvents.on('change', refreshIdleState);
|
roleEvents.on('change', refreshIdleState);
|
||||||
|
modeEvents.on('change', refreshIdleState);
|
||||||
|
verificationEvents.on('change', refreshIdleState);
|
||||||
|
|
||||||
refreshIdleState();
|
refreshIdleState();
|
||||||
|
|
||||||
|
|||||||
@@ -3,20 +3,9 @@
|
|||||||
research how midis can be played easier with drag and drop, auto selection based on which playback mode would fit, more useful and clear toggles, sample midi files to analyze how they would play on a single tone system, better live playback to see what notes are actually playing from each source and what simply wont play on the speaker
|
research how midis can be played easier with drag and drop, auto selection based on which playback mode would fit, more useful and clear toggles, sample midi files to analyze how they would play on a single tone system, better live playback to see what notes are actually playing from each source and what simply wont play on the speaker
|
||||||
and make sure each toggle and counter actually has a purpose besides debugging or something more useful to the user, note skipped is just for debugging
|
and make sure each toggle and counter actually has a purpose besides debugging or something more useful to the user, note skipped is just for debugging
|
||||||
```
|
```
|
||||||
1. add new discord channel: live status
|
1. add admin ui for VIP and private requests instead of only through discord
|
||||||
1. one concise message which contains the status of all the rovers
|
2. make roverd self update checkout to main branch
|
||||||
2. bot clears the channel, then sends a new message
|
3. fix this:
|
||||||
3. has a fancy big embed that shows way more stuff
|
|
||||||
4. also has a small text copy at the top (readable on smartwatch lol)
|
|
||||||
1. ```
|
|
||||||
freaky: docked
|
|
||||||
wall-e: user1 driving
|
|
||||||
bweeble: NEEDS HELP
|
|
||||||
```
|
|
||||||
2. setting to disable replay popups in spectator settings menu
|
|
||||||
3. add admin ui for VIP and private requests instead of only through discord
|
|
||||||
4. make roverd self update checkout to main branch
|
|
||||||
5. fix this:
|
|
||||||
`Jun 18 15:14:18 roombaserver.local node[216731]: /home/daniel/MultiRoombaRover/server/src/services/roverManager/socketHandlers.js:92
|
`Jun 18 15:14:18 roombaserver.local node[216731]: /home/daniel/MultiRoombaRover/server/src/services/roverManager/socketHandlers.js:92
|
||||||
Jun 18 15:14:18 roombaserver.local node[216731]: cb({ error: err.message });
|
Jun 18 15:14:18 roombaserver.local node[216731]: cb({ error: err.message });
|
||||||
Jun 18 15:14:18 roombaserver.local node[216731]: ^
|
Jun 18 15:14:18 roombaserver.local node[216731]: ^
|
||||||
|
|||||||
Reference in New Issue
Block a user