led selection improvement 1

This commit is contained in:
Tropicananass 2021-02-27 01:20:02 +01:00
parent 6685e9742e
commit 2a689371f0

View File

@ -343,16 +343,19 @@ void SetSaturation_execute(int shift) {
void LightOn_execute(int shift) { void LightOn_execute(int shift) {
uint16_t &ledOnCounter = ledRingState.ledRingColorState.ledOnCounter; uint16_t &ledOnCounter = ledRingState.ledRingColorState.ledOnCounter;
static bool clockwise = true;
if (shift > 0) { if ((shift > 0) != !clockwise) {
++ledOnCounter; ++ledOnCounter;
if (ledOnCounter > LedCount) { if (ledOnCounter > LedCount) {
ledOnCounter = 0; ledOnCounter = LedCount;
clockwise = !clockwise;
} }
} else { } else {
--ledOnCounter; --ledOnCounter;
if (ledOnCounter == UINT16_MAX) { if (ledOnCounter == UINT16_MAX) {
ledOnCounter = LedCount; ledOnCounter = 0;
clockwise = !clockwise;
} }
} }