mirror of
https://github.com/legop3/MultiRoombaRover.git
synced 2026-09-16 09:31:20 -04:00
hydraulic brakes
This commit is contained in:
@@ -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 });
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user