mirror of
https://github.com/MarekZegare4/MeshCore-Solo.git
synced 2026-09-28 13:46:41 +00:00
feat(companion): on-device scope + repeater scope filtering; fix CAD, UTF-8 truncation, Public channel, Nodes list, keyboard cursor
- Settings > Radio > Scope: type a community/region name on-device (derives the shared key the same "#name" -> SHA256 way as DEFAULT_FLOOD_SCOPE_NAME), previously only settable from a connected app. - Tools > Repeater > Scope only + Extra scopes: only relay flood traffic matching the device's own scope or a comma-separated list of additional scopes, without changing what scope the device's own messages send under. No-op while unconfigured. - getCADEnabled()/getInterferenceThreshold() were hardcoded off on companion_radio; CAD now auto-enables whenever RX power-save (duty-cycle) is active, since the noise floor isn't kept fresh during duty-cycle sleep. - Message truncation to fit the send frame could split a multi-byte UTF-8 character in half; now stops at the last complete character. - The default "Public" channel was unconditionally re-added at every boot before the saved channel list was loaded, so deleting it never stuck. Only seeded now on a genuinely fresh device (no channel file yet). - Tools > Nodes read contacts from the wrong starting offset, landing on internally-reserved bookkeeping slots instead of real contacts -- showed as blank "Unknown" rows and silently dropped that many real contacts off the end of the list. - resetContacts() only cleared the first few reserved slots, not the whole contact table, contrary to its own comment; only reachable today via private-key import, fixed to match stated intent regardless. - Keyboard's multi-line text preview could render the cursor on an empty line below short typed text instead of right after it. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -173,7 +173,16 @@ class NearbyScreen : public UIScreen {
|
||||
int nc = the_mesh.getNumContacts();
|
||||
for (int i = 0; i < nc && _count < MAX_NEARBY; i++) {
|
||||
ContactInfo ci;
|
||||
if (!the_mesh.getContactByIdx(i, ci)) continue;
|
||||
// getContactByIdx() indexes the RAW contact table, whose first
|
||||
// MAX_ANON_CONTACTS slots are reserved for anon-request bookkeeping
|
||||
// (see BaseChatMesh::resetContacts()/ContactsIterator) -- getNumContacts()
|
||||
// already excludes them from the count, so real contact 0 lives at raw
|
||||
// index MAX_ANON_CONTACTS, not 0. Reading from 0 pulled those reserved
|
||||
// (blank, type=ADV_TYPE_NONE) slots into the list as bogus "Unknown"
|
||||
// rows, and silently dropped the same number of real contacts off the
|
||||
// end -- while never touching the anon slots themselves, so it always
|
||||
// reproduced the same way regardless of the auto-add overwrite setting.
|
||||
if (!the_mesh.getContactByIdx(i + MAX_ANON_CONTACTS, ci)) continue;
|
||||
if (!typeMatchesFilter(ci.type, ci.flags, true)) continue;
|
||||
|
||||
Entry& e = _entries[_count++];
|
||||
@@ -188,7 +197,7 @@ class NearbyScreen : public UIScreen {
|
||||
? geo::haversineKm(_own_lat, _own_lon, ci.gps_lat, ci.gps_lon)
|
||||
: -1.0f;
|
||||
e.type = ci.type;
|
||||
e.contact_idx = i;
|
||||
e.contact_idx = i + MAX_ANON_CONTACTS; // raw index -- other lookups re-key off this directly
|
||||
e.lastmod = ci.lastmod;
|
||||
e.is_known = true;
|
||||
e.is_live = false;
|
||||
|
||||
Reference in New Issue
Block a user