room-server-v1.17.0 won describe, and find("v") landed inside "server" --
so every board built tonight would have called itself ver-v1.17.0-tth56e1.
Earlier upstream tags (companion-, repeater-) have no 'v' in the prefix, which
is why this only surfaced now.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
`git describe --match '*v[0-9]*'` happily matched
backup/feat-ble-diag-pre-v117-merge -- the safety tag written minutes earlier --
and being the newest tag it won the base version. The T1000-E flashed tonight
therefore reports 'v117-merge-tth7c50c': the sha is right, the base is a tag
name. A pre-flight safety tag must never name the firmware it was protecting.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Measured 7. 8. 2026: bench-board had been running 811 days behind since it was
deployed, and every board on the bench was 812 days behind. Nobody had ever
set their clocks, because setting one was a manual step documented in two
places and performed in neither.
That is not cosmetic. Mesh.cpp stamps every advert a node transmits from the
RTC, and a receiver drops a stale timestamp as a replay -- so a wrong clock
turns into replies that vanish.
Nothing could fix it by itself. The only automatic sources in the tree are GPS
(which these nodes do not have) and BaseChatMesh, which the repeater build does
not link; and `clock sync` cannot work from the console at all, because USB and
BLE share one command buffer and pass sender_timestamp = 0, so the
`sender_timestamp > curr` guard is never satisfied.
So build_version.py now also stamps FIRMWARE_BUILD_EPOCH, and that -- not a
hardcoded 15 May 2024 -- is where a clock with no other source comes up. A
freshly flashed board is right to within "time since compile". It needs no GPS,
nothing carrying a correct time on air, and no host: the one case the host-side
tooling cannot reach. Verified on x1: build epoch 1786100869 = 11:07:49, and
after a reboot the board came up at 11:07:47.
The #ifndef fallback is load-bearing, not decoration: build_version.py is
nRF52-only and reaches 7 of the 16 local envs, so upstream envs never define it.
Verifying an integer define is not `strings` -- dump .text and look for the
word, and check the old literal is gone from all three sites.
`clock` also reports the epoch now. Its human part is minutes only, so a host
comparing clocks could not see a difference under a minute and had to leave a
59 s deadband; appended, so anything that just prints the reply is unaffected.
Also here, and DISABLED, is carrying the clock across a soft reset in retained
RAM. It was tried and measured not to work: the record at 0x2003FFE0 came back
as `00000000 10001000 00000000` after a reboot -- not zeroed, OVERWRITTEN, and
0x10001000 is the nRF52 UICR base, i.e. a UICR pointer left on the Adafruit
bootloader's stack. The bootloader runs before the app on every reset and links
against the full RAM, so it owns the top of it; being outside the app's linker
region is not enough. The code stays because it self-disables against __StackTop
and now says so at boot, and because the same doubt applies to the hardfault
record at 0x2003FFF0, which sits HIGHER -- treat a missing hardfault report as
"unknown", not as "nothing crashed".
Two things that cost a cycle each and are now designed out: the restore's
"nothing stored" branch was silent, which is indistinguishable from "working";
and `clkreboot` would have undone itself, writing the build epoch and then
having the reboot restore the value it just discarded (weak
retainedClockInvalidate() closes that).
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Two halves of the same problem: the stamped version reached the device but
not the client.
RESP_CODE_DEVICE_INFO carries the build date in 12 bytes and the version in
20, NUL included -- 11 and 19 usable characters. The version field is
written with strzcpy() and truncates safely; the build date was a bare
strcpy() into a memset region, so a longer string simply ran past the end
into the manufacturer-name field. It never showed because strzcpy()
overwrote that field on the very next line. Benign today, and driven by a
compile-time constant rather than anything remote, but it is an unbounded
copy into a fixed frame slot and the only reason it was invisible is luck
about the write order. Now strzcpy(..., 12) like every other string there.
The stamp then had to fit. "v1.16.0-tth-0dbaba04" is 20 chars, so the node
reported "v1.16.0-tth-0dbaba0" -- readable, but a character short of the SHA
it was built from. "04 Aug 2026 11:28" is 17, so the time was cut clean off.
Now a 7-char SHA with a "-tth" marker (19 with the dirty '+', 18 without)
and a yymmdd hhmm date (11). The budget never sacrifices the base version or
the dirty marker -- a lost '+' would make an uncommitted build look
reproducible -- and warns instead of truncating silently if it ever cannot
fit.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
build_version.py replaced one hardcoded version with another: it stamped
"v1.16.0-tth-<sha>" with v1.16.0 written into the script. The SHA made the
build identifiable, but the base would have kept claiming v1.16.0 for as
long as nobody remembered to edit this file -- the same stale-by-
construction string the script exists to eliminate.
Now taken from the newest upstream release tag HEAD descends from
(`git describe`, upstream tags them per-example as companion-v1.16.0 /
repeater-v1.16.0, so match any *v[0-9]* and strip the prefix). Our own
release tags carry '+tth.<timestamp>' and are excluded so they cannot
shadow the upstream base.
Also documents the wiring in the header, because the failure mode is
silence: an env that forgets the script builds fine and ships a node that
lies about its own version.
Verified stamping on all nine envs we flash -- T1000E_cmp_cz, the four
XIAO test nodes plus oldble, and the three SenseCap repeaters.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
The script has nothing SenseCap-specific in it -- it reads the git SHA and
the clock -- but it sat under variants/sensecap_solar/ and only that
variant referenced it. Everything else silently shipped the hardcoded
literals from examples/*/MyMesh.h ("v1.16.0", "6 Jun 2026"), identical in
every build.
That cost real time tonight. After a 14-minute BLE DFU onto the T1000-E
tracker, every field the node reports back -- ver, fw_build, model,
max_contacts -- was byte-for-byte what it had said before the flash, so
`ver` could not distinguish the new image from the old one. The only
evidence the image had actually landed was the bootloader's own IMAGE ok /
VALIDATE ok. That is sound evidence, but it lives in a log that scrolls
away, not on the device you can query a month later.
Verified after the move: SenseCap_Solar_repeater_ble, SenseCap_ples_rpt and
T1000E_cmp_cz all stamp v1.16.0-tth-<sha> and a build timestamp.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>