Commit Graph
152 Commits
Author SHA1 Message Date
tthandClaude Opus 5 a043033910 Merge remote-tracking branch 'origin/dev' into main
58 commitů upstreamu nad v1.17.1. Šest konfliktů, všechny ručně:

- `src/helpers/radiolib/RadioLibWrappers.cpp` — OBOJE. Upstream `aa229245`
  přidává `idle()` před `setOutputPower()` na LR2021 (tam jsou to standby-only
  příkazy a přijímač se sám nevrátí do Rx); naše část si dál drží návratový
  status, aby „rádio to odmítlo" a „rádio to změnilo" nevypadaly z konzole
  stejně. Nezávislé věci, obě zůstávají.
- `src/helpers/CommonCLI.cpp` — VERZE UPSTREAMU. Celý blok `radio`,
  `radio.rxgain` a `radio.fem.*` byl čistě upstreamový kód (diff proti merge
  base v té oblasti je prázdný) a upstream ho přestěhoval do nového
  `CommonRadioPrefs`; FEM příkazy zrušil ve prospěch per-variant klíčů
  `fem_rxgain`/`fem_txgain`.
- `examples/simple_repeater/MyMesh.h` — NAŠE + úklid. `static_assert` na
  64bajtový wire formát `RepeaterStats` zůstává, `MAX_CLIENTS` odsud mizí:
  `1a8d860d` ho centralizoval do `helpers/ClientACL.h`, který je tu už
  includovaný.
- `examples/simple_repeater/MyMesh.cpp` — NAŠE. Konflikt byl falešný (upstream
  ten řádek nemění), jde o naše dva countery `tx_start_fail`/`tx_timeout`.
- `examples/companion_radio/ui-new/UITask.cpp` — OBOJE. Upstream přidal větve
  pro `UI_SHOW_CLOCK`, my podmínku `_task->isBluetoothEnabled()`, aby displej
  nenabízel PIN k párování, které není jak navázat.
- `platformio.ini` — OBOJE. Vedle našeho symlinku na lokální nRF52 framework
  přibyl upstreamový `toolchain-gccarmnoneeabi@^1.140201.0`.

Navíc: `[env:native_asan]` musel dostat `DynamicConfigSerializer.cpp` do
`build_src_filter`. Merge ho přidal jen do `[env:native]` a ASAN env pak padal
na undefined reference — což vypadá jako nález sanitizeru a je to jen chybějící
překladová jednotka. Ty dva envy musí zůstat v zákrytu.

Ověřeno: `pio test -e native` i `-e native_asan` 53/53, a čtyři envy, které
skutečně flashujeme, se přeloží (Xiao repeater / companion_radio_usb /
kiss_modem, t1000e_companion_radio_ble).

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-02 02:19:04 +02:00
Scott Powell 5a7bc507d1 * new DynamicConfigSerializer
* board/variant KeyValueStore now can write to 'custom' object in Json prefs
2026-08-24 17:12:56 +10:00
Scott Powell 8c73c948b4 * T096, and Station G3: refactoring the 'FEM' prefs to variant-specific code
* CommonCLI: 'FEM' commands removed
* introduced static no-op attachDynamicPrefs() for all boards
2026-08-24 01:50:22 +10:00
Scott Powell 644e68d0ff * new TXT_TYPE_CLI_COMMAND (3) 2026-08-23 22:04:05 +10:00
tthandClaude Opus 5 4caf52bb7a fix(mesh): sendZeroHop mazal šířku path hashe, uzel se hlásil jako 1bajtový
`packet->path_len = 0` vynuluje celý bajt — a v jeho horních dvou bitech bydlí
šířka hashe (`Packet.h:85`). Zerohop paket proto hlásil 1 B bez ohledu na
`path_hash_mode`, zatímco floodová větev šířku dostávala. Na uzlu s 2bajtovým
nastavením to vypadalo takhle: `flood: {2 B}` a `route2: {1 B}` od téhož
původce, přesně `advert.interval` od sebe.

Routing to nerozbíjí (zerohop nemá cestu a nepřeposílá se, `Mesh.cpp:83` chce
`getPathHashCount() > 0`), ale kazí to odvozování šířky v analyzerech — a je to
pravděpodobné vysvětlení části komunitních uzlů vedených jako "suspected 1B".

`sendZeroHop()` dostal `path_hash_size=1` jako `sendFlood()` a všechna čtyři
volání v `simple_repeater` mu předávají `_prefs.path_hash_mode + 1`. Zvlášť to
u periodického advertu (`MyMesh.cpp:1706`), který NEJDE přes
`sendSelfAdvertisement()` — oprava jen v té funkci by ho minula, a přitom je to
zrovna on, koho bylo v datech vidět.

Ostatní příklady se nemění, default zachovává dnešní chování. Build ověřen na
všech třech produkčních envech.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-22 15:04:52 +02:00
tthandClaude Opus 5 f80fcc0587 feat(repeater): report the TX-failure counters in the RF status reply
A repeater that keeps failing to get its transmits out looks perfectly
healthy over RF: sent/airtime just stop growing and nothing in the status
says why. The Dispatcher already counts those failures (n_tx_start_fail,
n_tx_timeout, from the requeue path); this puts them on the air.

Appended at the END of RepeaterStats on purpose, because the struct goes out
byte-for-byte and clients parse it by fixed offsets. Upstream grew the same
frame the same way -- meshcore-py's parse_status() reads recv_errors only
`if len(data) >= offset + 56`, with the comment "appended in firmware
v1.12.0" -- so older clients keep working and simply do not see the new
fields. Verified against the installed parser before writing this.

A static_assert pins sizeof(RepeaterStats) == 64 (56 + 8, padding-free):
reordering a field or gaining padding would silently shift every offset
after it, and that is not something to leave to review.

Room server keeps its own, already-different stats struct -- not touched.

Builds: SenseCap_Solar_repeater, SenseCap_Solar_repeater_ble, t1000e_repeater.
NOT field-tested yet: needs a repeater flashed with this and queried over RF.
Reading the two values also needs the consumer side extended (the library
parser stops at 56 bytes by design).

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-19 19:42:20 +02:00
Rastislav Vysoky d1a2a0c20b repeater: set loop.detect to minimal as default for new installs 2026-08-18 14:56:58 +02:00
tthandClaude Opus 5 e38f311563 Merge upstream v1.17.1 (origin/main)
Small one after v1.17.0: 57 files, +825/-200, and it merged with no conflicts at
all. Unlike 1.17.0, the release tags sit directly on origin/main, so no
`-s ours` is needed for git describe to see the release.

What matters for our nodes:

* fix-rxgain-setting-post-agc-reset -- rx gain no longer resets after an AGC
  adjustment. The release notes ask repeater admins to verify radio.rxgain (and
  the new radio.fem.rxgain) after updating, so that goes on the post-flash list.
* NRF52 CC310 crypto is initialised once instead of on every call, and several
  NRF52 pin maps were corrected.
* New 'get/set radio.fem.rxgain/txgain' CLI commands (companion cannot configure
  them yet).

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-15 14:13:50 +02:00
ripplebiz f8832af086 Merge pull request #3106 from ViezeVingertjes/fix/scoped-reply-routing
Fix replies dropped when flood.max.unscoped is low
2026-08-13 15:00:37 +10:00
tthandClaude Opus 5 9d5491f5db Merge upstream v1.17.0 (origin/main) into the analyzer/BLE fork
Upstream shipped companion/repeater/room-server v1.17.0 today; its tree is
identical to origin/main, so that is what this merges. Our base was 7 Jul
(7b566670), i.e. 350 files / +11k lines of upstream behind.

Conflicts and how they were settled:

* Mesh.cpp -- upstream split the dedup into wasSeen() + explicit markSeen().
  Kept BOTH: their new call pair AND our payload-length bound on the TRACE
  path-hash read, which is what stops a crafted short TRACE from steering
  isHashMatch() past the buffer.
* companion_radio/main.cpp -- upstream grew its own MultiSerialInterface
  (BLE + USB + WiFi + Ethernet registered side by side), which is a superset
  of the SerialDualInterface we backported from PR #1779. Took theirs whole;
  our copy is now dead code. NOTE: envs that relied on the backport for a USB
  console alongside BLE now need an explicit -D ENABLE_USB_INTERFACE.
* ui-new/UITask.cpp -- isSerialEnabled() was renamed isBluetoothEnabled()
  upstream and DisplayDriver::RED became UIColor::warning_txt. Same intent
  either way: no BT pin on screen while Bluetooth is off.
* EnvironmentSensorManager.cpp -- upstream fixed the millis() wrap on the GPS
  update timer in the exact line our gpsDutyLoop() call sits on. Kept both,
  with their wrap-safe compare.
* NRF52Board.cpp -- upstream independently arrived at the same sd_temp_get()
  fix for SoftDevice-protected TEMP. Took their form, kept our comment, which
  is the only place recording WHY (APP_MEMACC fault -> reboot on telemetry).
* RadioLibWrappers.{h,cpp}, simple_repeater/main.cpp -- add/add. Their
  configSideDetectors()/performChannelScan()/external watchdog next to our
  irqDoneMask()/probeDio1()/BLE pump/WDT feed. The repeater console keeps the
  1032-byte reply buffer for paged analyzer output and now clears it, since a
  static buffer would otherwise reprint the previous reply.
* .vscode/extensions.json -- deleted upstream, and it is in .gitignore; our
  only change was a comment. Gone.

Built clean: Xiao_x1_rpt, Xiao_x2_cmp, Xiao_x3_obs, SenseCap_s1_rpt,
T1000E_cmp_cz. Not flashed to anything yet.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-09 22:44:07 +02:00
Scott Powell 49319023e5 Merge branch 'dev'
# Conflicts:
#	docs/payloads.md
2026-08-09 14:36:53 -04:00
agessaman 2eb7feffe0 fix(station-g3): expose FEM gain preferences 2026-08-06 15:29:14 -07:00
ripplebiz 8bf182fb41 Merge pull request #3115 from oltaco/meshnology_w12
Add support for Meshnology W12 and LR2021 Wrapper
2026-08-05 15:04:00 +10:00
taco cb7b158931 LR2021: auto-LDRO for side detectors 2026-08-05 14:23:32 +10:00
taco 5687ba3f87 LR2021 multi-SF support (side detectors) 2026-08-05 14:23:32 +10:00
tthandClaude Opus 5 b9848fe79a feat(radio): DIO1-less operation + pin diagnostics, to salvage bench-board
bench-board died 29. 7. 2026 to a breadboard short that put GND on D1 (= DIO1)
and 5 V on D0. Signature: `sent 0` with tx_timeout climbing WHILE A WITNESS
HEARD THE FRAMES, plus `recv 0` at strong signal -- the radio works, the
interrupt line does not. setPacketReceivedAction() is the only thing that
ever sets STATE_INT_READY, so a dead line means nothing is ever picked up.

LORA_POLL_IRQ reads completion from the chip's IRQ status register over SPI
instead. The chip latches those events regardless of whether they are mapped
out to a DIO pin, so this bypasses the whole line and therefore works no
matter WHICH end of it broke. Rewiring DIO1 to a spare GPIO only helps if the
broken end is the MCU's input pad -- and that is the less likely end, because
grounding an input cannot damage the input, it stresses whatever drives the
net. Polling is strictly stronger: if it does not revive the node, no wire
will either. Cost is one extra SPI read per Dispatcher pass, next to the
isReceivingPacket() read already in that path.

getIrqFlags() returns the RAW chip register (SX126x bits, not RadioLib's
generic RADIOLIB_IRQ_* indices), so the mask comes from a new virtual
irqDoneMask() that only the chip-specific wrapper can fill in.

PIN_DIAG answers "which end?" without a multimeter:

  - boot-time pull-up/pull-down sweep of every header pin, placed BEFORE
    radio_init() because that halt()s when the radio does not answer -- so it
    is the only diagnostic that still runs with the module unplugged, which is
    also the only state where D1's result means anything (attached, the SX1262
    drives DIO1 low and a healthy board reads 0 too). The internal pull is the
    ohmmeter. It cannot see a lifted pad -- the resistor is on the die -- hence
    the optional PIN_DIAG_LOOP_A/B jumper loopback, which drives from outside
    and reads while pulling AGAINST the driver.

  - `dio1` has the radio assert DIO1 via a 1-byte transmit and compares the
    IRQ status register against the actual pin level. Where they disagree is
    where the break is.

All of it is behind #ifdef; a build without the flags is unchanged.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-04 21:32:58 +02:00
tthandClaude Opus 5 cca22dd45d feat(repeater): channel bot in the analyzer build -- listens and answers without repeating
The #tth-test bot needed a host process (slidge) plus a dedicated serial
companion node. Putting it in the firmware removes both: the observer node
answers by itself, and the serial console stays free for the CoreScope feed.

Not a port of the Solo bot. That one lives in examples/companion_radio on a
branch 610 commits diverged from ours, and it can only be configured from an
on-device BotScreen -- a XIAO has no display or buttons, so it would compile
and never arm. What made a local implementation cheap is that mesh::Mesh
already exposes everything:

  * Mesh::onRecvPacket() calls searchChannelsByHash() + onGroupDataRecv() and
    THEN routeRecvPacket() (Mesh.cpp:236-249), so reading a channel is
    independent of forwarding it. Both hooks are no-op virtuals, which is the
    only reason a repeater is normally deaf to channel traffic.
  * allowPacketForward() gates only RECEIVED packets, so a node with
    `repeat off` can still originate a reply. That is the point here: the
    observer sits metres from another repeater and must never forward, but it
    does have to answer.
  * createGroupDatagram() is in mesh::Mesh and sendFloodScoped() is a plain
    alias for sendFlood(), so none of the chat/contact machinery is needed.

Written against the mesh::Mesh API only, so it drops into
examples/simple_room_server unchanged if we ever want it there.

Commands are the ones only an analyzer can answer: !path (per-hop hashes at
the packet's own hash width, not a hardcoded 1 byte -- one node here runs 3),
!snr from the frame that carried the request, !heard from the registry.

Two guards, because this node's replies are its only transmissions:
anti-loop compares the sender prefix against _prefs.node_name (the runtime
name, so it holds even when stored prefs override the build-time one), and a
cooldown caps the reply rate. Both are needed: the cooldown alone would only
slow a ping-pong down, not stop it.

The channel key comes in as hex via -D BOT_CHANNEL_PSK, which is the form
`meshcore-cli get_channel <n>` prints -- no base64 round trip and no
base64.hpp dependency in this build. Hash derivation matches
BaseChatMesh::addChannel(); cross-checked against a live node, whose
128-bit key hashes to the same channel_hash the node reports.

All of it compiles out without BOT_CHANNEL_PSK. Costs 2.4 KB flash and 48 B
RAM over the plain analyzer build.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-04 18:30:47 +02:00
tthandClaude Opus 5 3c27e7745f feat(repeater): dfu [uf2|serial|ota] — deterministic reboot into the bootloader
The 1200-baud touch was the wrong mechanism, not an unreliable one. The
Adafruit bootloader chooses its mode from GPREGRET at boot, and the core
already exposes exactly that (cores/nRF5/wiring.c):

  enterUf2Dfu()    0x57  DFU_MAGIC_UF2_RESET          -> mass-storage drive
  enterSerialDfu() 0x4e  DFU_MAGIC_SERIAL_ONLY_RESET  -> CDC only, no drive
  enterOTADfu()    0xA8  DFU_MAGIC_OTA_RESET          -> BLE DFU

The touch only ever requests the *serial* one. That is why no UF2 drive ever
appeared however long we waited for it, and it is the real reason today's
flashes kept going sideways -- I read "coin flip" into what was simply a
request for a different mode, and then wedged two boards proving it.

`dfu` writes the magic and resets, so the board lands in the mode you asked
for, every time. The reply goes out first and the reset happens ~700 ms later
from loop(), since reset_mcu() never returns and over BLE the notification
still has to be pumped out of the TX ring.

LOCAL ONLY (sender_timestamp == 0, the same physical-presence test CommonCLI
uses for `erase` and `set freq`). Over the mesh this would park a node in a
bootloader that waits forever, on a mast, with no way back but a visit.

Builds clean; NOT yet exercised on hardware -- the boards that could test it
are the ones still running firmware without the command.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-04 12:53:20 +02:00
tthandClaude Opus 5 59e974854f feat(repeater): blink on|off, txpwr with RadioLib's verdict; UF2 flash helper
blink: a fixed burst is a race against walking to the bench -- 30 blinks
(~7 s) was not enough to find the board in time. `blink on` now runs until
`blink off`, with a 10-minute backstop so a node left blinking does not
quietly eat a battery. Cap on the counted form raised to 999.

txpwr: `set tx` cannot tell you whether the radio took the value. It clamps
to -9..30, saves the pref and replies "OK", but SX1262 accepts only -9..+22
and rejects the rest WITHOUT touching the PA -- so `get tx` can report a
power the radio never had. An earlier sweep here measured +2 dBm and -9 dBm
as RSSI -44.1 and -44.0 at a witness and concluded runtime tx power "does
not work"; that conclusion rested on an instrument that could not
distinguish a refused request from a link that does not care.
RadioLibWrapper::setTxPower keeps the status now (the signature stays void,
it implements an upstream callback), and `txpwr [dBm]` reports it. It
deliberately does not write the pref, so a sweep cannot leave a node booting
at some experimental power.

xiao_uf2_flash.sh: the 1200-baud touch is roughly a coin flip on this build.
Today it worked twice, then wedged x4, then wedged x1 -- and a wedged board
is gone from USB *and* BLE, does not recover on its own (waited 400 s) and
needs a physical replug. Not a "too soon after boot" effect: x1 had been up
23 minutes. Double-tap RESET into UF2 is reliable and takes seconds, so this
makes that the easy path. It refuses to act when several UF2 drives are
present rather than guessing, since they are all labelled XIAO-SENSE.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-04 12:45:28 +02:00
tthandClaude Opus 5 29d620e1a6 feat(repeater): blink [n] — ask a board to identify itself
A bench of identical XIAOs cannot be told apart. The USB serial number
needs a data cable, and boards sharing power rails have none; the BLE MAC
is printed nowhere; and ADVERT_NAME is only as trustworthy as the last
flash, which is usually the thing being checked. Today two boards in the
same breadboard were both advertising "bench-board" -- one of them the
board with the burned DIO1, still happily running BLE.

`blink 10` flashes an LED ten times (default 6, clamped 1..30), and works
from serial, the BLE console and the mesh admin CLI, so it also reaches a
node that is already mounted somewhere.

Deliberately not the status LED. On XIAO that is LED_BLUE, which Bluefruit
drives as its connection indicator -- every BLE node blinks blue the same
way, which is why the LED was useless for identification in the first
place. Preference order LED_GREEN (XIAO, free) -> LED_WHITE (SenseCap, only
ever touched at boot and powerOff) -> LED_BUILTIN, which is last because on
SenseCap it is pin 12, the LoRa TX indicator. Variants may define a colour
they do not physically have by pointing it at PINS_COUNT (SenseCap does
that with LED_RED), so the chain range-checks rather than trusting #ifdef.

Driven from loop(), not inline: a blocking burst would stall the mesh for
up to ~7 s at the cap and disturb the very LoRa timing this fleet measures.
Always finishes dark. Goes through LED_STATE_ON, which is 0 on XIAO and 1
on SenseCap -- hard-coding HIGH would leave half the fleet unlit.

Verified on bench-board over the USB console: "blink 10" ->
"OK - blinking 10 times", and the build stamps v1.16.0-ttha12965f+.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-04 12:20:28 +02:00
ViezeVingertjes 4820f0916d Merge remote-tracking branch 'upstream/dev' into fix/scoped-reply-routing
# Conflicts:
#	examples/simple_repeater/MyMesh.cpp
2026-08-04 11:49:58 +02:00
ViezeVingertjes 34156ddb11 Fix replies dropped when flood.max.unscoped is low 2026-08-03 22:57:12 +02:00
tthandClaude Opus 5 5333a71927 fix(tools/ble_dfu): require the target address; feat: ble_cli.py; feat: silent-by-default repeater
ble_dfu find(): with want_dfu it accepted ANY device whose name contained "DFU"
and then took the first one the scan returned. With more than one board in
bootloader at the same time that reaches for someone else's hardware. It just
did: target CE:72:…:02, connected FE:11:…:C4. Caught only because the log was
being read by hand -- a few seconds later START_DFU would have overwritten a
different node. The address is now mandatory (MAC or MAC+1, covering both the
SCAP_DFU-on-MAC+1 and AdaDFU-on-same-MAC bootloaders), and foreign boards in
bootloader are listed as explicitly ignored.

ble_cli.py: the BLE console had no tool, so every ad-hoc script re-implemented
it and re-learned the same trap: a NUS write carries ATT_MTU-3 bytes and BlueZ
will not split it, so at the usual MTU 23 anything over 20 bytes fails with
"Failed to initiate write" -- which reads like a dropped link, not "command too
long". Commands up to 18 chars work, longer ones fail, deterministically.
Chunking is now in one place, with retries and the pairing/single-console
caveats documented.

simple_repeater: ADVERT_INTERVAL_DEFAULT / FLOOD_ADVERT_INTERVAL_DEFAULT /
DISABLE_FWD_DEFAULT, so a node can be built to ship silent. ENABLE_ADVERT_ON_BOOT
alone is not enough -- it only suppresses the boot advert, the periodic timer
still fires, so an `erase`d node is on the air within two minutes. Found the
hard way: a node flashed before this change and then erased spent ~44 s
transmitting on the live CZ frequency from a desk.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-03 21:46:23 +02:00
tthandClaude Opus 5 bfdaf32d30 feat(mesh): default to 2-byte path hashes (PATH_HASH_MODE_DEFAULT)
Upstream never initialises _prefs.path_hash_mode, so a fresh node came up at
mode 0 = 1 byte per hop. Nobody on the CZ mesh runs 1 B any more, which meant
every new install needed a manual `set path.hash.mode 1`. Default it to 1 at
compile time in both the repeater and the companion; the pref still overrides
it, so existing nodes are unaffected.

NOTE this is the PATH hash, not PATH_HASH_SIZE. It is used as
sendFlood(..., path_hash_mode + 1), i.e. the bytes each hop appends to the path
while flooding, and the size travels in the packet -- Packet.h:85 packs it into
the top two bits of path_len and Mesh.cpp:93 matches with getPathHashSize() --
so mixed-mode nodes still route for each other. PATH_HASH_SIZE (1) is a
different field, the destination and channel hash in Mesh.cpp:458/548, and
changing THAT would break the wire format against every other node in the mesh.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-03 19:12:15 +02:00
Scott Powell c63f7d77f7 * bounds check added for anon_req reply_path_len 2026-08-04 01:00:31 +10:00
tthandClaude Fable 5 6e076a6e8d fix(mesh/tx): requeue failed transmits with backoff instead of dropping
A TX that fails to start (startTransmit error) or never completes
(send-complete IRQ lost) was released permanently — with an nRF52
SoftDevice servicing BLE connection events this silently ate ~40 % of
DIRECT-route forwards (measured A/B on mast-three: direct_rx +5 / direct_tx
+3 with an idle BLE connection, 5/5 with BLE off). Flood redundancy
masked the same loss for flood traffic.

Retry up to MESH_TX_RETRIES (3) with a short growing backoff; a
duplicate on air is harmless (hasSeen dedup). New tallies
tx_start_fail/tx_timeout in stats-packets + ERR_EVENT_TX_* flags make
this failure class visible at last.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-21 13:43:34 +02:00
tthandClaude Fable 5 c5fb0fb4ce feat(repeater/analyzer): pktfeed ring + pktlog cmd — raw frames for the community observer feed
Small sibling ring to rxlog (PKTFEED_SIZE=32, ~8.6 KB) that keeps the FULL
raw frame bytes: staged pre-parse in logRxRaw, committed post-parse in logRx
(radio garbage never enters). Paged `pktlog [cursor]` mirrors rxlog paging;
the bridge derives route/type/payload and the MeshCore SHA packet hash
(analyzer correlation key) from raw, so the radio hot path stays SHA-free.
No 'always emit >=1' here: a ~550 B record line would overflow the 150 B
mesh-CLI budget — there the reply degrades to a bare trailer.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-16 20:50:25 +02:00
tthandClaude Fable 5 91f827cede feat(repeater/analyzer): big console pages + physics-sized tables (rxlog 512, heard 128)
The BLE bridge drain was throttled by three multiplied costs: 150 B pages
(~3 rxlog records), 20 B NUS notification chunks, and the bridge waiting for
line silence per page. This fixes the firmware half:

- handleCommand() takes an explicit reply_max (default 150). The local console
  (USB/BLE) passes ~1000 B -> ~20 rxlog records / ~7 nodes lines per round
  trip; the mesh admin CLI keeps 150 so its reply still fits one LoRa packet.
  Explicit parameter on purpose: a forged sender_timestamp==0 from the mesh
  path must never be able to grow the reply past its 166 B buffer.
- bleWriteAll() chunks by negotiated MTU (247 -> 244 B) instead of fixed 20 B.
- Tables sized from channel physics instead of last week's traffic:
  RXLOG_SIZE 512 = ~2 min of a saturated SF8/62.5k channel (~2-4 frames/s),
  MAX_HEARD_NODES 128 > distinct nodes heard per neighbour advert period
  (48 filled in <2 h and churned out real 0-hop neighbours).
- Page-sort scratch arrays moved off the loop-task stack into BSS.

RAM 17.7% -> 25.3% (59.6 KB / 235 KB). Flashed via BLE DFU 2026-07-15.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-15 11:53:48 +02:00
Scott Powell a4e7cdf4f3 * first draft of new ConfigSerializer. (simple embedded JSON prefs) 2026-07-15 01:23:57 +10:00
tthandClaude Opus 4.8 ef6628afed fix(repeater/analyzer): colon-delimit path hops so hash width is self-describing
The path field emitted raw hex, but the hop-hash width (1/2/3 B, top 2 bits of
path_len) wasn't visible in it -- the bridge couldn't tell "A31FC2" from three
1-byte hops vs one-and-a-half 2-byte hops. Emit hops colon-separated instead
("A3:1F:C2" vs "A31F:C204"): each token is one hop, its width is len/2. Field
order/count is unchanged (path stays the same column), so the bridge only
changes how it splits that one token. Shared helper analyzer_path_hex() used by
both nodes and rxlog. (`HEX` had to be a local name other than the Arduino
Print.h `HEX` macro.)

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-12 19:16:48 +02:00
tthandClaude Opus 4.8 dd2642dc0e feat(repeater/analyzer): multi-path join key + prefer direct 0-hop path
Two related improvements to how heard nodes are represented:

1. Multi-path. A node's advert reaches us via several paths at once, but the
   mesh dedups by payload hash (path not hashed) so onAdvertRecv sees only the
   first copy -> `nodes` kept one path. rxlog, however, is fed pre-dedup and
   logs every copy with its own path+SNR. Add the advert's FNV id (`pkt_hash`)
   to each `nodes` row as a JOIN KEY: the bridge groups rxlog by pkt_hash and
   joins to nodes to reconstruct every route a named node arrived by. New
   `nodes` field: N,...,<age>,<pkthash>,<path>,<name> (name now after 10th comma).

2. Prefer direct. onAdvertRecv often processes a relayed copy first (stronger),
   so the direct 0-hop link was being overwritten by a relayed path -- the
   direct neighbours only showed up via the old `neighbors` path. Track
   `direct_heard`; keep the direct (empty) path + its SNR for
   HEARD_DIRECT_TTL_SECS after last hearing the node 0-hop.

Shared FNV helper (analyzer_frame_id) now used by both captureRx and
putHeardNode so nodes.pkt_hash == the rxlog copies' pkt_hash exactly.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-12 18:47:44 +02:00
tthandClaude Opus 4.8 55166d4773 perf(repeater): drop duplicate per-packet SHA-256 from rxlog capture
captureRx() ran calculatePacketHash() (SHA-256) on every received frame in
the logRx hot path. The mesh core already computes that SHA once per frame
in hasSeen() during routing, so the analyzer was doubling the crypto load
on the radio-shared main loop for no benefit.

Replace pkt_hash with a cheap FNV-1a over (type||payload): same purpose
(dedup / correlation across nodes running this FW), a fraction of the CPU.
RAM-only, no flash writes, still main-loop (not ISR) -- so this does not by
itself explain BLE link drops (those match the known SoftDevice/LoRa
coexistence instability the BLE watchdog already guards), but it removes
the one real RX-path cost the analyzer added.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-12 01:05:16 +02:00
tthandClaude Opus 4.8 44aa778e97 feat(repeater): passive mesh analyzer -- nodes + rxlog over the console
Two RAM-only, opt-in tables fed from the normal RX path and pulled out
over the text console (serial / BLE) for a BLE bridge + map to consume.
Both are compiled out unless the build sets a non-zero size; enabled on
SenseCap_Solar_repeater_ble (-D MAX_HEARD_NODES=48 -D RXLOG_SIZE=96,
~6 KB RAM).

  nodes [offset]  -- registry of heard REPEATERS and ROOM SERVERS (chat
    clients are deliberately skipped: personal/mobile devices, privacy).
    Per node: pubkey prefix, name, type, lat/lon, last SNR/RSSI, seconds
    since heard, and the path the advert arrived by. Fed from onAdvertRecv
    (adverts are signature-verified upstream). -> map dots + topology
    edges + link quality.

  rxlog [cursor]  -- circular firehose of EVERY parsed frame heard, fed
    from logRx() (synchronous, so SNR/RSSI belong to that frame). Per
    record: monotonic seq (paging cursor), time, packet hash, header
    (route|type), SNR/RSSI, hop path. -> live traffic / analyzer view.

Both replies are paged to stay within the ~160 B console reply cap and
carry a trailer (next cursor + totals) so the bridge can drain and detect
if it fell behind the ring. Reachable over serial, the PIN-paired BLE
console and the admin mesh CLI, same as `neighbors`.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-12 00:19:32 +02:00
tthandClaude Opus 4.8 cba8164693 feat: expose repeater text console over BLE + nRF52 SoftDevice fixes
Repeater can be queried over BLE Nordic-UART (advert/neighbours/stats) without USB. Fix SoftDevice-protected TEMP peripheral access (sd_temp_get) that crashed BLE repeater telemetry, add USB-connected detection to ArduinoSerialInterface, and adjust the nRF52 ldscript/extra FS.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-11 19:21:11 +02:00
Neil Alexander ea95fa0ad6 Fix recv_pkt_region incorrect usage
The `recv_pkt_region` is set when processing a flood packet in `filterRecvFloodPacket`
but direct/non-flood packets would never pass through that function, so the pointer was
not cleared for them.

`sendFloodReply` would then later use it blindly, which meant that the response would
either inherit the region from the last flood packet, or refer to a non-initialised pointer
if no region floods had been received yet.
2026-07-02 09:28:41 +01:00
taco 1a90abdbe2 return bool when setting rx boost 2026-06-26 07:44:01 +10:00
taco e076cd4e3d remove guard on MyMesh::setRxBoostedGain() 2026-06-26 07:06:37 +10:00
Wessel Nieboer e77b6b101f Have CAD be a separate toggle (set cad on/off) 2026-06-14 15:20:58 +02:00
Wessel Nieboer 720cd75167 Use hardware channel activity detection for checking interference 2026-06-14 15:19:18 +02:00
Quency-D 606f8f1cc3 Merge branch 'dev' into cli-lna-command 2026-06-10 11:30:04 +08:00
Scott Powell a4c1981e6a * default now 8, per the will of the peoples. 2026-06-06 21:00:58 +10:00
Scott Powell d66597c3e7 * new CLI config: flood.max.advert (default 16) 2026-06-06 13:09:24 +10:00
Scott Powell 3a707fad43 * simplified the new flood.max.unscoped pref 2026-06-02 14:15:33 +10:00
ripplebiz fb517b2164 Merge pull request #2661 from mrzarquon/mrz/flood_max_unscoped
Implement flood.max.unscoped to allow selective repeating of unscoped messages
2026-06-02 14:00:33 +10:00
Chris Barker a7bb4bef76 Feat: Adds flood.max.unscoped setting
Before this commit, there was no way to set a different max hop count
for unscoped messages.

Now with this change, by defaul it tracks the flood.max setting, until
a user provides a flood.max.unscoped value, which tax precidence for
packets if ROUTE_TYPE_FLOOD is true.
2026-06-01 21:30:17 +01:00
Scott Powell ac507c2b3e * Bug fix: adding neighbor when path_mode != 0 2026-06-01 23:08:39 +10:00
Rastislav Vysoky 3e0b9da426 Update repeater flood advert interval to 47 hours 2026-05-21 14:50:58 +02:00
Quency-D 747845cfc2 Merge branch 'dev' into cli-lna-command 2026-05-09 18:19:31 +08:00
Scott Powell 8903b907d1 * Refactor: removed duplicated radio_rng_seed(), radio_set_params(), radio_set_tx_power() 2026-05-01 14:47:07 +10:00
Quency-D 9641f7b2a2 Merge branch 'dev' into cli-lna-command 2026-04-25 15:28:07 +08:00