Cycling bugfix.

This commit is contained in:
Blaz Kristan 2021-10-22 23:24:41 +02:00
parent 00f1b483eb
commit 0acca2e313

View File

@ -530,9 +530,9 @@ bool updateVal(const String* req, const char* key, byte* val, byte minv, byte ma
if (out == 0) if (out == 0)
{ {
if (req->charAt(pos+4) == '-') { if (req->charAt(pos+4) == '-') {
*val = min((int)maxv, max((int)minv, (int)(*val -1))); *val = (int)(*val -1) < (int)minv ? maxv : min((int)maxv,(*val -1));
} else { } else {
*val = min((int)maxv, max((int)minv, (int)(*val +1))); *val = (int)(*val +1) > (int)maxv ? minv : max((int)minv,(*val +1));
} }
} else { } else {
out += *val; out += *val;