From 0acca2e313e5b48de4f02a8fc3ba67909ce9f4e8 Mon Sep 17 00:00:00 2001 From: Blaz Kristan Date: Fri, 22 Oct 2021 23:24:41 +0200 Subject: [PATCH] Cycling bugfix. --- wled00/set.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/wled00/set.cpp b/wled00/set.cpp index 262cc10e4..757ae7951 100644 --- a/wled00/set.cpp +++ b/wled00/set.cpp @@ -530,9 +530,9 @@ bool updateVal(const String* req, const char* key, byte* val, byte minv, byte ma if (out == 0) { 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 { - *val = min((int)maxv, max((int)minv, (int)(*val +1))); + *val = (int)(*val +1) > (int)maxv ? minv : max((int)minv,(*val +1)); } } else { out += *val;