-
Notifications
You must be signed in to change notification settings - Fork 0
/
FM_Confidence_Monitoring.lua
92 lines (74 loc) · 2.96 KB
/
FM_Confidence_Monitoring.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
--[[
FM Confidence Monitor
Created by K. Rhodus
Version History:
1.0 - Initial Build
]]--
-----------------------------------------------------------------------------------------------------------------------------------------
-- Script Setup --
----------------------------------------------------------------------------------------------------------------------------------------
json = require("rapidjson")
SigPresence = Component.New("FMSigPres") --Move to control
-----------------------------------------------------------------------------------------------------------------------------------------
-- Timer Setup --
----------------------------------------------------------------------------------------------------------------------------------------
CheckTimer = Timer.New()
CheckTimer.EventHandler = function()
if Controls.FMPower.Boolean then
local overallFlag = false
--print(json.encode(SigPresFlags, {"pretty=true"}))
for idx,ctl in ipairs(SigPresFlags) do
if ctl == true then
overallFlag = true
end
SigPresFlags[idx] = false
end
--print(json.encode(SigPresFlags, {"pretty=true"}))
print(overallFlag)
if overallFlag == false then
Controls.Status.Value = 1
Controls.Status.String = "No Show Audio Detected"
else
Controls.Status.Value = 0
Controls.Status.String = "Show Audio Detected"
end
else
Controls.Status.Value = 0
Controls.Status.String = "Outside of Transmit Hours"
end
end
-----------------------------------------------------------------------------------------------------------------------------------------
-- Signal Presence Flagging --
----------------------------------------------------------------------------------------------------------------------------------------
SigPresLEDs = {SigPresence["signal.presence.1"], SigPresence["signal.presence.3"]}
SigPresFlags = {}
for idx,ctl in ipairs(SigPresLEDs) do
table.insert(SigPresFlags, false)
ctl.EventHandler = function(c)
if not c.Boolean then
SigPresFlags[idx] = true
print("-- FLAG "..idx.." - NO SIGNAL")
end
end
end
-----------------------------------------------------------------------------------------------------------------------------------------
-- Script Startup --
----------------------------------------------------------------------------------------------------------------------------------------
Controls.Status.Value = 0
if Controls.FMPower.Boolean then
CheckTimer:Start(600)
Controls.Status.String = "Starting FM Monitoring - Check in 10 Mins"
else
CheckTimer:Stop()
Controls.Status.String = "Outside of Transmit Hours"
end
Controls.FMPower.EventHandler = function()
if Controls.FMPower.Boolean then
CheckTimer:Start(600)
Controls.Status.String = "Starting FM Monitoring - Check in 10 Mins"
else
CheckTimer:Stop()
Controls.Status.String = "Outside of Transmit Hours"
end
end