hydraulic brakes

This commit is contained in:
legop3
2026-04-25 20:45:54 -04:00
parent 41bbd7bd98
commit 3a5c14412d
2 changed files with 11 additions and 3 deletions
+8 -2
View File
@@ -1,5 +1,11 @@
const DURATION_MS = 15 * 60 * 1000;
const LIGHT_ENFORCE_TICK_MS = 3000;
// Rover daemon semantics are inverted:
// action "on" => IR LED on => nightVisionOn=false
// action "off" => IR LED off => nightVisionOn=true
function actionForNightVisionState(nightVisionOn) {
return nightVisionOn ? 'off' : 'on';
}
let activeTimer = null;
let enforceLightsTimer = null;
@@ -72,7 +78,7 @@ async function stopDarkness(ctx, effect = {}) {
try {
ctx.issueCommand(String(roverId), {
type: 'nightVision',
nightVision: { action: wasOn ? 'on' : 'off' },
nightVision: { action: actionForNightVisionState(Boolean(wasOn)) },
});
} catch (err) {
ctx.logger.warn('darkness restore nightVision failed', { roverId, error: err.message });
@@ -129,7 +135,7 @@ module.exports = {
try {
ctx.issueCommand(String(rover.id), {
type: 'nightVision',
nightVision: { action: 'off' },
nightVision: { action: actionForNightVisionState(false) },
});
} catch (err) {
ctx.logger.warn('darkness nightVision off failed', { roverId: rover.id, error: err.message });
+3 -1
View File
@@ -27,6 +27,8 @@ const triggerRuntime = new Map(); // triggerId -> { lastFiredAt, lastState, last
const HA_BUTTON_EVENT_TYPE = 'ha.button.action';
const LIGHT_IDLE_OFF_MS = 2 * 60 * 1000;
const DEFAULT_WHITE_KELVIN = 4000;
// Rover daemon uses inverted semantics: action "on" powers IR LEDs, which means nightVisionOn=false.
const NIGHT_VISION_DISABLE_ACTION = 'on';
let connection = null;
let unsubscribeEntities = null;
@@ -206,7 +208,7 @@ function turnOffAllRoverNightVision() {
try {
issueCommand(record.id, {
type: 'nightVision',
nightVision: { action: 'off' },
nightVision: { action: NIGHT_VISION_DISABLE_ACTION },
});
} catch (err) {
failed += 1;