Skip to content

Commit

Permalink
v4.1
Browse files Browse the repository at this point in the history
Edge compatable
Added background advancement
  • Loading branch information
jrwieland authored May 2, 2024
1 parent 68cb492 commit a20ec59
Showing 1 changed file with 19 additions and 4 deletions.
23 changes: 19 additions & 4 deletions Grayscale Radios/iTunes.lua
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
--Locals
local playingSong = 1
local errorOccured = false
local ver = getVersion() --OpenTX Version
local ver = getVersion() --EdgeTX Version
loadScript("/SOUNDS/lists/bubba_mix/playlist.lua")() --1st playlist in songList (see sample list below)

--Playlists folders names i.e. /SONGS/lists/"foldername" below are sample names
Expand Down Expand Up @@ -61,14 +61,29 @@ end

--BackGround
local function background(tunes)
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 = sw1,func = 16,name = playlist[playingSong][2]})
model.setTimer(2,{value=0})
else
flushAudio()
playingSong = playingSong +1
model.setGlobalVariable(7,0,playingSong)
model.setCustomFunction(62,{switch = sw1,func = 16,name = playlist[playingSong][2]})
model.setTimer(2,{value=0})
end
end
end

local function run(tunes)
--Update Locals
lcd.clear()
local selection=playingSong
local long=playlist[playingSong][3]--do not change this value it is the length of the current song playing
local upTime=model.getTimer(2).value--do not change this value it is how long the current song has played
local long=playlist[playingSong][3] --do not change this value it is the length of the current song playing
local upTime=model.getTimer(2).value --do not change this value it is how long the current song has played
local batt = getValue("tx-voltage")
local datenow = getDateTime()
local timemins = (string.format("%02d",datenow.min))
Expand Down Expand Up @@ -123,7 +138,7 @@ local function run(tunes)
lcd.drawText(LCD_W/2-(string.len(title))/2*5, y+12, title, SMLSIZE)

-- Progressbar
--local k = math.floor((upTime/long)*33)*10
local k = math.floor((upTime/long)*33)*10
lcd.drawLine(0, y+18, LCD_W, y+18,SOLID,FORCE)
lcd.drawFilledRectangle(20, y+11, math.floor((upTime/long)*(LCD_W-43)), 7)
lcd.drawTimer(1, y+12, upTime, SMLSIZE+INVERS)
Expand Down

0 comments on commit a20ec59

Please sign in to comment.