Compare commits

..
Author SHA1 Message Date
upstream-sync-bot 5a44b5ff52 Merge upstream/dev (3 commits) [upstream-sync]
pub-release / release (push) Successful in 41m13s
2026-11-28 05:05:09 +00:00
tthandClaude Opus 5.5 44f7566337 Docs: nRF52 sleep fixes re-measured at 3.3 V — CC310 insomnia +3.3 mA, DC/DC worth 0.6 mA
Changelog: -
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-28 02:42:26 +01:00
Liam Cottle bda1c586f1 Merge pull request #3945 from MarkRose/fix/contact-name-nul
Terminate contact names received from the companion app 🤖🤖
2026-11-28 10:29:02 +13:00
tthandClaude Opus 5.5 736691cbd2 CI: pub-release finds the previous release by its tag, not the stored target commit
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-27 19:21:33 +01:00
Mark RoseandClaude Opus 5.5 3accaf358d Bound the contact name copy into the UI recent list
addToRecents() in the new and tiny companion UIs strcpy()s the contact
name into a 32-byte field. Names are terminated on receipt now, but use
a bounded copy here as well, like the other name copies in the UIs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-27 00:23:50 -06:00
Mark RoseandClaude Opus 5.5 e86ed1373b Terminate contact names received from the app
updateContactFromFrame() copies 32 name bytes from the companion frame
without terminating them, so an app (or a corrupt frame) can store a name
with no NUL. The UI then passes it to sprintf() into fixed-size origin
buffers. Terminate the name on receipt and use snprintf() in both UIs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-26 00:02:20 -06:00
6 changed files with 62 additions and 13 deletions

No files matched your search

+5
View File
@@ -322,6 +322,11 @@ jobs:
# changelog against the newest older release that HEAD descends from
prev="" base=""
while read -r t c; do
# the tag, not the release's target_commitish: Gitea keeps the
# commitish from creation, and after a rewrite of the public
# history (26. 11. 2026) it named commits no longer in it -- no
# base was found and the notes listed the last 20 commits
c=$(git rev-parse -q --verify "refs/tags/$t^{commit}" 2>/dev/null || echo "$c")
if [ "$c" != "$SHA" ] && git merge-base --is-ancestor "$c" "$SHA" 2>/dev/null; then
prev=$t base=$c
break
+48 -5
View File
@@ -254,14 +254,57 @@ connects to over BLE stays in it. Toggling the clear at runtime
on an already clean node changes nothing (+0.01 / +0.02 mA), because the state
is decided at boot.
**The same run again at 3.3 V without VBUS (27. 11. 2026).** Here x4 is fed on
its 3V3 pin at 3.25 V, so `bench duty` reads `vbus 0 usbd 0` and HFXO is
off. This is the closer match to a node on a cell. The setup was the same:
38 cells, two rounds, all of them valid. Baseline repeatability (detrended SD of
the base cells) was **0.009 / 0.015 mA**, so the threshold here is 0.03 mA.
The baseline is **6.90 mA** (22 mW, against 57 mW on the 5 V pin).
| boot with | before first BLE connection | after it |
|---|---|---|
| both fixes | 6.91 / 6.92 mA | 6.89 / 6.88 mA |
| no CC clear | **10.16 / 10.16 mA** | 6.91 / 6.89 mA |
| no CC clear, no late DC/DC (= old main) | **10.18 / 10.18 mA** | 6.89 / 6.94 mA |
| no late DC/DC | 6.90 / 6.91 mA | 6.93 / 6.92 mA |
The CC310 insomnia costs **+3.3 mA, almost half of the whole node**. Every
sample of those windows sits above 8.5 mA. The core wakes 14 900 times a
second, against 986, it is awake 79 % of the time, and `cc_pend` reads 1.
At this voltage **DC/DC is worth 0.6 mA**. `bench dcdc off` at runtime gives
+0.63 / +0.60 mA, and `A_like` (DC/DC off, CC clear off, nfcal 2 s) gives
+0.59 / +0.61 mA, the same thing. On the 5 V pin the same switch was below
resolution. The late re-enable still changes nothing, because `DCDCEN` reads 1
after every boot with or without it. So the regulator mode matters, and
SoftDevice simply does not turn it off.
| knob (3.3 V) | round 1 | round 2 |
|---|---|---|
| `bench dcdc off` | +0.63 mA | +0.60 mA |
| `bench cc off` (runtime) | +0.00 mA | −0.01 mA |
| `bench nfcal 2000` | −0.04 mA (one pair) | |
| `set radio.rxps max` | −2.30 mA | −2.30 mA |
| `set radio.rxps balanced` | −1.98 mA | −1.82 mA |
| `set radio.rxgain off` | −0.45 mA | −0.51 mA |
| `powersaving off` | +2.37 mA (one pair) | |
The rxps, rxgain and powersaving deltas match the 5 V run to within 0.3 mA.
In relative terms, rxps max now takes a third off the node. Reception from the
x1 witness matched what it sent in every cell (base 82 received for 72 sent;
x4 also hears other bench traffic). The witness again only detects a gross
loss, not a sensitivity loss.
**Measured to make no difference, kept anyway** (each below 0.1 mA):
- **DC/DC re-enabled after SoftDevice start** (`onBootComplete()`):
+0.02 / −0.10 mA at runtime, and no difference as a boot flag. The premise
that S140 puts `NRF_POWER` back to LDO did not hold on this board.
`DCDCEN` read 1 after every boot, with or without the late enable. The
late enable is kept as a harmless safeguard.
+0.02 / −0.10 mA at runtime on the 5 V pin, and no difference as a boot flag
at either voltage. The premise that S140 puts `NRF_POWER` back to LDO did not
hold on this board. `DCDCEN` read 1 after every boot, with or without the
late enable. The late enable is kept as a harmless safeguard. DC/DC itself
does matter at 3.3 V (see above).
- **Noise-floor calibration every 10 s instead of 2 s**
(`NOISE_FLOOR_CALIB_INTERVAL`): +0.08 mA, one pair.
(`NOISE_FLOOR_CALIB_INTERVAL`): +0.08 mA at 5 V and −0.04 mA at 3.3 V, one
pair each. That is at the edge of resolution and of no practical weight.
**Not measured** (compile-time or other hardware):
- **Avoid `NRF_SPIM3` (Nordic Errata 195)**: `[nrf52_base]` sets
+1
View File
@@ -203,6 +203,7 @@ void MyMesh::updateContactFromFrame(ContactInfo &contact, uint32_t& last_mod, co
memcpy(contact.out_path, &frame[i], MAX_PATH_SIZE);
i += MAX_PATH_SIZE;
memcpy(contact.name, &frame[i], 32);
contact.name[sizeof(contact.name) - 1] = 0; // the app is not trusted to NUL-terminate
i += 32;
memcpy(&contact.last_advert_timestamp, &frame[i], 4);
i += 4;
+3 -3
View File
@@ -264,7 +264,7 @@ public:
auto p = &recent[recent_next_idx];
recent_next_idx = (recent_next_idx + 1) % UI_RECENT_LIST_SIZE;
strcpy(p->name, contact.name);
StrHelper::strncpy(p->name, contact.name, sizeof(p->name));
p->recv_timestamp = _rtc->getCurrentTime();
}
@@ -741,9 +741,9 @@ public:
auto p = &unread[head];
p->timestamp = _rtc->getCurrentTime();
if (path_count == 0xFF) {
sprintf(p->origin, "(D) %s:", from_name);
snprintf(p->origin, sizeof(p->origin), "(D) %s:", from_name);
} else {
sprintf(p->origin, "(%d) %s:", (uint32_t) path_count, from_name);
snprintf(p->origin, sizeof(p->origin), "(%d) %s:", (uint32_t) path_count, from_name);
}
StrHelper::strncpy(p->msg, msg, sizeof(p->msg));
}
+4 -4
View File
@@ -155,9 +155,9 @@ void UITask::onMessageRecv(mesh::Packet *pkt, const ContactInfo &from, uint8_t t
uint8_t path_len = pkt->isRouteFlood() ? pkt->path_len : 0xFF;
if (path_len == 0xFF) {
sprintf(_origin, "(F) %s", from.name);
snprintf(_origin, sizeof(_origin), "(F) %s", from.name);
} else {
sprintf(_origin, "(%d) %s", (uint32_t) path_len, from.name);
snprintf(_origin, sizeof(_origin), "(%d) %s", (uint32_t) path_len, from.name);
}
StrHelper::strncpy(_msg, text, sizeof(_msg));
@@ -182,9 +182,9 @@ void UITask::onChannelMessageRecv(mesh::Packet *pkt, ChannelDetails& channel_det
uint8_t path_len = pkt->isRouteFlood() ? pkt->path_len : 0xFF;
if (path_len == 0xFF) {
sprintf(_origin, "(F) %s", channel_details.name);
snprintf(_origin, sizeof(_origin), "(F) %s", channel_details.name);
} else {
sprintf(_origin, "(%d) %s", (uint32_t) path_len, channel_details.name);
snprintf(_origin, sizeof(_origin), "(%d) %s", (uint32_t) path_len, channel_details.name);
}
StrHelper::strncpy(_msg, text, sizeof(_msg));
+1 -1
View File
@@ -159,7 +159,7 @@ public:
auto p = &recent[recent_next_idx];
recent_next_idx = (recent_next_idx + 1) % UI_RECENT_LIST_SIZE;
strcpy(p->name, contact.name);
StrHelper::strncpy(p->name, contact.name, sizeof(p->name));
p->recv_timestamp = _rtc->getCurrentTime();
}