mirror of
https://github.com/ALLFATHER-BV/wadamesh.git
synced 2026-10-15 17:00:26 +00:00
Merge upstream beta_68 into the M9 compass / GPS work
beta_68 expanded the Lua SDK (map, lists, packet delivery, discovery, private messages/rooms, native crypto) across the same files as this branch, so four files conflicted. Nothing was dropped from either side: - wada.sys.gps(): both widenings merged into one binding. Upstream's fix_time / lat_e6 / lon_e6 and our speed_kmh / course now share a signature, and our stricter gate wins -- the call returns nil when the user has GPS switched off, not just when there is no fix. - Altitude is upstream's `alt_m` alone. The resolution first carried `alt` beside it to protect a shipped app, but gpscompass has never been published to the store (it exists only in this branch and on a bench device), so carrying a duplicate key into the API forever was the wrong trade: the app reads alt_m instead. - sysCaps() carries all twelve feature flags (upstream's seven, our compass, the four originals) with a matching table hint. - wada.geo (upstream) and wada.sys.compass (ours) both survive; upstream's "no board has a magnetometer" note is corrected in the code and on the SDK page, since the M9 now does. - hostTeardown frees upstream's new POST payload buffer as well as the fetch buffer, under the same in-flight guard. - The catalog keeps all three new apps: upstream's wardrive and nearby, ours gpscompass (8 total, every referenced file present). M9, V4, V4-R8, T-Deck and Pager all compile; the Lua host harness passes. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
+27
-2
@@ -2186,11 +2186,36 @@ void MyMesh::logRxRaw(float snr, float rssi, const uint8_t raw[], int len) {
|
||||
// with 4 transport-code bytes following iff route is a TRANSPORT_* one; the
|
||||
// next byte's low 6 bits are the path length. hops == 0 = heard DIRECTLY.
|
||||
uint8_t rt = 0, hops = 0;
|
||||
// What the frame says about WHO sent it. Only an advert carries a real
|
||||
// identity (its payload opens with the sender's 32-byte public key); the
|
||||
// addressed types open with a one-byte destination hash then a one-byte
|
||||
// source hash. Anything else is anonymous on the wire and stays that way
|
||||
// here -- see UiRxRec::org_kind.
|
||||
uint8_t org_kind = 0, org[4] = {0, 0, 0, 0};
|
||||
if (len > 0) {
|
||||
rt = raw[0] & 0x03;
|
||||
const bool xp = (rt == ROUTE_TYPE_TRANSPORT_FLOOD || rt == ROUTE_TYPE_TRANSPORT_DIRECT);
|
||||
const int ps = 1 + (xp ? 4 : 0);
|
||||
hops = (ps < len) ? (uint8_t)(raw[ps] & 0x3F) : 0;
|
||||
// The path-length byte packs BOTH counts: low 6 bits = number of hops, top
|
||||
// 2 bits = bytes per hop hash minus one (Packet::getPathHashSize). So the
|
||||
// path occupies count * size bytes on the wire, not count -- assuming one
|
||||
// byte each reads the payload at the wrong offset the moment a mesh uses
|
||||
// wider hashes, and a mis-offset "public key" is worse than none.
|
||||
const uint8_t plb = (ps < len) ? raw[ps] : 0;
|
||||
hops = (uint8_t)(plb & 0x3F);
|
||||
const int payload = ps + 1 + (int)hops * (int)(((plb >> 6) & 0x03) + 1);
|
||||
switch ((raw[0] >> 2) & 0x0F) {
|
||||
case PAYLOAD_TYPE_ADVERT:
|
||||
if (payload + 32 <= len) { org_kind = 1; memcpy(org, &raw[payload], 4); }
|
||||
break;
|
||||
case PAYLOAD_TYPE_REQ:
|
||||
case PAYLOAD_TYPE_RESPONSE:
|
||||
case PAYLOAD_TYPE_TXT_MSG:
|
||||
case PAYLOAD_TYPE_PATH:
|
||||
if (payload + 2 <= len) { org_kind = 2; org[0] = raw[payload]; org[1] = raw[payload + 1]; }
|
||||
break;
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
// Live signal for the top-bar icon: ONLY from packets heard DIRECTLY (0-hop), so
|
||||
// the reading reflects a real direct-neighbour RF link, not the SNR of a repeater
|
||||
@@ -2206,7 +2231,7 @@ void MyMesh::logRxRaw(float snr, float rssi, const uint8_t raw[], int len) {
|
||||
if (len > 0) {
|
||||
uiRxLogPush(now_ms, (int8_t)rssi, snr_q4,
|
||||
(uint8_t)((raw[0] >> 2) & 0x0F), rt, hops,
|
||||
(uint8_t)(len > 255 ? 255 : len));
|
||||
(uint8_t)(len > 255 ? 255 : len), org_kind, org);
|
||||
}
|
||||
#if defined(DISPLAY_CLASS)
|
||||
// Diagnostic: log EVERY received frame so we can prove what reaches the
|
||||
|
||||
Reference in New Issue
Block a user