summaryrefslogtreecommitdiff
path: root/lua
diff options
context:
space:
mode:
authorjacqueline <me@jacqueline.id.au>2024-10-01 15:46:00 +1000
committerjacqueline <me@jacqueline.id.au>2024-10-01 15:46:00 +1000
commit6d6f59cb94577fb7537b6985c066a38a728fef3b (patch)
treeb17da8a73331e8f0a4b2f09706a1f3f647adcab6 /lua
parent6987f7befc60f686ef80f790794ace8ece412394 (diff)
downloadtangara-fw-6d6f59cb94577fb7537b6985c066a38a728fef3b.tar.gz
Don't enable usb msc when the database is updating
Diffstat (limited to 'lua')
-rw-r--r--lua/settings.lua21
1 files changed, 17 insertions, 4 deletions
diff --git a/lua/settings.lua b/lua/settings.lua
index 8e08fd8e..f2a1ec7e 100644
--- a/lua/settings.lua
+++ b/lua/settings.lua
@@ -336,7 +336,7 @@ settings.ThemeSettings = SettingsScreen:new {
local selected_idx = -1
for i, v in pairs(themeOptions) do
if (saved_theme == v) then
- selected_idx = idx
+ selected_idx = idx
end
if idx > 0 then
options = options .. "\n"
@@ -354,7 +354,7 @@ settings.ThemeSettings = SettingsScreen:new {
options = options,
symbol = img.chevron,
}
- theme_chooser:set({selected = selected_idx})
+ theme_chooser:set({ selected = selected_idx })
theme_chooser:onevent(lvgl.EVENT.VALUE_CHANGED, function()
local option = theme_chooser:get('selected_str')
@@ -457,7 +457,7 @@ settings.MassStorageSettings = SettingsScreen:new {
local busy_text = self.content:Label {
w = lvgl.PCT(100),
- text = "USB is currently busy. Do not unplug or remove the SD card.",
+ text = "",
long_mode = lvgl.LABEL.LONG_WRAP,
}
@@ -470,7 +470,7 @@ settings.MassStorageSettings = SettingsScreen:new {
end
enable_sw:onevent(lvgl.EVENT.VALUE_CHANGED, function()
- if not usb.msc_busy:get() then
+ if not usb.msc_busy:get() and not database.updating:get() then
usb.msc_enabled:set(enable_sw:enabled())
end
bind_switch()
@@ -484,6 +484,19 @@ settings.MassStorageSettings = SettingsScreen:new {
else
busy_text:add_flag(lvgl.FLAG.HIDDEN)
end
+ end),
+ database.updating:bind(function(updating)
+ if updating then
+ busy_text:clear_flag(lvgl.FLAG.HIDDEN)
+ busy_text:set {
+ text = "Your database is currently updating. Please wait."
+ }
+ else
+ busy_text:add_flag(lvgl.FLAG.HIDDEN)
+ busy_text:set {
+ text = "USB is currently busy. Do not unplug or remove the SD card."
+ }
+ end
end)
}
end,