sensor/budka: drobnosti z review před zveřejněním

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
tthandClaude Opus 5.5 committed 2026-10-13 02:56:56 +02:00
1 parent 513b77a8a8
commit d288425ebf
2 files changed
+22 -8

No files matched your search

+13 -5
View File
@@ -75,9 +75,13 @@ void BudkaLinkSensorManager::handleLine() {
else if (!strcmp(k, "h")) dst = &h;
else if (!strcmp(k, "p")) dst = &p;
else if (!strcmp(k, "mot")) {
mot = strtoul(v, NULL, 10);
mot_valid = true;
mot_at = now;
char* end;
unsigned long m = strtoul(v, &end, 10);
if (end != v) {
mot = m;
mot_valid = true;
mot_at = now;
}
} else {
// Meter fields: v<k> i<k> w<k> wh<k>, k = 1..BUDKA_LINK_METERS.
size_t kl = strlen(k);
@@ -90,8 +94,12 @@ void BudkaLinkSensorManager::handleLine() {
}
}
if (dst) {
dst->v = strtof(v, NULL);
dst->at = now;
char* end;
float f = strtof(v, &end);
if (end != v) { // "v1=" with no number is not a reading
dst->v = f;
dst->at = now;
}
}
}
last_line_ms = now;