reconnect alarm sounder speaker on peripheral reconnect

This commit is contained in:
Mikayla Fischler
2022-12-04 14:36:29 -05:00
parent 9475700930
commit 5224dcbd25
2 changed files with 16 additions and 1 deletions

View File

@@ -288,6 +288,13 @@ function sounder.init(speaker, volume)
gen_tone_8()
end
-- reconnect the speaker peripheral
---@param speaker table speaker peripheral
function sounder.reconnect(speaker)
alarm_ctl.speaker = speaker
alarm_ctl.playing = false
end
-- check alarm state to enable/disable alarms
---@param units table|nil unit list or nil to use test mode
function sounder.eval(units)