#545 #544 added cc graphics and peripheral classes

This commit is contained in:
Mikayla Fischler
2024-09-14 22:16:12 -04:00
parent 85fc8d2920
commit ec2921e393
13 changed files with 95 additions and 30 deletions

View File

@@ -235,7 +235,7 @@ function rtu.init_unit(device)
end
-- create an alarm speaker sounder
---@param speaker table device peripheral
---@param speaker Speaker device peripheral
function rtu.init_sounder(speaker)
---@class rtu_speaker_sounder
local spkr_ctl = {

View File

@@ -245,6 +245,7 @@ function threads.thread__main(smem)
if type ~= nil and device ~= nil then
if type == "modem" then
---@cast device Modem
-- we only care if this is our wireless modem
if nic.is_modem(device) then
nic.disconnect()
@@ -263,6 +264,7 @@ function threads.thread__main(smem)
log.warning("non-comms modem disconnected")
end
elseif type == "speaker" then
---@cast device Speaker
for i = 1, #sounders do
if sounders[i].speaker == device then
table.remove(sounders, i)
@@ -298,6 +300,7 @@ function threads.thread__main(smem)
if type ~= nil and device ~= nil then
if type == "modem" then
---@cast device Modem
if device.isWireless() and not nic.is_connected() then
-- reconnected modem
nic.connect(device)
@@ -312,6 +315,7 @@ function threads.thread__main(smem)
log.info("wired modem reconnected")
end
elseif type == "speaker" then
---@cast device Speaker
table.insert(sounders, rtu.init_sounder(device))
println_ts("speaker connected")