summaryrefslogtreecommitdiff
path: root/lua/settings.lua
diff options
context:
space:
mode:
authorjacqueline <me@jacqueline.id.au>2024-07-17 13:38:19 +1000
committerjacqueline <me@jacqueline.id.au>2024-07-17 13:38:19 +1000
commit374bc5e734c230a1e9220d126eb401b478dcd571 (patch)
tree6ad9bc6ea018068112ec54d149c28d737df102a0 /lua/settings.lua
parent0ca82fb1d14ea996195dc956bf40cd4ea7e35728 (diff)
downloadtangara-fw-374bc5e734c230a1e9220d126eb401b478dcd571.tar.gz
Add a screen for FCC and CE regulatory nonsense
Diffstat (limited to 'lua/settings.lua')
-rw-r--r--lua/settings.lua104
1 files changed, 103 insertions, 1 deletions
diff --git a/lua/settings.lua b/lua/settings.lua
index 3751a12a..761f6ff4 100644
--- a/lua/settings.lua
+++ b/lua/settings.lua
@@ -9,6 +9,7 @@ local bluetooth = require("bluetooth")
local theme = require("theme")
local database = require("database")
local usb = require("usb")
+local font = require("font")
local SettingsScreen = widgets.MenuScreen:new {
show_back = true,
@@ -551,7 +552,107 @@ local LicensesScreen = SettingsScreen:new {
title = "Licenses",
createUi = function(self)
SettingsScreen.createUi(self)
- self.root = require("licenses")(self)
+ require("licenses")(self)
+ end
+}
+
+local FccStatementScreen = SettingsScreen:new {
+ title = "FCC Statement",
+ createUi = function(self)
+ SettingsScreen.createUi(self)
+
+ local text_part = function(text)
+ self.content:Label {
+ w = lvgl.PCT(100),
+ h = lvgl.SIZE_CONTENT,
+ text = text,
+ text_font = font.fusion_10,
+ long_mode = lvgl.LABEL.LONG_WRAP,
+ }
+ end
+
+ text_part(
+ "This device complies with part 15 of the FCC Rules. Operation is subject to the following two conditions:")
+ text_part("(1) This device may not cause harmful interference, and")
+ text_part(
+ "(2) this device must accept any interference received, including interference that may cause undesired operation.")
+
+ local scroller = self.content:Object { w = 1, h = 1 }
+ scroller:onevent(lvgl.EVENT.FOCUSED, function()
+ scroller:scroll_to_view(1);
+ end)
+ lvgl.group.get_default():add_obj(scroller)
+ end
+}
+
+local RegulatoryScreen = SettingsScreen:new {
+ title = "Regulatory",
+ createUi = function(self)
+ SettingsScreen.createUi(self)
+ local version = require("version")
+
+ local small_row = function(left, right)
+ local container = self.content:Object {
+ flex = {
+ flex_direction = "row",
+ justify_content = "flex-start",
+ align_items = "flex-start",
+ align_content = "flex-start"
+ },
+ w = lvgl.PCT(100),
+ h = lvgl.SIZE_CONTENT
+ }
+ container:add_style(styles.list_item)
+ container:Label {
+ text = left,
+ flex_grow = 1,
+ text_font = font.fusion_10,
+ }
+ container:Label {
+ text = right,
+ text_font = font.fusion_10,
+ }
+ end
+ small_row("Manufacturer", "cool tech zone")
+ small_row("Product model", "CTZ-1")
+ small_row("FCC ID", "2BG33-CTZ1")
+
+ local button_container = self.content:Object {
+ w = lvgl.PCT(100),
+ h = lvgl.SIZE_CONTENT,
+ flex = {
+ flex_direction = "row",
+ justify_content = "center",
+ align_items = "space-evenly",
+ align_content = "center",
+ },
+ pad_top = 4,
+ pad_column = 4,
+ }
+ button_container:add_style(styles.list_item)
+
+ local button = button_container:Button {}
+ button:Label { text = "FCC Statement" }
+ button:onClicked(function()
+ backstack.push(FccStatementScreen:new())
+ end)
+
+ local logo_container = self.content:Object {
+ w = lvgl.PCT(100),
+ h = lvgl.SIZE_CONTENT,
+ flex = {
+ flex_direction = "row",
+ justify_content = "center",
+ align_items = "center",
+ align_content = "center",
+ },
+ pad_top = 4,
+ pad_column = 4,
+ }
+ button_container:add_style(styles.list_item)
+
+ logo_container:Image { src = "//lua/img/ce.png" }
+ logo_container:Image { src = "//lua/img/weee.png" }
end
}
@@ -597,5 +698,6 @@ return widgets.MenuScreen:new {
submenu("Database", DatabaseSettings)
submenu("Firmware", FirmwareSettings)
submenu("Licenses", LicensesScreen)
+ submenu("Regulatory", RegulatoryScreen)
end
}