Skip to content

Commit

Permalink
chore: replace deprecated 'Bitmap'. (#168)
Browse files Browse the repository at this point in the history
  • Loading branch information
philmoz authored Oct 10, 2024
1 parent b236171 commit eb5496a
Show file tree
Hide file tree
Showing 23 changed files with 156 additions and 156 deletions.
26 changes: 13 additions & 13 deletions sdcard/c320x480/SCRIPTS/WIZARD/glider/wizard.lua
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@ local pages = {}
local fields = {}

-- load common Bitmaps
local ImgMarkBg = Bitmap.open("img/mark_bg.png")
local BackgroundImg = Bitmap.open("img/background.png")
local ImgPlane = Bitmap.open("img/plane.png")
local ImgPageUp = Bitmap.open("img/pageup.png")
local ImgPageDn = Bitmap.open("img/pagedn.png")
local ImgMarkBg = bitmap.open("img/mark_bg.png")
local BackgroundImg = bitmap.open("img/background.png")
local ImgPlane = bitmap.open("img/plane.png")
local ImgPageUp = bitmap.open("img/pageup.png")
local ImgPageDn = bitmap.open("img/pagedn.png")


-- Change display attribute to current field
Expand Down Expand Up @@ -144,7 +144,7 @@ local ImgEngine
local function runMotorConfig(event)
lcd.clear()
if ImgEngine == nil then
ImgEngine = Bitmap.open("img/prop.png")
ImgEngine = bitmap.open("img/prop.png")
end
lcd.drawBitmap(BackgroundImg, 0, 0)
lcd.drawBitmap(ImgPageDn, 455, 95)
Expand Down Expand Up @@ -177,8 +177,8 @@ local ImgAilL
local function runAilConfig(event)
lcd.clear()
if ImgAilR == nil then
ImgAilR = Bitmap.open("img/rail.png")
ImgAilL = Bitmap.open("img/lail.png")
ImgAilR = bitmap.open("img/rail.png")
ImgAilL = bitmap.open("img/lail.png")
end
lcd.drawBitmap(BackgroundImg, 0, 0)
lcd.drawBitmap(ImgPageUp, 0, 95)
Expand Down Expand Up @@ -223,7 +223,7 @@ local ImgFlp
local function runFlapsConfig(event)
lcd.clear()
if ImgFlp == nil then
ImgFlp = Bitmap.open("img/flap.png")
ImgFlp = bitmap.open("img/flap.png")
end
lcd.drawBitmap(BackgroundImg, 0, 0)
lcd.drawBitmap(ImgPageUp, 0, 95)
Expand Down Expand Up @@ -271,9 +271,9 @@ local ImgTailRud
local function runTailConfig(event)
lcd.clear()
if ImgTail == nil then
ImgTail = Bitmap.open("img/tail.png")
ImgVTail = Bitmap.open("img/vtail.png")
ImgTailRud = Bitmap.open("img/tailrud.png")
ImgTail = bitmap.open("img/tail.png")
ImgVTail = bitmap.open("img/vtail.png")
ImgTailRud = bitmap.open("img/tailrud.png")
end
lcd.drawBitmap(BackgroundImg, 0, 0)
lcd.drawBitmap(ImgPageUp, 0, 95)
Expand Down Expand Up @@ -345,7 +345,7 @@ local ImgSummary
local function runConfigSummary(event)
lcd.clear()
if ImgSummary == nil then
ImgSummary = Bitmap.open("img/summary.png")
ImgSummary = bitmap.open("img/summary.png")
end
fields = ConfigSummaryFields
lcd.drawBitmap(BackgroundImg, 0, 0)
Expand Down
26 changes: 13 additions & 13 deletions sdcard/c320x480/SCRIPTS/WIZARD/plane/wizard.lua
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@ local pages = {}
local fields = {}

-- load common Bitmaps
local ImgMarkBg = Bitmap.open("img/mark_bg.png")
local BackgroundImg = Bitmap.open("img/background.png")
local ImgPlane = Bitmap.open("img/plane.png")
local ImgPageUp = Bitmap.open("img/pageup.png")
local ImgPageDn = Bitmap.open("img/pagedn.png")
local ImgMarkBg = bitmap.open("img/mark_bg.png")
local BackgroundImg = bitmap.open("img/background.png")
local ImgPlane = bitmap.open("img/plane.png")
local ImgPageUp = bitmap.open("img/pageup.png")
local ImgPageDn = bitmap.open("img/pagedn.png")


-- Change display attribute to current field
Expand Down Expand Up @@ -144,7 +144,7 @@ local ImgEngine
local function runMotorConfig(event)
lcd.clear()
if ImgEngine == nil then
ImgEngine = Bitmap.open("img/prop.png")
ImgEngine = bitmap.open("img/prop.png")
end
lcd.drawBitmap(BackgroundImg, 0, 0)
lcd.drawBitmap(ImgPageDn, 455, 95)
Expand Down Expand Up @@ -177,8 +177,8 @@ local ImgAilL
local function runAilConfig(event)
lcd.clear()
if ImgAilR == nil then
ImgAilR = Bitmap.open("img/rail.png")
ImgAilL = Bitmap.open("img/lail.png")
ImgAilR = bitmap.open("img/rail.png")
ImgAilL = bitmap.open("img/lail.png")
end
lcd.drawBitmap(BackgroundImg, 0, 0)
lcd.drawBitmap(ImgPageUp, 0, 95)
Expand Down Expand Up @@ -223,7 +223,7 @@ local ImgFlp
local function runFlapsConfig(event)
lcd.clear()
if ImgFlp == nil then
ImgFlp = Bitmap.open("img/flap.png")
ImgFlp = bitmap.open("img/flap.png")
end
lcd.drawBitmap(BackgroundImg, 0, 0)
lcd.drawBitmap(ImgPageUp, 0, 95)
Expand Down Expand Up @@ -271,9 +271,9 @@ local ImgTailRud
local function runTailConfig(event)
lcd.clear()
if ImgTail == nil then
ImgTail = Bitmap.open("img/tail.png")
ImgVTail = Bitmap.open("img/vtail.png")
ImgTailRud = Bitmap.open("img/tailrud.png")
ImgTail = bitmap.open("img/tail.png")
ImgVTail = bitmap.open("img/vtail.png")
ImgTailRud = bitmap.open("img/tailrud.png")
end
lcd.drawBitmap(BackgroundImg, 0, 0)
lcd.drawBitmap(ImgPageUp, 0, 95)
Expand Down Expand Up @@ -345,7 +345,7 @@ local ImgSummary
local function runConfigSummary(event)
lcd.clear()
if ImgSummary == nil then
ImgSummary = Bitmap.open("img/summary.png")
ImgSummary = bitmap.open("img/summary.png")
end
fields = ConfigSummaryFields
lcd.drawBitmap(BackgroundImg, 0, 0)
Expand Down
2 changes: 1 addition & 1 deletion sdcard/c320x480/WIDGETS/Flights/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
local app_name = "Flights"

-- imports
local img = Bitmap.open("/WIDGETS/" .. app_name .. "/logo.png")
local img = bitmap.open("/WIDGETS/" .. app_name .. "/logo.png")

-- const
local default_flight_starting_duration = 30 -- 20 sec to detect fight success
Expand Down
6 changes: 3 additions & 3 deletions sdcard/c480x272/SCRIPTS/PRESETS/engine/lib_utils.lua
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ M.defaultChannel_0_THR = defaultChannel(M.STICK_NUMBER_THR)
M.defaultChannel_0_RUD = defaultChannel(M.STICK_NUMBER_RUD)

local script_folder = m_script_folder
local ImgBackground = Bitmap.open(script_folder .. "img/background.png")
local ImgPageUp = Bitmap.open(script_folder .. "img/pageup.png")
local ImgPageDn = Bitmap.open(script_folder .. "img/pagedn.png")
local ImgBackground = bitmap.open(script_folder .. "img/background.png")
local ImgPageUp = bitmap.open(script_folder .. "img/pageup.png")
local ImgPageDn = bitmap.open(script_folder .. "img/pagedn.png")

-----------------------------------------------------------------

Expand Down
10 changes: 5 additions & 5 deletions sdcard/c480x272/SCRIPTS/PRESETS/engine/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,10 @@ local STATE = {
}
local state = STATE.SPLASH

local ImgSplash = Bitmap.open(script_folder .. "img/splash.png")
local ImgSummary = Bitmap.open(script_folder .. "img/summary.png")
local ImgBackground = Bitmap.open(script_folder .. "img/background.png")
local ImgBackground2 = Bitmap.open(script_folder .. "img/background2.png")
local ImgSplash = bitmap.open(script_folder .. "img/splash.png")
local ImgSummary = bitmap.open(script_folder .. "img/summary.png")
local ImgBackground = bitmap.open(script_folder .. "img/background.png")
local ImgBackground2 = bitmap.open(script_folder .. "img/background2.png")

---------------------------------------------------------------------------------------------------
local function getVer()
Expand Down Expand Up @@ -131,7 +131,7 @@ local function on_change_preset_selection(i)
log("Selected model-name: " .. dd_preset_folder_name)

preset_info = m_utils.readMeta("/SCRIPTS/PRESETS/scripts/" .. dd_preset_folder_name .. "/meta.ini")
preset_info.icon = Bitmap.open("/SCRIPTS/PRESETS/scripts/" .. dd_preset_folder_name .. "/icon.png")
preset_info.icon = bitmap.open("/SCRIPTS/PRESETS/scripts/" .. dd_preset_folder_name .. "/icon.png")

log("Category: %s", preset_info["category"])
log("preset_selection: %s", preset_info["name"])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@ local STATE = {
}
local state = STATE.SPLASH

local img_bg1 = Bitmap.open("/SCRIPTS/TOOLS/FlightsHistory/bg1.png")
local img_bg2 = Bitmap.open("/SCRIPTS/TOOLS/FlightsHistory/bg2.png")
local img_bg1 = bitmap.open("/SCRIPTS/TOOLS/FlightsHistory/bg1.png")
local img_bg2 = bitmap.open("/SCRIPTS/TOOLS/FlightsHistory/bg2.png")

-- Instantiate a new GUI object
local ctx1 = m_libgui.newGUI()
Expand Down
4 changes: 2 additions & 2 deletions sdcard/c480x272/SCRIPTS/TOOLS/FlightsHistory/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ local error_desc = nil
local script_folder = "/SCRIPTS/TOOLS/FlightsHistory/"

local function validate_image(file_name)
local img1 = Bitmap.open(script_folder .. file_name)
local w, h = Bitmap.getSize(img1)
local img1 = bitmap.open(script_folder .. file_name)
local w, h = bitmap.getSize(img1)
if w == 0 and h == 0 then
error_desc = "File not found: " .. script_folder .. file_name
end
Expand Down
6 changes: 3 additions & 3 deletions sdcard/c480x272/SCRIPTS/TOOLS/FrSky_S8R_S6R/S8R_calibrate.lua
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ local function refreshPage(event)
local position = calibrationPositions[1 + calibrationStep]
lcd.drawText(50, 50, "Place the receiver in the following position", TEXT_COLOR)
if calibBitmaps[calibrationStep + 1] == nil then
calibBitmaps[calibrationStep + 1] = Bitmap.open(calibBitmapsFile[calibrationStep + 1])
calibBitmaps[calibrationStep + 1] = bitmap.open(calibBitmapsFile[calibrationStep + 1])
end

lcd.drawBitmap(calibBitmaps[calibrationStep + 1], 40, 70, 150)
Expand Down Expand Up @@ -194,8 +194,8 @@ local function refreshPage(event)
end
else
lcd.drawText(160, 50, "Calibration completed", 0)
lcd.drawBitmap(Bitmap.open("img/done.bmp"), 200, 100)
lcd.drawBitmap(Bitmap.open("img/done.png"), 310, 60)
lcd.drawBitmap(bitmap.open("img/done.bmp"), 200, 100)
lcd.drawBitmap(bitmap.open("img/done.png"), 310, 60)
lcd.drawText(160, 220, "Hold [RTN] to exit", attr)
end
if calibrationStep > 6 and (event == EVT_VIRTUAL_ENTER or event == EVT_VIRTUAL_EXIT) then
Expand Down
4 changes: 2 additions & 2 deletions sdcard/c480x272/SCRIPTS/TOOLS/FrSky_S8R_S6R/S8R_setup.lua
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,7 @@ local function runConfigPage(event, touchState)
if fields[1][4] ~= nil then
if LCD_W == 480 then
if wingBitmaps[1 + fields[1][4]] == nil then
wingBitmaps[1 + fields[1][4]] = Bitmap.open(wingBitmapsFile[1 + fields[1][4]])
wingBitmaps[1 + fields[1][4]] = bitmap.open(wingBitmapsFile[1 + fields[1][4]])
end
lcd.drawBitmap(wingBitmaps[1 + fields[1][4]], 10, 90)
else
Expand All @@ -391,7 +391,7 @@ local function runConfigPage(event, touchState)
if fields[2][4] ~= nil then
if LCD_W == 480 then
if mountBitmaps[1 + fields[2][4]] == nil then
mountBitmaps[1 + fields[2][4]] = Bitmap.open(mountBitmapsFile[1 + fields[2][4]])
mountBitmaps[1 + fields[2][4]] = bitmap.open(mountBitmapsFile[1 + fields[2][4]])
end
lcd.drawBitmap(mountBitmaps[1 + fields[2][4]], 190, 110)
else
Expand Down
2 changes: 1 addition & 1 deletion sdcard/c480x272/SCRIPTS/TOOLS/Model Locator (by RSSI).lua
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@

local delayMillis = 100
local nextPlayTime = getTime()
local img = Bitmap.open("/SCRIPTS/TOOLS/Model Locator (by RSSI).png")
local img = bitmap.open("/SCRIPTS/TOOLS/Model Locator (by RSSI).png")

--------------------------------------------------------------
local function log(s)
Expand Down
28 changes: 14 additions & 14 deletions sdcard/c480x272/TEMPLATES/1.Wizard/1.Plane.lua
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,11 @@ local pages = {}
chdir("/TEMPLATES/1.Wizard")

-- load common Bitmaps
local ImgMarkBg = Bitmap.open("img/mark_bg.png")
local BackgroundImg = Bitmap.open("img/background.png")
local ImgPlane = Bitmap.open("img/plane/plane.png")
local ImgPageUp = Bitmap.open("img/pageup.png")
local ImgPageDn = Bitmap.open("img/pagedn.png")
local ImgMarkBg = bitmap.open("img/mark_bg.png")
local BackgroundImg = bitmap.open("img/background.png")
local ImgPlane = bitmap.open("img/plane/plane.png")
local ImgPageUp = bitmap.open("img/pageup.png")
local ImgPageDn = bitmap.open("img/pagedn.png")

local STICK_NUMBER_AIL = 3
local STICK_NUMBER_ELE = 1
Expand Down Expand Up @@ -256,7 +256,7 @@ local ImgEngine
local function runMotorConfig(event)
lcd.clear()
if ImgEngine == nil then
ImgEngine = Bitmap.open("img/plane/prop.png")
ImgEngine = bitmap.open("img/plane/prop.png")
end
lcd.drawBitmap(BackgroundImg, 0, 0)
lcd.drawBitmap(ImgPageDn, 455, 95)
Expand Down Expand Up @@ -306,8 +306,8 @@ local ImgAilL
local function runAilConfig(event)
lcd.clear()
if ImgAilR == nil then
ImgAilR = Bitmap.open("img/plane/rail.png")
ImgAilL = Bitmap.open("img/plane/lail.png")
ImgAilR = bitmap.open("img/plane/rail.png")
ImgAilL = bitmap.open("img/plane/lail.png")
end
lcd.drawBitmap(BackgroundImg, 0, 0)
lcd.drawBitmap(ImgPageUp, 0, 95)
Expand Down Expand Up @@ -355,7 +355,7 @@ local ImgFlp
local function runFlapsConfig(event)
lcd.clear()
if ImgFlp == nil then
ImgFlp = Bitmap.open("img/plane/flap.png")
ImgFlp = bitmap.open("img/plane/flap.png")
end
lcd.drawBitmap(BackgroundImg, 0, 0)
lcd.drawBitmap(ImgPageUp, 0, 95)
Expand Down Expand Up @@ -407,9 +407,9 @@ local ImgTailRud
local function runTailConfig(event)
lcd.clear()
if ImgTail == nil then
ImgTail = Bitmap.open("img/plane/tail.png")
ImgVTail = Bitmap.open("img/plane/vtail.png")
ImgTailRud = Bitmap.open("img/plane/tail_rud.png")
ImgTail = bitmap.open("img/plane/tail.png")
ImgVTail = bitmap.open("img/plane/vtail.png")
ImgTailRud = bitmap.open("img/plane/tail_rud.png")
end
lcd.drawBitmap(BackgroundImg, 0, 0)
lcd.drawBitmap(ImgPageUp, 0, 95)
Expand Down Expand Up @@ -476,7 +476,7 @@ local ImgFlp
local function runGearConfig(event)
lcd.clear()
if ImgFlp == nil then
ImgFlp = Bitmap.open("img/plane/flap.png")
ImgFlp = bitmap.open("img/plane/flap.png")
end
lcd.drawBitmap(BackgroundImg, 0, 0)
lcd.drawBitmap(ImgPageUp, 0, 95)
Expand Down Expand Up @@ -551,7 +551,7 @@ local ImgSummary
local function runConfigSummary(event)
lcd.clear()
if ImgSummary == nil then
ImgSummary = Bitmap.open("img/summary.png")
ImgSummary = bitmap.open("img/summary.png")
end

lcd.drawBitmap(BackgroundImg, 0, 0)
Expand Down
Loading

0 comments on commit eb5496a

Please sign in to comment.