mirror of
https://github.com/Laxilef/OTGateway.git
synced 2026-11-23 14:53:07 +05:00
fix: correct threshold names across firmware and portal
Use threshold_time for the emergency-mode delay in settings, JSON, portal forms and all five translations. Convert legacy tresholdTime backup fields to threshold_time. Correct the NTC voltage threshold macro names while keeping their limits.
This commit is contained in:
1 parent
d6e1ccb22b
commit
eb5f6c9b46
13 files changed
+20
-21
No files matched your search
+5
-5
@@ -1266,7 +1266,7 @@ static SettingResult applySetting(EmergencySettings& dst, std::string_view path,
|
||||
JsonVariant toJson(const EmergencySettings& src, JsonVariant dst) {
|
||||
auto emergency = dst.to<JsonObject>();
|
||||
emergency[S_TARGET] = roundf(convertTemp(src.target, UnitSystem::METRIC, settings.system.unitSystem), 2);
|
||||
emergency[S_TRESHOLD_TIME] = src.tresholdTime;
|
||||
emergency[S_THRESHOLD_TIME] = src.thresholdTime;
|
||||
|
||||
return dst;
|
||||
}
|
||||
@@ -1274,13 +1274,13 @@ JsonVariant toJson(const EmergencySettings& src, JsonVariant dst) {
|
||||
SettingResult fromJson(JsonVariantConst src, EmergencySettings& dst) {
|
||||
SettingResult result;
|
||||
|
||||
if (src[S_TRESHOLD_TIME].is<unsigned short>()) {
|
||||
const auto value = src[S_TRESHOLD_TIME].as<unsigned short>();
|
||||
if (src[S_THRESHOLD_TIME].is<unsigned short>()) {
|
||||
const auto value = src[S_THRESHOLD_TIME].as<unsigned short>();
|
||||
|
||||
if (value >= 60 && value <= 1800) {
|
||||
result.accepted = true;
|
||||
if (value != dst.tresholdTime) {
|
||||
dst.tresholdTime = value;
|
||||
if (value != dst.thresholdTime) {
|
||||
dst.thresholdTime = value;
|
||||
result.changed = true;
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -113,7 +113,7 @@ static Task emergencyTask("Emergency mode", [](void*) {
|
||||
|
||||
} else if (emergencyDetected && !vars.emergency.state) {
|
||||
// enable emergency
|
||||
if (millis() - emergencyFlipTime > (settings.emergency.tresholdTime * 1000)) {
|
||||
if (millis() - emergencyFlipTime > (settings.emergency.thresholdTime * 1000)) {
|
||||
vars.emergency.state = true;
|
||||
ESP_LOGI(L_MAIN, "Emergency mode enabled (%hhu)", emergencyFlags);
|
||||
}
|
||||
@@ -127,7 +127,7 @@ static Task emergencyTask("Emergency mode", [](void*) {
|
||||
|
||||
} else if (!emergencyDetected && vars.emergency.state) {
|
||||
// disable emergency
|
||||
if (millis() - emergencyFlipTime > (settings.emergency.tresholdTime * 1000)) {
|
||||
if (millis() - emergencyFlipTime > (settings.emergency.thresholdTime * 1000)) {
|
||||
vars.emergency.state = false;
|
||||
ESP_LOGI(L_MAIN, "Emergency mode disabled");
|
||||
}
|
||||
|
||||
+1
-1
@@ -893,7 +893,7 @@ static Task readNtcSensorsTask("Read NTC sensors", [](void*) {
|
||||
}
|
||||
|
||||
const auto value = analogReadMilliVolts(sSensor->gpio);
|
||||
if (value < DEFAULT_NTC_VLOW_TRESHOLD || value > DEFAULT_NTC_VHIGH_TRESHOLD) {
|
||||
if (value < DEFAULT_NTC_VLOW_THRESHOLD || value > DEFAULT_NTC_VHIGH_THRESHOLD) {
|
||||
Sensors::setConnectionStatusById(sensorId, false, false);
|
||||
|
||||
ESP_LOGW(
|
||||
|
||||
Reference in new issue
Block a user