Lua virtual replace (#7337)

This commit is contained in:
Carsten W
2020-01-27 15:10:46 +01:00
committed by 3djc
parent 3744e8e1ea
commit 23f16d039e
18 changed files with 128 additions and 143 deletions
@@ -237,9 +237,9 @@ end
-- Main
local function runFieldsPage(event)
if event == EVT_EXIT_BREAK then -- exit script
if event == EVT_VIRTUAL_EXIT then -- exit script
return 2
elseif event == EVT_ENTER_BREAK or event == EVT_ROT_BREAK then -- toggle editing/selecting current field
elseif event == EVT_VIRTUAL_ENTER then -- toggle editing/selecting current field
if fields[current][4] ~= nil then
edit = not edit
if edit == false then
@@ -247,15 +247,15 @@ local function runFieldsPage(event)
end
end
elseif edit then
if event == EVT_PLUS_FIRST or event == EVT_ROT_RIGHT or event == EVT_PLUS_REPT then
if event == EVT_VIRTUAL_INC or event == EVT_VIRTUAL_INC_REPT then
addField(1)
elseif event == EVT_MINUS_FIRST or event == EVT_ROT_LEFT or event == EVT_MINUS_REPT then
elseif event == EVT_VIRTUAL_DEC or event == EVT_VIRTUAL_DEC_REPT then
addField(-1)
end
else
if event == EVT_MINUS_FIRST or event == EVT_ROT_RIGHT then
if event == EVT_VIRTUAL_NEXT then
selectField(1)
elseif event == EVT_PLUS_FIRST or event == EVT_ROT_LEFT then
elseif event == EVT_VIRTUAL_PREV then
selectField(-1)
end
end
@@ -313,11 +313,11 @@ local function runCalibrationPage(event)
lcd.drawBitmap(Bitmap.open("img/done.bmp"),200, 100)
lcd.drawText(160, 220, "Press [RTN] when ready", attr)
end
if calibrationStep > 6 and (event == EVT_ENTER_BREAK or event == EVT_EXIT_BREAK) then
if calibrationStep > 6 and (event == EVT_VIRTUAL_ENTER or event == EVT_VIRTUAL_EXIT) then
return 2
elseif event == EVT_ENTER_BREAK then
elseif event == EVT_VIRTUAL_ENTER then
calibrationState = 1
elseif event == EVT_EXIT_BREAK then
elseif event == EVT_VIRTUAL_EXIT then
if calibrationStep > 0 then
calibrationStep = 0
end
@@ -341,9 +341,9 @@ local function run(event)
if event == nil then
error("Cannot be run as a model script!")
return 2
elseif event == EVT_PAGE_BREAK or event == EVT_PAGEDN_FIRST then
elseif event == EVT_VIRTUAL_NEXT_PAGE then
selectPage(1)
elseif event == EVT_PAGE_LONG or event == EVT_PAGEUP_FIRST then
elseif event == EVT_VIRTUAL_PREV_PAGE then
killEvents(event);
selectPage(-1)
end