Compare commits
9
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
fbbf4a8170 | ||
|
|
8603065de7 | ||
|
|
5a44b5ff52 | ||
|
|
44f7566337 | ||
|
|
bda1c586f1 | ||
|
|
736691cbd2 | ||
|
|
3accaf358d | ||
|
|
e86ed1373b | ||
|
|
b0fd8e6801 |
No files matched your search
@@ -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
@@ -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
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -81,14 +81,26 @@ static File openAppend(FILESYSTEM* _fs, const char* fname) {
|
||||
|
||||
/* --------------------- Cayenne LPP helpers ----------------------------*/
|
||||
|
||||
static const uint8_t* findTelemValueRaw(const uint8_t* buf, uint8_t size, uint8_t channel, uint8_t type) {
|
||||
uint8_t i = 0;
|
||||
|
||||
while (i + 2 < size) {
|
||||
uint8_t ch = buf[i++]; // Get channel #
|
||||
uint8_t t = buf[i++]; // Get data type
|
||||
uint8_t sz = LPPData::getDataSize(t);
|
||||
|
||||
if (ch == channel && t == type) return &buf[i];
|
||||
i += sz; // skip
|
||||
}
|
||||
return NULL; // not found
|
||||
}
|
||||
|
||||
static float findTelemValue(const uint8_t* buf, uint8_t size, uint8_t channel, uint8_t type, float def_value) {
|
||||
uint8_t i = 0;
|
||||
|
||||
while (i + 2 < size) {
|
||||
// Get channel #
|
||||
uint8_t ch = buf[i++];
|
||||
// Get data type
|
||||
uint8_t t = buf[i++];
|
||||
uint8_t ch = buf[i++]; // Get channel #
|
||||
uint8_t t = buf[i++]; // Get data type
|
||||
uint8_t sz = LPPData::getDataSize(t);
|
||||
|
||||
if (ch == channel && t == type) {
|
||||
@@ -101,6 +113,8 @@ static float findTelemValue(const uint8_t* buf, uint8_t size, uint8_t channel, u
|
||||
|
||||
/* ------------------ end Cayenne LPP helpers ----------------------*/
|
||||
|
||||
#include <helpers/GPSLocHelper.h>
|
||||
|
||||
bool SensorMesh::telemHasChanged(ClientInfo* c) {
|
||||
auto buf = telemetry.getBuffer();
|
||||
uint8_t size = telemetry.getSize();
|
||||
@@ -112,11 +126,29 @@ bool SensorMesh::telemHasChanged(ClientInfo* c) {
|
||||
uint8_t t = c->extra.sensor.min_deltas[i + 1]; // Get data type
|
||||
uint8_t sz = LPPData::getDataSize(t);
|
||||
|
||||
float min_delta = LPPData::getFloat(&c->extra.sensor.min_deltas[i + 2], sz, LPPData::getMultiplier(t), LPPData::isSigned(t));
|
||||
float pv = LPPData::getFloat(&c->extra.sensor.prev_telem[i + 2], sz, LPPData::getMultiplier(t), LPPData::isSigned(t));
|
||||
if (t == LPP_GPS) { // special case for movement detection
|
||||
// NOTE: actual min_delta is NOT LPP_GPS but should be a LPP_DISTANCE value (4 byte, unsigned)
|
||||
float min_distance = LPPData::getFloat(&c->extra.sensor.min_deltas[i + 2], LPPData::getDataSize(LPP_DISTANCE), LPPData::getMultiplier(LPP_DISTANCE), false);
|
||||
float prev_lat, prev_lon, _alt;
|
||||
LPPData::readGPS(&c->extra.sensor.prev_telem[i + 2], prev_lat, prev_lon, _alt);
|
||||
float curr_lat, curr_lon;
|
||||
{
|
||||
const uint8_t* curr = findTelemValueRaw(buf, size, ch, t);
|
||||
if (curr) {
|
||||
LPPData::readGPS(curr, curr_lat, curr_lon, _alt);
|
||||
} else {
|
||||
curr_lat = curr_lon = 0.0f;
|
||||
}
|
||||
}
|
||||
float dist = GPSLocHelper::calcGreatArcMeters(prev_lat, prev_lon, curr_lat, curr_lon);
|
||||
if (dist > min_distance) changed = true; // Yes, has Moved!
|
||||
} else {
|
||||
float min_delta = LPPData::getFloat(&c->extra.sensor.min_deltas[i + 2], sz, LPPData::getMultiplier(t), LPPData::isSigned(t));
|
||||
float pv = LPPData::getFloat(&c->extra.sensor.prev_telem[i + 2], sz, LPPData::getMultiplier(t), LPPData::isSigned(t));
|
||||
|
||||
float v = findTelemValue(buf, size, ch, t, 0.0f);
|
||||
if (abs(v - pv) > min_delta) changed = true; // Yes, has changed
|
||||
float v = findTelemValue(buf, size, ch, t, 0.0f);
|
||||
if (abs(v - pv) > min_delta) changed = true; // Yes, has changed
|
||||
}
|
||||
|
||||
i += 2 + sz; // skip
|
||||
}
|
||||
@@ -130,10 +162,17 @@ bool SensorMesh::telemHasChanged(ClientInfo* c) {
|
||||
|
||||
c->extra.sensor.prev_telem[i] = ch;
|
||||
c->extra.sensor.prev_telem[i + 1] = t;
|
||||
|
||||
float v = findTelemValue(buf, size, ch, t, 0.0f);
|
||||
LPPData::putFloat(&c->extra.sensor.prev_telem[i + 2], v, sz, LPPData::getMultiplier(t), LPPData::isSigned(t));
|
||||
|
||||
if (t == LPP_GPS) { // special case for GPS data
|
||||
const uint8_t* v_ptr = findTelemValueRaw(buf, size, ch, t);
|
||||
if (v_ptr) {
|
||||
memcpy(&c->extra.sensor.prev_telem[i + 2], v_ptr, 9); // LPP_GPS format: 3 x 3 byte values
|
||||
} else {
|
||||
memset(&c->extra.sensor.prev_telem[i + 2], 0, 9);
|
||||
}
|
||||
} else {
|
||||
float v = findTelemValue(buf, size, ch, t, 0.0f);
|
||||
LPPData::putFloat(&c->extra.sensor.prev_telem[i + 2], v, sz, LPPData::getMultiplier(t), LPPData::isSigned(t));
|
||||
}
|
||||
i += 2 + sz; // skip
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
#pragma once
|
||||
|
||||
class GPSLocHelper {
|
||||
static constexpr double APPROX_RADIUS = 6371e3; // 6,371 km
|
||||
|
||||
static double toRadians(float degrees) {
|
||||
return degrees * PI / 180;
|
||||
}
|
||||
|
||||
public:
|
||||
static float calcGreatArcMeters(float lat1, float lon1, float lat2, float lon2) {
|
||||
double diffLati = toRadians(lat1 - lat2);
|
||||
double diffLong = toRadians(lon1 - lon2);
|
||||
double radiusStartLati = toRadians(lat2);
|
||||
double radiusEndLati = toRadians(lat1);
|
||||
|
||||
// A and C are the 'sides' from the spherical triangle.
|
||||
double sinLati = sin(diffLati / 2);
|
||||
double sinLong = sin(diffLong / 2);
|
||||
|
||||
double a = sinLati*sinLati + sinLong*sinLong * cos(radiusStartLati) * cos(radiusEndLati);
|
||||
double c = 2 * asin(sqrt(a));
|
||||
|
||||
return APPROX_RADIUS * c;
|
||||
}
|
||||
};
|
||||
@@ -162,6 +162,12 @@ public:
|
||||
return size;
|
||||
}
|
||||
|
||||
static uint8_t readGPS(const uint8_t* _buf, float& lat, float& lon, float& alt) {
|
||||
lat = getFloat(&_buf[0], 3, 10000, true);
|
||||
lon = getFloat(&_buf[3], 3, 10000, true);
|
||||
alt = getFloat(&_buf[6], 3, 100, true);
|
||||
return 9;
|
||||
}
|
||||
};
|
||||
|
||||
class LPPReader {
|
||||
|
||||
@@ -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));
|
||||
}
|
||||
|
||||
@@ -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));
|
||||
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user