From 2a689371f01ee05715a56f0a29238179fa42fad6 Mon Sep 17 00:00:00 2001 From: Tropicananass Date: Sat, 27 Feb 2021 01:20:02 +0100 Subject: [PATCH] led selection improvement 1 --- src/main.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index e79aeda..5095e04 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -343,16 +343,19 @@ void SetSaturation_execute(int shift) { void LightOn_execute(int shift) { uint16_t &ledOnCounter = ledRingState.ledRingColorState.ledOnCounter; + static bool clockwise = true; - if (shift > 0) { + if ((shift > 0) != !clockwise) { ++ledOnCounter; if (ledOnCounter > LedCount) { - ledOnCounter = 0; + ledOnCounter = LedCount; + clockwise = !clockwise; } } else { --ledOnCounter; if (ledOnCounter == UINT16_MAX) { - ledOnCounter = LedCount; + ledOnCounter = 0; + clockwise = !clockwise; } }