|
|
@ -282,10 +282,10 @@ local MassStorageSettings = screen:new { |
|
|
|
createUi = function(self) |
|
|
|
createUi = function(self) |
|
|
|
self.menu = SettingsScreen("USB Storage") |
|
|
|
self.menu = SettingsScreen("USB Storage") |
|
|
|
local version = require("version").samd() |
|
|
|
local version = require("version").samd() |
|
|
|
if tonumber(version) < 2 then |
|
|
|
if tonumber(version) < 3 then |
|
|
|
self.menu.content:Label { |
|
|
|
self.menu.content:Label { |
|
|
|
w = lvgl.PCT(100), |
|
|
|
w = lvgl.PCT(100), |
|
|
|
text = "Usb Mass Storage requires a SAMD21 firmware version >=2." |
|
|
|
text = "Usb Mass Storage requires a SAMD21 firmware version >=3." |
|
|
|
} |
|
|
|
} |
|
|
|
return |
|
|
|
return |
|
|
|
end |
|
|
|
end |
|
|
@ -304,6 +304,12 @@ local MassStorageSettings = screen:new { |
|
|
|
enable_container:Label { text = "Enable", flex_grow = 1 } |
|
|
|
enable_container:Label { text = "Enable", flex_grow = 1 } |
|
|
|
local enable_sw = enable_container:Switch {} |
|
|
|
local enable_sw = enable_container:Switch {} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
local busy_text = self.menu.content:Label { |
|
|
|
|
|
|
|
w = lvgl.PCT(100), |
|
|
|
|
|
|
|
text = "USB is currently busy. Do not unplug or remove the SD card.", |
|
|
|
|
|
|
|
long_mode = lvgl.LABEL.LONG_WRAP, |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
local bind_switch = function() |
|
|
|
local bind_switch = function() |
|
|
|
if usb.msc_enabled:get() then |
|
|
|
if usb.msc_enabled:get() then |
|
|
|
enable_sw:add_state(lvgl.STATE.CHECKED) |
|
|
|
enable_sw:add_state(lvgl.STATE.CHECKED) |
|
|
@ -313,12 +319,21 @@ local MassStorageSettings = screen:new { |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
enable_sw:onevent(lvgl.EVENT.VALUE_CHANGED, function() |
|
|
|
enable_sw:onevent(lvgl.EVENT.VALUE_CHANGED, function() |
|
|
|
usb.msc_enabled:set(enable_sw:enabled()) |
|
|
|
if not usb.msc_busy:get() then |
|
|
|
|
|
|
|
usb.msc_enabled:set(enable_sw:enabled()) |
|
|
|
|
|
|
|
end |
|
|
|
bind_switch() |
|
|
|
bind_switch() |
|
|
|
end) |
|
|
|
end) |
|
|
|
|
|
|
|
|
|
|
|
self.bindings = { |
|
|
|
self.bindings = { |
|
|
|
usb.msc_enabled:bind(bind_switch), |
|
|
|
usb.msc_enabled:bind(bind_switch), |
|
|
|
|
|
|
|
usb.msc_busy:bind(function(busy) |
|
|
|
|
|
|
|
if busy then |
|
|
|
|
|
|
|
busy_text:clear_flag(lvgl.FLAG.HIDDEN) |
|
|
|
|
|
|
|
else |
|
|
|
|
|
|
|
busy_text:add_flag(lvgl.FLAG.HIDDEN) |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
end) |
|
|
|
} |
|
|
|
} |
|
|
|
end, |
|
|
|
end, |
|
|
|
canPop = function() |
|
|
|
canPop = function() |
|
|
|