Public Access
- lib/apps_model (host-tested): SettingsMenu (rows, readable values, choices, validation messages) and SetupWizard (names, Region confirmation, timezone; saves only when finished) - AppManager: modal Apps that Home/Back can't leave (setup wizard) - SettingsApp: all settings plus Storage (usage, erase SD behind a dialog) and About (version, node id, battery, memory, uptime) pages, replacing the temporary Diagnostics App - SetupApp: first-boot wizard, opened modally until SetupDone - Node id and default names derived from the MAC like Meshtastic - Widget demo is now hidden (About, then w) - lib_ldf_mode = deep+ so libraries see each other's headers Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EhqxQ49eCju4CzKYNjZzwT
33 lines
985 B
C++
33 lines
985 B
C++
#pragma once
|
|
|
|
#include <Arduino.h>
|
|
|
|
#include <cstdio>
|
|
#include <string>
|
|
|
|
namespace roro::identity {
|
|
|
|
// Node number as Meshtastic derives it: the last four bytes of the chip's MAC address.
|
|
inline uint32_t nodeNum() {
|
|
uint64_t mac = ESP.getEfuseMac(); // byte 0 of the MAC is the lowest byte
|
|
auto byte = [mac](int i) { return static_cast<uint32_t>((mac >> (8 * i)) & 0xFF); };
|
|
return (byte(2) << 24) | (byte(3) << 16) | (byte(4) << 8) | byte(5);
|
|
}
|
|
|
|
// "!2f762fa4"
|
|
inline std::string nodeId() {
|
|
char buf[12];
|
|
std::snprintf(buf, sizeof(buf), "!%08lx", static_cast<unsigned long>(nodeNum()));
|
|
return buf;
|
|
}
|
|
|
|
// Suggested names for the setup wizard: "roro9stack 2fa4" and "2fa4".
|
|
inline std::string defaultShortName() {
|
|
char buf[8];
|
|
std::snprintf(buf, sizeof(buf), "%04lx", static_cast<unsigned long>(nodeNum() & 0xFFFF));
|
|
return buf;
|
|
}
|
|
inline std::string defaultLongName() { return "roro9stack " + defaultShortName(); }
|
|
|
|
} // namespace roro::identity
|