Don't enable usb msc when the database is updating

custom
jacqueline 7 months ago
parent 6987f7befc
commit 6d6f59cb94
  1. 19
      lua/settings.lua

@ -354,7 +354,7 @@ settings.ThemeSettings = SettingsScreen:new {
options = options, options = options,
symbol = img.chevron, symbol = img.chevron,
} }
theme_chooser:set({selected = selected_idx}) theme_chooser:set({ selected = selected_idx })
theme_chooser:onevent(lvgl.EVENT.VALUE_CHANGED, function() theme_chooser:onevent(lvgl.EVENT.VALUE_CHANGED, function()
local option = theme_chooser:get('selected_str') local option = theme_chooser:get('selected_str')
@ -457,7 +457,7 @@ settings.MassStorageSettings = SettingsScreen:new {
local busy_text = self.content:Label { local busy_text = self.content:Label {
w = lvgl.PCT(100), w = lvgl.PCT(100),
text = "USB is currently busy. Do not unplug or remove the SD card.", text = "",
long_mode = lvgl.LABEL.LONG_WRAP, long_mode = lvgl.LABEL.LONG_WRAP,
} }
@ -470,7 +470,7 @@ settings.MassStorageSettings = SettingsScreen:new {
end end
enable_sw:onevent(lvgl.EVENT.VALUE_CHANGED, function() 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()) usb.msc_enabled:set(enable_sw:enabled())
end end
bind_switch() bind_switch()
@ -484,6 +484,19 @@ settings.MassStorageSettings = SettingsScreen:new {
else else
busy_text:add_flag(lvgl.FLAG.HIDDEN) busy_text:add_flag(lvgl.FLAG.HIDDEN)
end 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)
} }
end, end,

Loading…
Cancel
Save