Restore Companion boot display and default WiFi to opt-in

This commit is contained in:
mikecarper committed 2026-10-01 23:19:48 -07:00
1 parent ad2f2097da
commit 0ccac4539d
11 files changed
+276 -11

No files matched your search

+12 -2
View File
@@ -25,6 +25,8 @@ struct DisplayPowerPrefs {
DisplayPowerProfile battery;
DisplayPowerProfile usb;
DisplayInboxMode inbox = DisplayInboxMode::History;
// Runtime role policy, not serialized with the user's display settings.
bool wake_on_boot = false;
};
inline DisplayPowerPrefs& displayPowerPrefs() {
@@ -70,7 +72,8 @@ public:
void update(const DisplayPowerPrefs& prefs, bool usb, bool connected,
bool pairing, uint32_t now) {
const auto& selected = usb ? prefs.usb : prefs.battery;
const bool reset = !_initialized || _usb != usb || _profile.mode != selected.mode;
const bool startup = !_initialized;
const bool reset = startup || _usb != usb || _profile.mode != selected.mode;
const bool timeout_changed = _profile.seconds != selected.seconds;
const bool just_connected = connected && !_connected;
_profile = selected;
@@ -80,7 +83,14 @@ public:
if (reset) {
_timed = false;
_initialized = true;
wake(DisplayWake::Boot, now);
// Companions show startup for the normal button timeout. Only the first
// initialization counts; changing profiles must not synthesize input.
if (startup && prefs.wake_on_boot && (_profile.mode == DisplayMode::Button
|| _profile.mode == DisplayMode::ButtonPairing)) {
wake(DisplayWake::Button, now);
} else {
wake(DisplayWake::Boot, now);
}
} else if (timeout_changed && _timed) {
_deadline = now + uint32_t(_profile.seconds) * 1000;
}
+2 -1
View File
@@ -80,10 +80,11 @@ bool savePrefs(const DisplayPowerPrefs& prefs) {
}
}
bool loadDisplayPowerSettings(FILESYSTEM* fs, bool pairing_supported) {
bool loadDisplayPowerSettings(FILESYSTEM* fs, bool pairing_supported, bool wake_on_boot) {
settings_fs = fs;
pairing_available = pairing_supported;
DisplayPowerPrefs prefs;
prefs.wake_on_boot = wake_on_boot;
if (pairing_supported) prefs.battery.mode = prefs.usb.mode = DisplayMode::ButtonPairing;
displayPowerPrefs() = prefs;
if (!fs) return false;
+3 -1
View File
@@ -7,7 +7,9 @@ namespace mesh { namespace ui {
// Separate, versioned file: existing node and MQTT preference layouts stay
// readable by older firmware. Returns true when a saved profile was loaded.
bool loadDisplayPowerSettings(FILESYSTEM* fs, bool pairing_supported);
// Companion startup enables a timed boot screen without changing saved modes.
bool loadDisplayPowerSettings(FILESYSTEM* fs, bool pairing_supported,
bool wake_on_boot = false);
bool handleDisplayPowerCommand(const char* command, char* reply, size_t reply_size,
bool inbox_supported = false);
bool displayPairingSupported();