Commit Graph
3 Commits
Author SHA1 Message Date
tthandClaude Opus 5 7c071d1515 fix(companion): bound the build-date copy; fit the version stamp in the frame
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>
2026-08-04 11:43:53 +02:00
tthandClaude Opus 5 0dbaba046c build(version): derive the base version from the upstream tag, not a literal
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>
2026-08-04 11:28:24 +02:00
tthandClaude Opus 5 4759954c58 build: move build_version.py to tools/, so any env can stamp its version
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>
2026-08-04 10:59:48 +02:00