ESP32Board.h defined _rtc_backup_time and _rtc_backup_magic as static in the
header, so every translation unit that includes it has its own copy, and the
inline members of ESP32RTCClock read and write the copy of the unit they are
compiled in. Today one unit per image uses them; a second one could restore a
copy that setCurrentTime() never wrote. The header now declares them, and
ESP32Board.cpp defines them once.
"set af nan" is accepted and stores a NaN in airtime_factor, the duty cycle
budget the roles hand to their airtime accounting. strtof() consumes the
token, so the parse guard does not fire, and no ordered comparison is true for
a NaN, so "af < 0 || af > 9" cannot reject it. "set dutycycle" writes the same
field and has the same hole.
Both commands now check the text before it is parsed: after optional white
space and sign, a number has to start with a digit or a '.'. That refuses
"nan", "inf" and their variants, and keeps every spelling that was accepted
before (signs, leading white space, ".5"). The ranges and both reply strings
are unchanged.
The check is on the text rather than on the parsed float on purpose. nRF52
builds use -Ofast, and under -ffast-math the compiler may assume a float is
never NaN or infinite. A test on the value, even one that reads its bits, can
then be folded away: clang does exactly that with a bit test at -Ofast, while
arm-none-eabi-gcc keeps it. A character test does not depend on that.
CMD_SEND_CHANNEL_TXT_MSG reads txt_type, channel_idx and a 4 byte timestamp, so
the frame needs 7 bytes before the text starts, and the branch had no length
guard. For a shorter frame "len - i" is computed in size_t, wraps, and reaches
sendGroupMessage() as a negative int. The clamp there tests
"text_len + prefix_len > MAX_TEXT_LEN", which a negative value passes, and the
following memcpy() converts the length back to a size_t: a 3 byte frame asks for
4294967292 bytes into a 197 byte stack buffer.
Two guards, because there are two mistakes. The branch now states its minimum
like most other branches of handleCmdFrame do, so a frame below 7 bytes is
answered through the existing path instead of being parsed. And
sendGroupMessage() refuses a negative length the way sendGroupData() in the same
file already does, which protects every other caller.
A frame of exactly 7 bytes keeps working and sends an empty message, as before.
Evidence. On a T-Echo running dev c9fa617c, built with
FIRMWARE_BUILD_DATE "f1-dev" and confirmed by "ver => v1.18.0 (Build: f1-dev)":
CH_TXT len=7 -> RESP_CODE_OK
GET_STATS core -> uptime=78s
CH_TXT len=3 -> NO REPLY
DEVICE_QUERY -> NO REPLY (three times over 8 s, node never came back)
Tisk se zkroutil a odlepil od podložky a v rozích příruby byl převis
~56° (ostrý offset lichoběžníku). Všechny obrysy jsou teď rovnoběžné
offsety zaobleného vnitřku (corner_r 5), takže náběh má 45° všude.
Díra pro vložku zasahovala 1,1 mm do drážky těsnění: drážka 2,5 mm
o 0,5 blíž k vnitřku, příruba 12 mm, šrouby na `screw_off` (1,35 mm od
drážky). Příruba 5 mm místo 6 (míň plastu nahoře). Díra PG11 19,0 mm,
tištěná vychází menší než závit 18,6.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Recorder nikdy nefungoval: handler byl patch v utility/debug.cpp
frameworku, jenže jádro se linkuje jako archiv a weak HardFault_Handler
ze startupu už vektor pokrývá, takže debug.o se do žádného buildu
nedostal (nm ukazoval jen W symbol). Záznam navíc ležel na 0x2003FFF0,
kam po resetu sahá zásobník bootloaderu.
Handler je teď silný symbol v NRF52Board.cpp a zapisuje do
g_hardfault_record v .noinit; funguje i s commitnutým pinem frameworku
(lokální patch už není potřeba). Ověřeno na x2: testovací build
s -D BENCH_FAULT_CMD, příkaz hardfault → po resetu
'HARDFAULT before last reboot: PC=00033442' = udf v handleCommand.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Od 72618655 hodiny na nRF52 přežijí warm reset, takže companionu
s hodinami napřed už nepomůže reboot, a CMD_SET_DEVICE_TIME dozadu
neprojde — zbývalo jen odpojit napájení. clkreboot (stejně jako
u repeateru) zahodí retained záznam, nastaví build epoch a rebootne;
lokálně (CMD_RUN_CLI_COMMAND) i vzdáleně pro kontakty s ACL.
Ověřeno na x1: +30 dní → clkreboot → build epoch → čas znovu dopředu.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
VolatileRTCClock ukládá čas do g_retained_clock (sekce .noinit, linker
ji dá hned za .bss) a při prvním čtení po warm resetu ho obnoví; po
power-on (RESETREAS 0) ne. Dřívější pokus 7. 8. na vrcholu RAM selhal,
protože tam sahá zásobník bootloaderu — střed RAM přežije: x1 (XIAO,
companion) nastaven +30 dní, reboot, hodiny zpět +30 dní.
BaseChatMesh::bootstrapRTCfromContacts posouvá hodiny už jen dopředu:
bezpodmínečný set vracel čas pod build epoch a rušil obnovu, která
ještě neproběhla (první test proto vyšel negativně).
Repeater: mrtvý mechanismus s pevnou RETAINED_CLOCK_ADDR nahrazen
výpisem stavu obnovy při bootu; ukládání obstarává tick().
Podle weebl2000/meshcore 9a561fd7.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
PG7 drží RF240, ale SMA konektor jí neprojde. PG11 s vyjmutou a
naříznutou vložkou ano. V hlavičce těsnění silikonem v drážce.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>