Skip to content

Commit

Permalink
Updated to V2.10
Browse files Browse the repository at this point in the history
Comments added for versions 2.8-2.10 for Special function switch = XXX, func =XX numbers in the file at the refresh area
  • Loading branch information
jrwieland authored Apr 26, 2024
1 parent aabbf29 commit 3c0efc6
Showing 1 changed file with 37 additions and 20 deletions.
57 changes: 37 additions & 20 deletions Color Screen Widget/EdgeTX/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ local function create(zone, options)
local tunes = { zone=zone, options=options}
model.setGlobalVariable(7,0,1)
model.setGlobalVariable(8,0,1)
model.setCustomFunction(62,{switch = 144,func =16,name = playlist[1][2]})--resets playing song on to the 1st song on startup
model.setCustomFunction(62,{switch = 228,func =11,name = playlist[1][2]})--resets playing song on to the 1st song on startup
aircraft = Bitmap.open("/IMAGES/" .. model.getInfo().bitmap)
return tunes
end
Expand Down Expand Up @@ -243,12 +243,17 @@ local function refreshZoneFull(tunes)
local ver = getVersion() --OpenTX Version
lcd.drawBitmap(elogo,3,0,53)
lcd.drawText(63,4,"V. "..ver)
lcd.drawText(185,23, model.getInfo().name,DBLSIZE)--adjust as needed
lcd.drawBitmap(aircraft,175,55)--adjust as needed
lcd.drawText(185,5, model.getInfo().name,DBLSIZE)--adjust as needed
lcd.drawBitmap(aircraft,170,45,90)--adjust as needed

--Transmitter battery
local batt = getValue("tx-voltage")
lcd.drawText(8, 50,"TX Batt "..round(batt,1).."v")

--Receiver Voltage battery

lcd.drawText(100, 50,"RX Batt ")
lcd.drawChannel(160,50,"RxBt")

-- Flight Battery Loaded
--[[ I use different capacity batteries, the timers are
Expand All @@ -271,13 +276,19 @@ local function refreshZoneFull(tunes)
-- Flight Mode
lcd.drawFilledRectangle(380,60,90,2)
lcd.drawFilledRectangle(380,105,90,2)
local fmno, fmname = getFlightMode()
if fmname == "" then
fmname = "FM".. fmno
lcd.drawText(410, 63, fmname)else
lcd.drawText(410, 63, "FM"..fmno)
lcd.drawText(380,83, fmname)
end
-- local fmno, fmname = getFlightMode()
-- if fmname == "" then
-- fmname = "FM".. fmno
-- lcd.drawText(410, 63, fmname)else
-- lcd.drawText(410, 63, "FM"..fmno)
-- lcd.drawText(380,83, fmname)
-- end

-- Speed
lcd.drawText(360,63,"Speed= ")
lcd.drawChannel(420,63,"GSpd")
lcd.drawText(346,83,"Top Spd= ")
lcd.drawChannel(420,83,"GSpd+",2)

--Flight Time
local fly=model.getTimer(1).value --flight duration timer: 0=timer1, 1=timer2
Expand All @@ -296,10 +307,10 @@ local function refreshZoneFull(tunes)

-- Altitude
lcd.drawText(8,143,"HEIGHT= ")
lcd.drawChannel(80,143,"Alt")
lcd.drawChannel(80,143,"GAlt")
lcd.drawText(130, 143,"//Max")
lcd.drawChannel(185,143,"Alt+",2)

lcd.drawChannel(185,143,"GAlt+",2)
--Tementry separator bar
local y = 185
lcd.drawFilledRectangle(6,y-18,462,6,GREY_DEFAULT)
Expand Down Expand Up @@ -334,26 +345,32 @@ local function refreshZoneFull(tunes)
end

function refresh(tunes)
listP = getValue("ls63")
--SF commands for songs to play based on Version Installed
-- Edge 2.8 switch = 132,func = 16
-- Edge 2.9 switch = 144, func =16
-- Edge 2.10 switch = 228,func =11

listP = getValue("ls63")
listN = getValue("ls64")
prevS = getValue("ls61")
nextS = getValue("ls62")
SongSw = getFieldInfo("ls60").id

--song over

local long=playlist[playingSong][3]
if model.getTimer(2).value >= long then
if playingSong == #playlist then
model.setGlobalVariable(7,0,1)
playingSong = model.getGlobalVariable(7,0)
flushAudio()
model.setCustomFunction(62,{switch = 144,func =16,name = playlist[playingSong][2]})
model.setCustomFunction(62,{switch = 228,func =11,name = playlist[playingSong][2]})
model.setTimer(2,{value=0})
else
flushAudio()
playingSong = playingSong +1
model.setGlobalVariable(7,0,playingSong)
model.setCustomFunction(62,{switch = 144,func =16,name = playlist[playingSong][2]})
model.setCustomFunction(62,{switch = 228,func =11,name = playlist[playingSong][2]})
model.setTimer(2,{value=0})
end

Expand All @@ -368,7 +385,7 @@ function refresh(tunes)
playingSong = model.getGlobalVariable(7,0)
end
flushAudio()
model.setCustomFunction(62,{switch = 144,func =16,name = playlist[playingSong][2]})
model.setCustomFunction(62,{switch = 228,func =11,name = playlist[playingSong][2]})
model.setTimer(2,{value=0})
else
nextSongSwitchPressed = false
Expand All @@ -387,7 +404,7 @@ function refresh(tunes)
playingSong = 1
end
loadScript("/SOUNDS/lists/"..set2.."/playlist.lua")()
model.setCustomFunction(62,{switch = 144,func =16,name = playlist[playingSong][2]})
model.setCustomFunction(62,{switch = 228,func =11,name = playlist[playingSong][2]})
model.setGlobalVariable(7,0,1)
flushAudio()
model.setTimer(2,{value=0})
Expand All @@ -409,7 +426,7 @@ function refresh(tunes)
end

loadScript("/SOUNDS/lists/"..set2.."/playlist.lua")()
model.setCustomFunction(62,{switch = 144,func =16,name = playlist[playingSong][2]})
model.setCustomFunction(62,{switch = 228,func =11,name = playlist[playingSong][2]})
model.setGlobalVariable(7,0,1)
flushAudio()
model.setTimer(2,{value=0})
Expand All @@ -427,7 +444,7 @@ function refresh(tunes)
playingSong = model.getGlobalVariable(7,0)
end
flushAudio()
model.setCustomFunction(62,{switch = 144,func =16,name = playlist[playingSong][2]})
model.setCustomFunction(62,{switch = 228,func =11,name = playlist[playingSong][2]})
model.setTimer(2,{value=0})
end
else
Expand Down

0 comments on commit 3c0efc6

Please sign in to comment.