#183 RTU front panel

This commit is contained in:
Mikayla Fischler
2023-04-20 20:40:28 -04:00
parent df45f6c984
commit d143015cc7
16 changed files with 471 additions and 45 deletions

View File

@ -451,19 +451,13 @@ function element.new(args)
function public.show()
protected.window.setVisible(true)
protected.start_anim()
for i = 1, #self.children do
self.children[i].show()
end
for _, child in pairs(self.children) do child.show() end
end
-- hide the element
function public.hide()
protected.stop_anim()
for i = 1, #self.children do
self.children[i].hide()
end
for _, child in pairs(self.children) do child.hide() end
protected.window.setVisible(false)
end

View File

@ -33,7 +33,7 @@ local function indicator_led(args)
args.height = 1
-- determine width
args.width = math.max(args.min_label_width or 1, string.len(args.label)) + 2
args.width = math.max(args.min_label_width or 0, string.len(args.label)) + 2
-- flasher state
local flash_on = true
@ -89,8 +89,10 @@ local function indicator_led(args)
-- write label and initial indicator light
e.on_update(false)
e.window.setCursorPos(3, 1)
e.window.write(args.label)
if string.len(args.label) > 0 then
e.window.setCursorPos(3, 1)
e.window.write(args.label)
end
return e.get()
end

View File

@ -37,7 +37,7 @@ local function indicator_led_pair(args)
args.height = 1
-- determine width
args.width = math.max(args.min_label_width or 1, string.len(args.label)) + 2
args.width = math.max(args.min_label_width or 0, string.len(args.label)) + 2
-- flasher state
local flash_on = true
@ -103,8 +103,10 @@ local function indicator_led_pair(args)
-- write label and initial indicator light
e.on_update(1)
e.window.setCursorPos(3, 1)
e.window.write(args.label)
if string.len(args.label) > 0 then
e.window.setCursorPos(3, 1)
e.window.write(args.label)
end
return e.get()
end

View File

@ -24,7 +24,7 @@ local function indicator_led_rgb(args)
args.height = 1
-- determine width
args.width = math.max(args.min_label_width or 1, string.len(args.label)) + 2
args.width = math.max(args.min_label_width or 0, string.len(args.label)) + 2
-- create new graphics element base object
local e = element.new(args)
@ -48,8 +48,10 @@ local function indicator_led_rgb(args)
-- write label and initial indicator light
e.on_update(1)
e.window.setCursorPos(3, 1)
e.window.write(args.label)
if string.len(args.label) > 0 then
e.window.setCursorPos(3, 1)
e.window.write(args.label)
end
return e.get()
end