Some Multi renamer fixes

This commit is contained in:
3djc
2020-04-24 17:31:38 +02:00
parent 262386d21c
commit ec545ce06e
3 changed files with 74 additions and 77 deletions
@@ -331,6 +331,7 @@ local function Multi_Draw_LCD()
lcd.drawText(x_pos, y_pos+y_inc*line,"Setting channel names.", lcd_opt) lcd.drawText(x_pos, y_pos+y_inc*line,"Setting channel names.", lcd_opt)
line = line + 1 line = line + 1
local output, nbr local output, nbr
if done == 0 then
for i,v in ipairs(channel_names) do for i,v in ipairs(channel_names) do
output = model.getOutput(i-1) output = model.getOutput(i-1)
output["name"] = v output["name"] = v
@@ -347,9 +348,10 @@ local function Multi_Draw_LCD()
output["name"] = "BindCH" output["name"] = "BindCH"
model.setOutput(15,output) model.setOutput(15,output)
end end
done = 1
end
lcd.drawText(x_pos, y_pos+y_inc*line,"Done!", lcd_opt) lcd.drawText(x_pos, y_pos+y_inc*line,"Done!", lcd_opt)
line = line + 1 line = line + 1
done = 1
end end
end end
@@ -363,15 +365,12 @@ local function Multi_Run(event)
error("Cannot be run as a model script!") error("Cannot be run as a model script!")
return 2 return 2
else else
if done == 0 then
Multi_Draw_LCD() Multi_Draw_LCD()
else
if event == EVT_VIRTUAL_ENTER or event == EVT_VIRTUAL_EXIT then if event == EVT_VIRTUAL_ENTER or event == EVT_VIRTUAL_EXIT then
return 2 return 2
end end
end end
return 0 return 0
end
end end
return { init=Multi_Init, run=Multi_Run } return { init=Multi_Init, run=Multi_Run }
@@ -286,16 +286,16 @@ local function Multi_Draw_LCD()
end end
end end
lcd.drawText(x_pos, y_pos+y_inc*line,module_pos .. " Multi detected.",lcd_opt) lcd.drawText(x_pos, y_pos+y_inc*line,module_pos .. " Multi detected.", lcd_opt)
line = line + 1 line = line + 1
if (ch_order == -1) then if (ch_order == -1) then
lcd.drawText(x_pos, y_pos+y_inc*line,"Channels order can't be read from Multi...",lcd_opt) lcd.drawText(x_pos, y_pos+y_inc*line,"Channels order can't be read from Multi...", lcd_opt)
line = line + 1 line = line + 1
end end
if protocol_name == nil or sub_protocol_name == nil then if protocol_name == nil or sub_protocol_name == nil then
lcd.drawText(x_pos, y_pos+y_inc*line,"Unknown protocol/sub_protocol...",lcd_opt) lcd.drawText(x_pos, y_pos+y_inc*line,"Unknown protocol/sub_protocol...", lcd_opt)
else if LCD_W > 128 then else if LCD_W > 128 then
lcd.drawText(x_pos, y_pos+y_inc*line,"Protocol: " .. protocol_name .. " / SubProtocol: " .. sub_protocol_name,lcd_opt) lcd.drawText(x_pos, y_pos+y_inc*line,"Protocol: " .. protocol_name .. " / SubProtocol: " .. sub_protocol_name, lcd_opt)
line = line + 1 line = line + 1
else else
lcd.drawText(x_pos, y_pos+y_inc*line,"Protocol: " .. protocol_name, lcd_opt) lcd.drawText(x_pos, y_pos+y_inc*line,"Protocol: " .. protocol_name, lcd_opt)
@@ -321,16 +321,17 @@ local function Multi_Draw_LCD()
end end
end end
if LCD_W > 128 then if LCD_W > 128 then
lcd.drawText(x_pos, y_pos+y_inc*line,"Channels: " .. text1,lcd_opt) lcd.drawText(x_pos, y_pos+y_inc*line,"Channels: " .. text1, lcd_opt)
line = line + 1 line = line + 1
if text2 ~= "" then if text2 ~= "" then
lcd.drawText(x_pos*9, y_pos+y_inc*line,text2,lcd_opt) lcd.drawText(x_pos*9, y_pos+y_inc*line,text2, lcd_opt)
line = line + 1 line = line + 1
end end
end end
lcd.drawText(x_pos, y_pos+y_inc*line,"Setting channel names.",lcd_opt) lcd.drawText(x_pos, y_pos+y_inc*line,"Setting channel names.", lcd_opt)
line = line + 1 line = line + 1
local output, nbr local output, nbr
if done == 0 then
for i,v in ipairs(channel_names) do for i,v in ipairs(channel_names) do
output = model.getOutput(i-1) output = model.getOutput(i-1)
output["name"] = v output["name"] = v
@@ -347,10 +348,11 @@ local function Multi_Draw_LCD()
output["name"] = "BindCH" output["name"] = "BindCH"
model.setOutput(15,output) model.setOutput(15,output)
end end
lcd.drawText(x_pos, y_pos+y_inc*line,"Done!",lcd_opt)
line = line + 1
done = 1 done = 1
end end
lcd.drawText(x_pos, y_pos+y_inc*line,"Done!", lcd_opt)
line = line + 1
end
end end
-- Init -- Init
@@ -363,15 +365,12 @@ local function Multi_Run(event)
error("Cannot be run as a model script!") error("Cannot be run as a model script!")
return 2 return 2
else else
if done == 0 then
Multi_Draw_LCD() Multi_Draw_LCD()
else
if event == EVT_VIRTUAL_ENTER or event == EVT_VIRTUAL_EXIT then if event == EVT_VIRTUAL_ENTER or event == EVT_VIRTUAL_EXIT then
return 2 return 2
end end
end end
return 0 return 0
end
end end
return { init=Multi_Init, run=Multi_Run } return { init=Multi_Init, run=Multi_Run }
@@ -331,6 +331,7 @@ local function Multi_Draw_LCD()
lcd.drawText(x_pos, y_pos+y_inc*line,"Setting channel names.", lcd_opt) lcd.drawText(x_pos, y_pos+y_inc*line,"Setting channel names.", lcd_opt)
line = line + 1 line = line + 1
local output, nbr local output, nbr
if done == 0 then
for i,v in ipairs(channel_names) do for i,v in ipairs(channel_names) do
output = model.getOutput(i-1) output = model.getOutput(i-1)
output["name"] = v output["name"] = v
@@ -347,9 +348,10 @@ local function Multi_Draw_LCD()
output["name"] = "BindCH" output["name"] = "BindCH"
model.setOutput(15,output) model.setOutput(15,output)
end end
done = 1
end
lcd.drawText(x_pos, y_pos+y_inc*line,"Done!", lcd_opt) lcd.drawText(x_pos, y_pos+y_inc*line,"Done!", lcd_opt)
line = line + 1 line = line + 1
done = 1
end end
end end
@@ -363,15 +365,12 @@ local function Multi_Run(event)
error("Cannot be run as a model script!") error("Cannot be run as a model script!")
return 2 return 2
else else
if done == 0 then
Multi_Draw_LCD() Multi_Draw_LCD()
else
if event == EVT_VIRTUAL_ENTER or event == EVT_VIRTUAL_EXIT then if event == EVT_VIRTUAL_ENTER or event == EVT_VIRTUAL_EXIT then
return 2 return 2
end end
end end
return 0 return 0
end
end end
return { init=Multi_Init, run=Multi_Run } return { init=Multi_Init, run=Multi_Run }