From 2ed28cf74dc4dbd86b39bfba75ecf1ec19478f9b Mon Sep 17 00:00:00 2001 From: Mikayla Fischler Date: Sat, 26 Aug 2023 19:01:22 -0400 Subject: [PATCH] #324 fixed alarm sounder lag --- coordinator/sounder.lua | 2 +- coordinator/startup.lua | 2 +- rtu/startup.lua | 2 +- rtu/threads.lua | 2 +- scada-common/audio.lua | 3 +++ scada-common/util.lua | 2 +- 6 files changed, 8 insertions(+), 5 deletions(-) diff --git a/coordinator/sounder.lua b/coordinator/sounder.lua index e3b2051..e7a02ac 100644 --- a/coordinator/sounder.lua +++ b/coordinator/sounder.lua @@ -51,7 +51,7 @@ function sounder.set(states) -- re-compute output if needed, then play audio if available if alarm_ctl.stream.is_recompute_needed() then alarm_ctl.stream.compute_buffer() end - if alarm_ctl.stream.has_next_block() then play() else sounder.stop() end + if alarm_ctl.stream.any_active() then play() else sounder.stop() end end -- stop all audio and clear output buffer diff --git a/coordinator/startup.lua b/coordinator/startup.lua index 910d3db..b4f08ce 100644 --- a/coordinator/startup.lua +++ b/coordinator/startup.lua @@ -22,7 +22,7 @@ local sounder = require("coordinator.sounder") local apisessions = require("coordinator.session.apisessions") -local COORDINATOR_VERSION = "v1.0.8" +local COORDINATOR_VERSION = "v1.0.9" local println = util.println local println_ts = util.println_ts diff --git a/rtu/startup.lua b/rtu/startup.lua index 1663bce..02679c2 100644 --- a/rtu/startup.lua +++ b/rtu/startup.lua @@ -31,7 +31,7 @@ local sna_rtu = require("rtu.dev.sna_rtu") local sps_rtu = require("rtu.dev.sps_rtu") local turbinev_rtu = require("rtu.dev.turbinev_rtu") -local RTU_VERSION = "v1.6.1" +local RTU_VERSION = "v1.6.2" local RTU_UNIT_TYPE = types.RTU_UNIT_TYPE local RTU_UNIT_HW_STATE = databus.RTU_UNIT_HW_STATE diff --git a/rtu/threads.lua b/rtu/threads.lua index 6ac05bd..bed6294 100644 --- a/rtu/threads.lua +++ b/rtu/threads.lua @@ -73,7 +73,7 @@ function threads.thread__main(smem) -- re-compute output if needed, then play audio if available if sounder.stream.is_recompute_needed() then sounder.stream.compute_buffer() - if sounder.stream.has_next_block() then sounder.play() else sounder.stop() end + if sounder.stream.any_active() then sounder.play() else sounder.stop() end end end diff --git a/scada-common/audio.lua b/scada-common/audio.lua index 32dfb57..019b510 100644 --- a/scada-common/audio.lua +++ b/scada-common/audio.lua @@ -296,6 +296,9 @@ function audio.new_stream() end end + -- check if any alarms are active + function public.any_active() return self.any_active end + -- check if the next audio block has data function public.has_next_block() return #self.quad_buffer[self.next_block] > 0 end diff --git a/scada-common/util.lua b/scada-common/util.lua index bf44884..ea53575 100644 --- a/scada-common/util.lua +++ b/scada-common/util.lua @@ -8,7 +8,7 @@ local cc_strings = require("cc.strings") local util = {} -- scada-common version -util.version = "1.0.1" +util.version = "1.0.2" -- ENVIRONMENT CONSTANTS --