Skip to content

Commit 9cb3877

Browse files
Copilotdorkmo
andcommitted
Add validation for pulsesPerRevolution in config update
Co-authored-by: dorkmo <[email protected]>
1 parent 5e163a8 commit 9cb3877

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

TankAlarm-112025-Client-BluesOpta/TankAlarm-112025-Client-BluesOpta.ino

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -989,7 +989,7 @@ static void applyConfigUpdate(const JsonDocument &doc) {
989989
gConfig.tanks[i].currentLoopChannel = t["loopChannel"].is<int>() ? t["loopChannel"].as<int>() : gConfig.tanks[i].currentLoopChannel;
990990
gConfig.tanks[i].rpmPin = t["rpmPin"].is<int>() ? t["rpmPin"].as<int>() : gConfig.tanks[i].rpmPin;
991991
if (t.containsKey("pulsesPerRev")) {
992-
gConfig.tanks[i].pulsesPerRevolution = t["pulsesPerRev"].as<uint8_t>();
992+
gConfig.tanks[i].pulsesPerRevolution = max((uint8_t)1, t["pulsesPerRev"].as<uint8_t>());
993993
}
994994
// Support both old field name (heightInches) and new (maxValue)
995995
if (t.containsKey("maxValue")) {

0 commit comments

Comments
 (0)