refactor: added different timeouts for wired and wireless sensors

This commit is contained in:
Yurii
2026-01-26 01:03:26 +03:00
parent b70c212235
commit e4d1ba7d7b
3 changed files with 19 additions and 19 deletions

View File

@@ -2109,21 +2109,18 @@ bool jsonToSensorResult(const uint8_t sensorId, const JsonVariantConst src) {
return false;
}
auto& dst = Sensors::results[sensorId];
bool changed = false;
// value
if (!src[FPSTR(S_VALUE)].isNull()) {
float value = src[FPSTR(S_VALUE)].as<float>();
uint8_t vType = static_cast<uint8_t>(Sensors::ValueType::PRIMARY);
if (fabsf(value - dst.values[vType]) > 0.0001f) {
dst.values[vType] = roundf(value, 2);
changed = true;
}
return Sensors::setValueById(
sensorId,
src[FPSTR(S_VALUE)].as<float>(),
Sensors::ValueType::PRIMARY,
true,
true
);
}
return changed;
return false;
}
void varsToJson(const Variables& src, JsonVariant dst) {