One nRF52840 variant shared across both radios, picked per env: Duo runs
the LR1121, Uno the SX1262. Same PCB, only the radio and its DIO1 pin
change.
SuperIO adds the SH1107 OLED, GPS, buzzer and joystick. GPS is driven by
the 3-position mode switch (Mode 2 = on), polled live the way thinknode_m1
does it.
Five quick user-button presses power the unit off; a press wakes it back
on (arms the button as an nRF52 GPIO SENSE source before SYSTEMOFF).
Consolidates #2054 and andyshinn's shared-base/uno work, rebased on dev.
Co-authored-by: lbibass <ewdries02@gmail.com>
Co-authored-by: Andy Shinn <andys@andyshinn.as>
Payloads of 166 or 167 bytes previously passed the frame-sized bound
(MAX_CHANNEL_DATA_LENGTH = 167) but were rejected by sendGroupData
against MAX_GROUP_DATA_LENGTH (165), causing ERR_CODE_TABLE_FULL (retry
later) to be returned instead of ERR_CODE_ILLEGAL_ARG.
Fixes#3345
Currently, time is only set to ~2024 when it powers on cleanly. When
time is lost, this results in time dropping to 1970. Save time as backup
to RTC slow memory. Should fix time staying accurate during brownouts
etc.
'custom:{}' (a DynamicConfigSerializer with nothing set) hits EXPECT_KEY
with a '}' and returns TOK_ERROR, so loadSerial stops there and silently
drops every property after it. Nothing follows 'custom' in NodePrefs
today, so it goes unnoticed until you add one.
Also include stdlib.h, which Arduino.h was providing on-device but not
in the native test build.
- scope the serial config CLI to RP2040; it was exposing the rescue CLI
(cat/rm/erase) on every ESP32 WiFi build, which gates it behind a
physical long-press
- bound and space out RP2040 rejoins: the core's join busy-waits, so cap
it at 5s and retry every 30s instead of every 10s
- stamp the reconnect timer in setup(), so the first loop() doesn't tear
down an association that is still finishing DHCP
- treat stored credentials as a pair, and pass NULL (not "") for an open
network
- teach build_as_lib.py where SerialWifiInterface moved
arduino-pico's WiFi.begin() blocks for up to 2x its 15s timeout, which
stalled the mesh loop on every reconnect attempt; use beginNoBlock().
Log the IP when the link comes up, and the status code when retrying.
Store ssid/pwd in NodePrefs and set them with 'set wifi.ssid' /
'set wifi.pwd' over USB serial; build-time WIFI_SSID/WIFI_PWD stay as
the fallback. Headless WiFi builds get the config CLI on Serial, which
is otherwise unused there.
SerialWifiInterface has no ESP32-specific code, so move it to
helpers/wifi and reuse it on RP2040. Guard the ESP32-only WiFi
event/auto-reconnect calls and poll link state on RP2040 instead.
Ze tří nezávislých review agentů:
- fairnessHandleCommand: `memcmp(arg, "cap ", 4)` nad 1bajtovým ""
literálem = OOB read (UB, trip ASAN) → `strncmp` (zastaví se na NUL).
- chan_list_del trimoval jen leading space → `filter del Bob ` (RF pad
trailing) nic nesmazal; teď trimuje oba konce jako chan_list_add.
+ test TrimsTrailingSpaceOfName.
- formatGrid: `static` scratch (nereentrantní + 448 B BSS napořád) →
lokální; + guard max_len<=0.
- reply formátování přes snprintf(reply, reply_max) místo sprintf/strcpy
(filter_deny je proměnné délky) — defense-in-depth.
Ostatní nálezy (spoofovatelnost jména, agresivní advert cap 4/120min
default-on) jsou zdokumentované/záměrné, ne bugy — advert default na
husté CZ síti chce ověřit gridem před stožárem.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
nRF52 CI buildy (RAK_4631*, wio_wm1110) padaly na
`PackageException: Can not create a symbolic link for
/home/user/projects/meshcore-nrf52-fw` — lokální build hack
(`framework-...@ symlink:///home/user/...`) byl commitnutý v
platformio.ini a na runneru ta cesta neexistuje. Pre-existing, ne
antispam změna; buildovalo jen lokálně.
- [nrf52_fw] pkg proměnná: committed default = fetchable git pin
(plný SHA d541301…, tip meshcore-dev fork masteru s BLE patchem).
Plný SHA schválně — shallow fetch krátkého SHA byl důvod symlinku.
- Symlink override přesunut do gitignorovaného platformio.local.ini
([nrf52_fw] pkg = symlink://…), takže lokální build jede dál a hack
už neleakne do CI.
- TxtDataHelpers.cpp: `ltoa` (nedeklarované na STM32/newlib-nano,
rozbíjelo wio-e5 build) → přenositelné `sprintf("%lu")`. int_part je
nezáporná magnituda, znaménko se řeší zvlášť výš.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Bez gridu jsme slepí — `fairness` čítač říkal KOLIK, ne CO. A capy byly
build konstanty, takže zvolnit telemetrii šlo jen reflashem.
FairnessLimiter:
- per-bucket deny čítače (uint16, group/sender/advert mapy) + formatGrid:
vypíše nejrušnější buckety po kategoriích jako `<pfx>=<count>`, busiest
first. Bucket prefix se křížově dohledá v observeru/CoreScope na jméno.
- runtime settery capů (setGroupCap/…; 0 = build default).
MyMesh + NodePrefs (persistováno přes savePrefs):
- prefs fair_{g,s,a}cap + fair_{g,s,a}rf_s (0 = build default), aplikují se
v begin() a refill scheduling je z nich (fairGroupRefillMs atd.).
- CLI `fairness grid`, `fairness cap <g> <s> <a>`, `fairness refill <g> <s>
<a>` (sekundy); bare `fairness` teď hlásí i capy a refilly.
Bench (x1, 5. 9.): `fairness cap 2 2 2` → burst 6 zpráv na #test →
grid `group(cap 2): 19=5` (bucket 0x19 = #test hash 0xD9 & 0x1F, sedí);
cap 0/refill 0 vrací defaulty. Testy test_fairness_limiter rozšířeny
o cap tuning + grid (native i ASAN, 66/66 zelených).
Telemetrie chodí FLOOD jen do naučení cesty — direct část se nelimituje
vůbec (FAIRNESS_ALLOW_DIRECT), takže zvolnění se týká jen flood telemetrie.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Reakce na 5. 9.: ujetý AI bot lil 11dílný Gemini 429 dump na #meshcore
(99 ze 100 posledních zpráv kanálu) a naše repeatery ho poslušně šířily.
Vrstva A — FairnessLimiter (port Beanowovy větve beanow/wp-repeat,
upstream návrh meshcore-dev/MeshCore#1502): token buckety nad
FORWARDOVANÝM provozem, klíčované 1B identifikátory v plaintextu
(channel hash / src hash / pubkey[0]). Nový virtual
Mesh::takeForwardingRateLimit() jako poslední podmínka všech čtyř
forward rozhodnutí. DIRECT se nelimituje. Odchylky od originálu: bez
RTC závislosti (logy přes MESH_DEBUG_PRINTLN), bounds guardy na
payload_len. Kill switch: `fairness on|off` (persistovaný pref).
Vrstva B — ChannelFilter: repeater se znalostí PSK (committed
[channel_filter] — klíče hashtag kanálů jsou SHA256(jméno)[:16],
tedy veřejné z konstrukce; derivace ověřená na 0xEF z éteru)
dešifruje GRP_TXT a zprávy odesílatelů z runtime deny listu
odmítne přeposlat (markDoNotRetransmit, stejný mechanismus jako
ANON větev). CLI `filter add|del|list|clear`, seznam v NodePrefs.
Jméno je spoofovatelné — je to zadržení ujetého bota, ne security;
příjem a rxlog/pktfeed (CoreScope) nedotčené. Fork-only, upstream
by to nevzal (privacy/no-censorship, viz diskuze u #169).
ChannelBot refactor: registr kanálů + parse sdílené v ChannelCommon.h
(bot = botOnChannelText), čisté helpery v ChanListUtil.h kvůli native
testům. Nové testy test_fairness_limiter + test_chan_list (native i
ASAN, 164/164 zelených).
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>