From a20ec591948b5b8d3acc72d30387402e709b865f Mon Sep 17 00:00:00 2001 From: John Wieland Date: Thu, 2 May 2024 13:33:53 -0400 Subject: [PATCH] v4.1 Edge compatable Added background advancement --- Grayscale Radios/iTunes.lua | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/Grayscale Radios/iTunes.lua b/Grayscale Radios/iTunes.lua index 76d6868..5100c2a 100644 --- a/Grayscale Radios/iTunes.lua +++ b/Grayscale Radios/iTunes.lua @@ -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 @@ -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)) @@ -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)