mirror of
https://github.com/legop3/MultiRoombaRover.git
synced 2026-09-17 10:00:46 -04:00
hydraulic brakes
This commit is contained in:
@@ -1,5 +1,11 @@
|
|||||||
const DURATION_MS = 15 * 60 * 1000;
|
const DURATION_MS = 15 * 60 * 1000;
|
||||||
const LIGHT_ENFORCE_TICK_MS = 3000;
|
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 activeTimer = null;
|
||||||
let enforceLightsTimer = null;
|
let enforceLightsTimer = null;
|
||||||
@@ -72,7 +78,7 @@ async function stopDarkness(ctx, effect = {}) {
|
|||||||
try {
|
try {
|
||||||
ctx.issueCommand(String(roverId), {
|
ctx.issueCommand(String(roverId), {
|
||||||
type: 'nightVision',
|
type: 'nightVision',
|
||||||
nightVision: { action: wasOn ? 'on' : 'off' },
|
nightVision: { action: actionForNightVisionState(Boolean(wasOn)) },
|
||||||
});
|
});
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
ctx.logger.warn('darkness restore nightVision failed', { roverId, error: err.message });
|
ctx.logger.warn('darkness restore nightVision failed', { roverId, error: err.message });
|
||||||
@@ -129,7 +135,7 @@ module.exports = {
|
|||||||
try {
|
try {
|
||||||
ctx.issueCommand(String(rover.id), {
|
ctx.issueCommand(String(rover.id), {
|
||||||
type: 'nightVision',
|
type: 'nightVision',
|
||||||
nightVision: { action: 'off' },
|
nightVision: { action: actionForNightVisionState(false) },
|
||||||
});
|
});
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
ctx.logger.warn('darkness nightVision off failed', { roverId: rover.id, error: err.message });
|
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 HA_BUTTON_EVENT_TYPE = 'ha.button.action';
|
||||||
const LIGHT_IDLE_OFF_MS = 2 * 60 * 1000;
|
const LIGHT_IDLE_OFF_MS = 2 * 60 * 1000;
|
||||||
const DEFAULT_WHITE_KELVIN = 4000;
|
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 connection = null;
|
||||||
let unsubscribeEntities = null;
|
let unsubscribeEntities = null;
|
||||||
@@ -206,7 +208,7 @@ function turnOffAllRoverNightVision() {
|
|||||||
try {
|
try {
|
||||||
issueCommand(record.id, {
|
issueCommand(record.id, {
|
||||||
type: 'nightVision',
|
type: 'nightVision',
|
||||||
nightVision: { action: 'off' },
|
nightVision: { action: NIGHT_VISION_DISABLE_ACTION },
|
||||||
});
|
});
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
failed += 1;
|
failed += 1;
|
||||||
|
|||||||
Reference in New Issue
Block a user