From fbd7829087c5a9625846b30b4c55212f1b98625b Mon Sep 17 00:00:00 2001 From: Alex Christoffer Rasmussen Date: Sun, 29 Dec 2024 21:12:00 +0100 Subject: [PATCH] FIX: Rundown Offset Feedback (#98) * always false if no * remove duplicate variable name * also check undefined --- src/v3/feedbacks/offset.ts | 5 +++-- src/v3/variables.ts | 4 ---- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/src/v3/feedbacks/offset.ts b/src/v3/feedbacks/offset.ts index 46fc0f6..842e37e 100644 --- a/src/v3/feedbacks/offset.ts +++ b/src/v3/feedbacks/offset.ts @@ -1,14 +1,15 @@ import { CompanionFeedbackBooleanEvent, CompanionFeedbackDefinition } from '@companion-module/base' import { OntimeV3 } from '../ontimev3' -import {feedbackId, OffsetState} from '../../enums' +import { feedbackId, OffsetState } from '../../enums' import { DangerRed, White } from '../../assets/colours' export function createOffsetFeedbacks(ontime: OntimeV3): { [id: string]: CompanionFeedbackDefinition } { function offset(feedback: CompanionFeedbackBooleanEvent): boolean { const state = feedback.options.state as OffsetState | undefined if (!state) return false + if (ontime.state.runtime.offset === null || ontime.state.runtime.offset === undefined) return false const margin = Number(feedback.options.margin) - const offset = (ontime.state.runtime.offset ?? 0) / 1000 + const offset = ontime.state.runtime.offset / 1000 switch (state) { case OffsetState.On: return offset > -margin && offset < margin diff --git a/src/v3/variables.ts b/src/v3/variables.ts index f3e046c..3bf12d0 100644 --- a/src/v3/variables.ts +++ b/src/v3/variables.ts @@ -201,10 +201,6 @@ export function variables(): CompanionVariableDefinition[] { name: 'Aux timer 1 current (milliseconds)', variableId: variableId.AuxTimerDurationMs + '-1', }, - { - name: 'Aux timer 1 duration (hh:mm:ss)', - variableId: variableId.AuxTimerDurationMs + '-1', - }, { name: 'Aux timer 1 current (hh:mm:ss)', variableId: variableId.AuxTimerCurrent + '-1',