|
27 | 27 | #define LED_VOLUME_INDICATOR_RETURN_DELAY 1000U |
28 | 28 | #define LED_VOLUME_INDICATOR_NUM_CYCLES (LED_VOLUME_INDICATOR_RETURN_DELAY / 20) |
29 | 29 |
|
30 | | -extern t_button gButtons[7]; // next + prev + pplay + rotEnc + button4 + button5 + dummy-button |
| 30 | +extern t_button gButtons[8]; // next + prev + pplay + rotEnc + button4 + button5 + button6 + dummy-button |
31 | 31 | extern uint8_t gShutdownButton; |
32 | 32 |
|
33 | 33 | static std::atomic<uint32_t> Led_Indicators = 0u; |
@@ -108,15 +108,19 @@ bool Led_LoadSettings(LedSettings &settings) { |
108 | 108 | settings.numIdleDots = 4; |
109 | 109 | } |
110 | 110 |
|
| 111 | + // Get the idle color from NVS |
| 112 | + settings.idleColor = gPrefsSettings.getUInt("idleColor", IDLE_COLOR); |
| 113 | + |
111 | 114 | // Get offset LED pause from NVS |
112 | 115 | settings.offsetLedPause = gPrefsSettings.getBool("offsetPause", OFFSET_PAUSE_LEDS); |
113 | 116 |
|
114 | 117 | // get dimmableStates from NVS |
115 | 118 | settings.dimmableStates = gPrefsSettings.getUChar("dimStates", DIMMABLE_STATES); |
116 | 119 |
|
117 | | - // get hue start/end from NVS |
118 | | - settings.progressHueStart = gPrefsSettings.getShort("hueStart", PROGRESS_HUE_START); |
119 | | - settings.progressHueEnd = gPrefsSettings.getShort("hueEnd", PROGRESS_HUE_END); |
| 120 | + // get progress colors from NVS |
| 121 | + settings.progressColorStart = gPrefsSettings.getUInt("progColorStart", PROGRESS_COLOR_START); |
| 122 | + settings.progressColorEnd = gPrefsSettings.getUInt("progColorEnd", PROGRESS_COLOR_END); |
| 123 | + |
120 | 124 | // get atmo light from NVS |
121 | 125 | settings.atmoHue = gPrefsSettings.getShort("hueAtmo", ATMO_HUE); |
122 | 126 | settings.atmoSaturation = gPrefsSettings.getShort("satAtmo", ATMO_SATURATION); |
@@ -369,7 +373,7 @@ CRGB::HTMLColorCode Led_GetIdleColor() { |
369 | 373 | } else { |
370 | 374 | idleColor = CRGB::Green; |
371 | 375 | if (Wlan_IsConnected()) { |
372 | | - idleColor = CRGB::White; |
| 376 | + idleColor = (CRGB::HTMLColorCode)gLedSettings.idleColor; |
373 | 377 | } |
374 | 378 | } |
375 | 379 | } |
@@ -1037,23 +1041,23 @@ AnimationReturnType Animation_Progress(const bool startNewAnimation, CRGBSet &le |
1037 | 1041 | lastPos = gPlayProperties.currentRelPos; |
1038 | 1042 | leds = CRGB::Black; |
1039 | 1043 | if (gLedSettings.numIndicatorLeds == 1) { |
1040 | | - leds[0].setHue((uint8_t) (85 - ((double) 90 / 100) * gPlayProperties.currentRelPos)); |
| 1044 | + leds[0] = blend((CRGB)gLedSettings.progressColorStart, (CRGB)gLedSettings.progressColorEnd, (uint8_t)(gPlayProperties.currentRelPos * 255 / 100)); |
1041 | 1045 | } else { |
1042 | 1046 | const uint32_t ledValue = std::clamp<uint32_t>(map(gPlayProperties.currentRelPos, 0, 98, 0, leds.size() * gLedSettings.dimmableStates), 0, leds.size() * gLedSettings.dimmableStates); |
1043 | 1047 | const uint8_t fullLeds = ledValue / gLedSettings.dimmableStates; |
1044 | 1048 | const uint8_t lastLed = ledValue % gLedSettings.dimmableStates; |
1045 | 1049 | for (uint8_t led = 0; led < fullLeds; led++) { |
1046 | 1050 | if (System_AreControlsLocked()) { |
1047 | 1051 | leds[Led_Address(led)] = CRGB::Red; |
1048 | | - } else if (!gPlayProperties.pausePlay) { // Hue-rainbow |
1049 | | - leds[Led_Address(led)].setHue((uint8_t) (((float) gLedSettings.progressHueEnd - (float) gLedSettings.progressHueStart) / (leds.size() - 1) * led + gLedSettings.progressHueStart)); |
| 1052 | + } else if (!gPlayProperties.pausePlay) { |
| 1053 | + leds[Led_Address(led)] = blend((CRGB)gLedSettings.progressColorStart, (CRGB)gLedSettings.progressColorEnd, (led * 255) / (leds.size() - 1)); |
1050 | 1054 | } |
1051 | 1055 | } |
1052 | 1056 | if (lastLed > 0) { |
1053 | 1057 | if (System_AreControlsLocked()) { |
1054 | 1058 | leds[Led_Address(fullLeds)] = CRGB::Red; |
1055 | 1059 | } else { |
1056 | | - leds[Led_Address(fullLeds)].setHue((uint8_t) (((float) gLedSettings.progressHueEnd - (float) gLedSettings.progressHueStart) / (leds.size() - 1) * fullLeds + gLedSettings.progressHueStart)); |
| 1060 | + leds[Led_Address(fullLeds)] = blend((CRGB)gLedSettings.progressColorStart, (CRGB)gLedSettings.progressColorEnd, (fullLeds * 255) / (leds.size() - 1)); |
1057 | 1061 | } |
1058 | 1062 | leds[Led_Address(fullLeds)] = Led_DimColor(leds[Led_Address(fullLeds)], lastLed); |
1059 | 1063 | } |
|
0 commit comments