Skip to content

Commit

Permalink
Started TOOLS script
Browse files Browse the repository at this point in the history
  • Loading branch information
codecae committed May 9, 2020
1 parent 8375c2a commit 043e534
Showing 1 changed file with 19 additions and 8 deletions.
27 changes: 19 additions & 8 deletions lua/SCRIPTS/TELEMETRY/crsfdp.lua → lua/SCRIPTS/TOOLS/bfCms.lua
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
local toolName = "TNS|Betaflight CMS|TNE"

cmsMenuOpen = false
lastMenuEventTime = 0
radio = {}
Expand Down Expand Up @@ -73,6 +75,9 @@ local supportedPlatforms = {
top = 1,
left = 64,
},
exit = {
event = EVT_EXIT_BREAK
},
lcd = {
width = 128,
height = 64,
Expand All @@ -90,6 +95,9 @@ local supportedPlatforms = {
top = 1,
left = 156,
},
exit = {
event = EVT_EXIT_BREAK
},
lcd = {
width = 212,
height = 64,
Expand Down Expand Up @@ -168,6 +176,8 @@ local function init()
screenBuffer.rows = radio.lcd.rows
screenBuffer.cols = radio.lcd.cols
screenBuffer.reset()
displayPortCmd(_.subCommand.close, nil)
cmsMenuOpen = false
end

local function run(event)
Expand Down Expand Up @@ -206,18 +216,19 @@ local function run(event)
end
if (cmsMenuOpen == true) then
lcd.drawText(radio.refresh.left, radio.refresh.top, radio.refresh.text, SMLSIZE)
elseif (cmsMenuOpen == false) then
end
if (cmsMenuOpen == false) then
displayPortCmd(_.subCommand.open, { screenBuffer.rows, screenBuffer.cols })
elseif (event == radio.refresh.event) then
end
if (event == radio.refresh.event) then
displayPortCmd(_.subCommand.poll, nil)
end
end

local function background()
if cmsMenuOpen == true and lastMenuEventTime + 100 < getTime() then
if (event == radio.exit.event) then
displayPortCmd(_.subCommand.close, nil)
cmsMenuOpen = false
end
return 1
end
return 0
end

return { init=init, run=run, background=background }
return { init=init, run=run }

0 comments on commit 043e534

Please sign in to comment.