mirror of
https://github.com/MarekZegare4/MeshCore-Solo.git
synced 2026-11-02 10:51:57 +00:00
feat(route): path editor with out-and-back trace and a kept route; map markers as one drawn layer
Core: PathEditor (UiCore::route) loads, edits, traces and saves the route to a contact; MyMesh::sendTrace over an explicit route with per-hop SNRs, setContactPath / setContactPinned. A route can be kept (CONTACT_FLAG_ROUTE_PINNED, ContactInfo::flags bit 4): a path heard from the node doesn't replace it and the last DM resend doesn't drop it. ui-lvgl: Route screen (node detail), repeater picker by distance, picking hops by tapping the nodes map (numbered badges, line, Undo / Done). The map's markers are one drawn layer with hit-testing and name decluttering instead of three objects per node. ui-new: Path / trace view in the Nodes action menu; Add reuses the list filtered to repeaters. First cut: built for L2 LVGL, L1 OLED and L1 e-ink, tried on L2 only. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 5.5
parent
c180814960
commit
140ea7c008
@@ -70,6 +70,32 @@ bool MyMesh::resetContactPath(const uint8_t* pub_key) {
|
||||
ContactInfo* c = lookupContactByPubKey(pub_key, PUB_KEY_SIZE);
|
||||
if (!c) return false;
|
||||
c->out_path_len = OUT_PATH_UNKNOWN;
|
||||
c->flags &= ~CONTACT_FLAG_ROUTE_PINNED; // a deliberate reset ends a kept route
|
||||
c->lastmod = getRTCClock()->getCurrentTime();
|
||||
dirty_contacts_expiry = futureMillis(LAZY_CONTACTS_WRITE_DELAY);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool MyMesh::setContactPinned(const uint8_t* pub_key, bool pin) {
|
||||
ContactInfo* c = lookupContactByPubKey(pub_key, PUB_KEY_SIZE);
|
||||
if (!c) return false;
|
||||
if (pin) c->flags |= CONTACT_FLAG_ROUTE_PINNED; else c->flags &= ~CONTACT_FLAG_ROUTE_PINNED;
|
||||
c->lastmod = getRTCClock()->getCurrentTime();
|
||||
dirty_contacts_expiry = futureMillis(LAZY_CONTACTS_WRITE_DELAY);
|
||||
return true;
|
||||
}
|
||||
|
||||
// A route typed on the device (ui-core/PathEditor.h): `hops` hashes of
|
||||
// `hash_size` bytes into the contact's out_path, the packed length byte as
|
||||
// the mesh stores a learned path (top 2 bits: size - 1). lastmod bumped, as
|
||||
// for resetContactPath(), so the app's copy follows.
|
||||
bool MyMesh::setContactPath(const uint8_t* pub_key, const uint8_t* path, uint8_t hash_size, uint8_t hops, bool pin) {
|
||||
if (hash_size < 1 || hash_size > 3 || hops == 0 || hops * hash_size > MAX_PATH_SIZE) return false;
|
||||
ContactInfo* c = lookupContactByPubKey(pub_key, PUB_KEY_SIZE);
|
||||
if (!c) return false;
|
||||
memcpy(c->out_path, path, hops * hash_size);
|
||||
c->out_path_len = (uint8_t)(((hash_size - 1) << 6) | hops);
|
||||
if (pin) c->flags |= CONTACT_FLAG_ROUTE_PINNED; else c->flags &= ~CONTACT_FLAG_ROUTE_PINNED;
|
||||
c->lastmod = getRTCClock()->getCurrentTime();
|
||||
dirty_contacts_expiry = futureMillis(LAZY_CONTACTS_WRITE_DELAY);
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user