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,25 +331,27 @@ 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
for i,v in ipairs(channel_names) do if done == 0 then
output = model.getOutput(i-1) for i,v in ipairs(channel_names) do
output["name"] = v output = model.getOutput(i-1)
model.setOutput(i-1,output) output["name"] = v
nbr = i model.setOutput(i-1,output)
end nbr = i
for i = nbr, 15 do end
output = model.getOutput(i) for i = nbr, 15 do
output["name"] = "n-a" output = model.getOutput(i)
model.setOutput(i,output) output["name"] = "n-a"
end model.setOutput(i,output)
if bind_ch == 1 then end
output = model.getOutput(15) if bind_ch == 1 then
output["name"] = "BindCH" output = model.getOutput(15)
model.setOutput(15,output) output["name"] = "BindCH"
model.setOutput(15,output)
end
done = 1
end 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() if event == EVT_VIRTUAL_ENTER or event == EVT_VIRTUAL_EXIT then
else return 2
if event == EVT_VIRTUAL_ENTER or event == EVT_VIRTUAL_EXIT then
return 2
end
end end
return 0
end end
return 0
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,35 +321,37 @@ 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
for i,v in ipairs(channel_names) do if done == 0 then
output = model.getOutput(i-1) for i,v in ipairs(channel_names) do
output["name"] = v output = model.getOutput(i-1)
model.setOutput(i-1,output) output["name"] = v
nbr = i model.setOutput(i-1,output)
nbr = i
end
for i = nbr, 15 do
output = model.getOutput(i)
output["name"] = "n-a"
model.setOutput(i,output)
end
if bind_ch == 1 then
output = model.getOutput(15)
output["name"] = "BindCH"
model.setOutput(15,output)
end
done = 1
end end
for i = nbr, 15 do lcd.drawText(x_pos, y_pos+y_inc*line,"Done!", lcd_opt)
output = model.getOutput(i)
output["name"] = "n-a"
model.setOutput(i,output)
end
if bind_ch == 1 then
output = model.getOutput(15)
output["name"] = "BindCH"
model.setOutput(15,output)
end
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() if event == EVT_VIRTUAL_ENTER or event == EVT_VIRTUAL_EXIT then
else return 2
if event == EVT_VIRTUAL_ENTER or event == EVT_VIRTUAL_EXIT then
return 2
end
end end
return 0
end end
return 0
end end
return { init=Multi_Init, run=Multi_Run } return { init=Multi_Init, run=Multi_Run }
@@ -331,25 +331,27 @@ 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
for i,v in ipairs(channel_names) do if done == 0 then
output = model.getOutput(i-1) for i,v in ipairs(channel_names) do
output["name"] = v output = model.getOutput(i-1)
model.setOutput(i-1,output) output["name"] = v
nbr = i model.setOutput(i-1,output)
end nbr = i
for i = nbr, 15 do end
output = model.getOutput(i) for i = nbr, 15 do
output["name"] = "n-a" output = model.getOutput(i)
model.setOutput(i,output) output["name"] = "n-a"
end model.setOutput(i,output)
if bind_ch == 1 then end
output = model.getOutput(15) if bind_ch == 1 then
output["name"] = "BindCH" output = model.getOutput(15)
model.setOutput(15,output) output["name"] = "BindCH"
model.setOutput(15,output)
end
done = 1
end 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() if event == EVT_VIRTUAL_ENTER or event == EVT_VIRTUAL_EXIT then
else return 2
if event == EVT_VIRTUAL_ENTER or event == EVT_VIRTUAL_EXIT then
return 2
end
end end
return 0
end end
return 0
end end
return { init=Multi_Init, run=Multi_Run } return { init=Multi_Init, run=Multi_Run }