API System Configuration
picocalc.sysconfigexists only for apps whoseapp.jsondeclares the"sysconfig"requirement (otherwise it is nil).get("wifi_pass")always returns nil — the WiFi password is write-only through this API (setworks). Note that/system/config.jsonitself is readable by aroot-filesystemapp throughpicocalc.fs.
System-wide configuration stored at /system/config.json on the SD card. This is distinct from per-app configuration (picocalc.config). System configuration persists across all apps and reboots.
picocalc.sysconfig
Section titled “picocalc.sysconfig”Functions
Section titled “Functions”picocalc.sysconfig.get(key)
Section titled “picocalc.sysconfig.get(key)”Get a system configuration value by key.
- Parameters:
key(string): Configuration key name
- Returns: (string or nil) The value associated with the key, or
nilif the key does not exist
local ssid = picocalc.sysconfig.get("wifi_ssid")if ssid then picocalc.repl.print("WiFi SSID: " .. ssid)endpicocalc.sysconfig.set(key [, value])
Section titled “picocalc.sysconfig.set(key [, value])”Set a system configuration value. Pass nil as the value (or omit it) to delete the key.
Keys are cut to 31 characters and values to 127. All keys and values share one 1 KB store (each costs its length plus 2 bytes); a new key, or a longer value, that does not fit is ignored and the old value kept.
- Parameters:
key(string): Configuration key namevalue(string or nil, optional): Value to set, ornilto delete the key
- Returns: None
picocalc.sysconfig.set("brightness", "80")picocalc.sysconfig.set("old_key") -- deletes "old_key"picocalc.sysconfig.load()
Section titled “picocalc.sysconfig.load()”Reload the configuration from /system/config.json on the SD card, discarding any unsaved in-memory changes.
- Parameters: None
- Returns: (boolean)
trueif the file was loaded successfully
if picocalc.sysconfig.load() then picocalc.repl.print("Config reloaded")endpicocalc.sysconfig.save()
Section titled “picocalc.sysconfig.save()”Write the current in-memory configuration to /system/config.json on the SD card.
- Parameters: None
- Returns: (boolean)
trueif the file was written successfully
picocalc.sysconfig.set("timezone", "America/New_York")picocalc.sysconfig.save()Well-Known Keys
Section titled “Well-Known Keys”| Key | Description |
|---|---|
"wifi_ssid" | WiFi network name for auto-connect on boot |
"wifi_pass" | WiFi password |
"brightness" | Display brightness level |
"tz_offset" | Clock offset from UTC in minutes (may be negative) |
"dim_timeout_s" | Idle screen-dim timeout in seconds; "0" disables dimming (default 60) |
"battery_pct" | "1" shows the battery percentage inside the header’s battery icon instead of a fill bar (system menu → Settings → Battery %) |
"bt_enabled" | "1": Bluetooth controllers on (system menu → Settings → Bluetooth; see API Gamepad). No key is off, and the menu removes the key for Off. Read at boot |
"show_fps" | Corner of the OS FPS counter: "tr", "tl", "br" or "bl"; no key (or "0") is off, and the menu removes the key for Off. Read when an app starts and when the system menu closes (Settings → Show FPS; see API Performance) |