CI pouštělo `pio test -e native -e native_kiss_modem`. Guardy v Packet::readFrom
zamerne nemeni navratovou hodnotu -- odmitnou presne to, co upstream odmitne az
po precteni -- takze pod `native` projdou i BEZ nich; rika to i hlavicka
test_packet_readfrom.cpp. Slo je tedy odstranit a CI zustalo zelene.
Overeno mutaci: po odstraneni tri guardu z Packet.cpp `native` porad PASSED,
`native_asan` skonci rc=1 a binarka hlasi
"heap-buffer-overflow ... src/Packet.cpp:93 in mesh::Packet::readFrom".
Doplneno `-fno-sanitize-recover=all`: bez toho UBSan nalez jen VYPISE a test
dobehne uspesne, takze z te poloviny sanitizeru byla ozdoba.
A poznamka do ini o pasti v diagnostice: `pio test` u padu sanitizeru vypise jen
"Program received signal SIGHUP" a ASAN report SPOLKNE -- necti z toho, ze
sanitizer nic nenasel, spust binarku primo.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
`312a1ef9` pripojil FIRMWARE_VERSION do `handleGetDeviceName()`, aby sla KISS
deska verzne identifikovat. Na desce to jede, na hostu ne: `[env:native_kiss_modem]`
nemel stamping skript (FIRMWARE_VERSION nedefinovan) a `snprintf` si na desce
tahne Arduino.h, kdezto na hostu ho musi dodat `<cstdio>`. Test env tim od
1. 9. 2026 ERRORoval uz ve fazi prekladu -- osm testu, ktere pritom prochazi.
Env dostal `pre:tools/build_version.py` (stejne jako nRF52 envy), zdroj
`#include <cstdio>`. Zadny fallback literal: kdyby stamping vypadl, build spadne,
misto aby deska hlasila verzi, ktera nikdy nebyla pravda.
`pio test -e native_kiss_modem` 8/8.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
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>
Upstream přečte hlavičku, transport codes, path_len i celou cestu, a teprve
pak se zeptá `if (i >= len)`, jestli v rámci něco z toho bylo. Krátký rámec
se tedy přečte za svým koncem a výsledek se zahodí až potom.
Změřeno ASAN harnessem, který readFrom předává heap buffer alokovaný přesně
na `len` bajtů: na 5 242 880 vygenerovaných rámcích to sáhlo mimo na ČTYŘECH
různých místech (hlavička, oba transport codes, path_len, memcpy cesty).
S kontrolami je stejný průchod čistý a přijme přesně stejných 1 351 424
rámců -- neodmítne nic, co dřív prošlo, jen přestane číst paměť, která nikdy
nepřišla.
Na desce je zdrojem `raw[MAX_TRANS_UNIT+1]` v Dispatcheru, tedy 256bajtové
pole na zásobníku, a tohle do něj sáhne nejvýš ~70 bajtů. Takže se četly
zbytky po předchozím paketu, ne paměť mimo pole -- proto se to nikdy
neprojevilo jako pád a proto je to hygiena, ne díra.
Testy jsou v `test/test_packet/`, ale POZOR: pod `-e native` projdou i bez
téhle změny, protože návratová hodnota je záměrně stejná. Rozdíl je vidět
jenom pod sanitizerem, proto přibyl env `native_asan` -- tam testy krmí
parser bufferem na přesnou délku rámce a bez opravy běh spadne na
`heap-buffer-overflow` hned v prvním případu. Celá sada: 49/49 v obou envech.
Totéž řeší upstream PR #1666 (weebl2000), otevřený a nesloučený od února
2026 -- zasekl se na "chtělo by to unit testy", které tehdy neměl kde psát.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
`ver` on a bench board reported the literal from the upstream header, so
there was no way to tell which build was actually on it -- which is exactly
what AGENTS.md says must never happen for a flashed env. The audit was worse
than expected: of 585 envs in the repo, TWO stamped. The T1000-E only looks
right because it is flashed from a local env in platformio.local.ini.
So the stamping moved into [nrf52_base], where every nRF52 env inherits it,
and the two per-env copies are gone (they would have run the script twice).
Verified on hardware, not just in the ELF: after reflashing, x4 reports
ver -> v1.17.1-tthec20d77+ (Build: 260819 1957)
and x2's device query returns v1.17.1-tthec20d77+ / 260819 2003. The `+`
marks a dirty tree, the sha is the commit that built it.
ESP32/RP2040/STM32 bases can take the same one-liner if boards on those
platforms ever get flashed from here; not done blind.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
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>
Select nodes had this flag enabled, testing by the community
and hardware specs indicate this can be enabled global for all
node types using this chipset.
Any nodes down the line that may be quirky can be individually
disabled with `-U USE_CC310_HW_CRYPTO`.
The new test_kiss_modem suite needs KissModem headers and sources that
only native_kiss_modem provides. Scope native to test_utils and run both
envs in the unit test workflow.
Switch ESP32-S3 KISS modem environments to HWCDC and move outbound KISS writes to a non-blocking queued frame path so loop() and TX completion keep progressing when the host reads slowly. Add native backpressure regression tests and correct the native_kiss_modem test filter so this suite runs directly with pio test.
Add [secrets] ble_pin mechanism: envs use ${secrets.ble_pin}, the committed default is a non-secret placeholder, and the real PIN lives only in the git-ignored platformio.local.ini. Move INA226 to 0x40 (frees 0x44 for SHT41), skip flaky GPS detection on SenseCap, and use a local framework symlink for the nRF52 short-SHA fork.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
hasSeen() was simultaneously a predicate and a mutator — it inserted the
packet hash on every miss, making five call sites that only wanted to mark
a packet as sent call it with the return value discarded.
Split into:
- wasSeen() — pure predicate, no side effects
- markSeen() — explicit insert
All query sites now call markSeen() immediately after wasSeen() returns
false, preserving identical runtime behaviour. The five mark-only send
sites (sendFlood, sendDirect, sendZeroHop x2) now call markSeen directly.
Also fixes three bridge sites (BridgeBase, ESPNowBridge, RS232Bridge)
that had the same query+implicit-insert pattern.
Tests: add test/test_mesh_tables/ covering wasSeen purity, markSeen,
dup stats, and clear. Update SHA256 mock to produce deterministic output
(previously finalize() was a no-op). Add Packet.cpp to native build filter.
Patches Bluefruit library to fix semaphore leak bug that causes device lockup
when BLE central disconnects unexpectedly (e.g., going out of range, supervision timeout).
Co-authored-by: Liam Cottle <liamcottle@users.noreply.github.com>
Co-authored-by: oltaco <oltaco@users.noreply.github.com>