From 7a5bb1108a7a0887421bd82f867eb029d06d5f33 Mon Sep 17 00:00:00 2001 From: Martyn Ranyard Date: Mon, 13 Jul 2020 17:46:11 +0200 Subject: [PATCH] Ensure we have a multiple of the delay in duration, and tick by the delay Signed-off-by: Martyn Ranyard --- cmd/ledcontroller-server/main.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/cmd/ledcontroller-server/main.go b/cmd/ledcontroller-server/main.go index 5d9ca2e..2ef1c62 100755 --- a/cmd/ledcontroller-server/main.go +++ b/cmd/ledcontroller-server/main.go @@ -149,7 +149,10 @@ func main() { } if overrideEffect.Effect == "queue" { if currentEffect.Duration > 0 { - currentEffect.Duration -= 40 + if currentEffect.Duration%uint16(msDelay) != 0 { + currentEffect.Duration = uint16(currentEffect.Duration/uint16(msDelay)) * uint16(msDelay) + } + currentEffect.Duration -= uint16(msDelay) } else { if len(globalEffectChannel) > 0 { previousEffect.Effect = "queue"