feat(ui-core,ui-lvgl): favourites pinning in the Core, L2 node name, reboot, lock screen, favourites dial, 12-hour clock

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Jakub
2026-09-25 20:51:00 +02:00
co-authored by Claude Opus 5.5
parent 6d82da877e
commit 8663d50412
12 changed files with 528 additions and 30 deletions
@@ -84,4 +84,23 @@ inline void hopName(uint8_t path_len_packed, const uint8_t* path, int i, char* o
snprintf(out, n, "?%s", hex);
}
// A favourites dial slot's name (ui-core/Favourites.h): contact / room or
// channel name; false when empty or the contact / channel is gone.
// contact_out (optional) gets the contact.
inline bool favName(const NodePrefs* p, int slot, char* out, size_t n, ContactInfo* contact_out = nullptr) {
if (favslots::isEmpty(p, slot)) return false;
const uint8_t* pfx = p->favourite_contacts[slot];
if (favslots::kind(p, slot) == NodePrefs::FAV_KIND_CHANNEL) {
ChannelDetails ch;
if (!the_mesh.getChannel(pfx[0], ch) || !ch.name[0]) return false;
snprintf(out, n, "%s", ch.name);
return true;
}
ContactInfo* c = the_mesh.lookupContactByPubKey(pfx, NodePrefs::FAVOURITE_PREFIX_LEN);
if (!c) return false;
snprintf(out, n, "%s", c->name);
if (contact_out) *contact_out = *c;
return true;
}
} // namespace contactctl
@@ -58,4 +58,16 @@ inline void clear(NodePrefs* p, int slot) {
p->favourite_kinds[slot] = NodePrefs::FAV_KIND_CONTACT;
}
// Pin into `slot`, moving it there if it already sits in another one.
inline void pinContact(NodePrefs* p, int slot, const uint8_t* pub_key) {
int existing = findContact(p, pub_key);
if (existing >= 0 && existing != slot) clear(p, existing);
setContact(p, slot, pub_key);
}
inline void pinChannel(NodePrefs* p, int slot, uint8_t ch_idx) {
int existing = findChannel(p, ch_idx);
if (existing >= 0 && existing != slot) clear(p, existing);
setChannel(p, slot, ch_idx);
}
} // namespace favslots
@@ -165,11 +165,13 @@ static const Setting ALL[] = {
MAP("Screen off after", "Without a touch", SEC_DISPLAY, auto_off_secs, AUTO_OFF, optAutoOff, nullptr),
MAP("Wake on message", "Turn the screen on for new messages", SEC_DISPLAY, msg_wake_screen_off, INVERTED,
nullptr, nullptr),
SW("Lock screen", "Slide to unlock after the screen turns off", SEC_DISPLAY, auto_lock, nullptr),
MAP("Battery shutdown", "Power off below this voltage", SEC_POWER, low_batt_mv, LOW_BATT, optLowBatt, nullptr),
MAP("GPS power saving", "Sleep between fixes", SEC_POWER, gps_interval, GPS_DUTY, optGpsDuty, applyGpsDuty),
MAP("Time zone", "For the clock and the alarm", SEC_TIME, tz_offset_hours, TZ, optTz, nullptr),
SW("12-hour clock", "AM / PM instead of 24 h", SEC_TIME, clock_12h, nullptr),
IDX("Resend direct messages", "Extra tries without a delivery tick", SEC_MESSAGES, dm_resend_count, 6,
optResend, nullptr),