Respond to sd card mounts and unmounts within lua

Includes no longer blocking the main menu on an sd card being inserted!!
This commit is contained in:
jacqueline
2024-05-03 16:40:39 +10:00
parent 3ceb8025ee
commit 344a46d066
8 changed files with 153 additions and 85 deletions
+9 -7
View File
@@ -3,12 +3,15 @@ local vol = require("volume")
local theme = require("theme")
local controls = require("controls")
local time = require("time")
local lock_time = time.ticks()
local sd_card = require("sd_card")
local backstack = require("backstack")
local main_menu = require("main_menu")
local theme_dark = require("theme_dark")
theme.set(theme_dark)
local lock_time = time.ticks()
-- Set up property bindings that are used across every screen.
GLOBAL_BINDINGS = {
-- Show an alert with the current volume whenever the volume changes
@@ -52,9 +55,8 @@ GLOBAL_BINDINGS = {
end
end
end),
sd_card.mounted:bind(function(mounted)
print("reset ui stack")
backstack.reset(main_menu:new())
end),
}
local backstack = require("backstack")
local main_menu = require("main_menu")
backstack.push(main_menu)