DJLight upgrade
* normal mode: similar to 0.13.x version * candy factory mode: produce more brighter colors
This commit is contained in:
@@ -6734,6 +6734,7 @@ uint16_t mode_DJLight(void) { // Written by ??? Adapted by Wil
|
||||
um_data = simulateSound(SEGMENT.soundSim);
|
||||
}
|
||||
uint8_t *fftResult = (uint8_t*)um_data->u_data[2];
|
||||
float volumeSmth = *(float*)um_data->u_data[0];
|
||||
|
||||
if (SEGENV.call == 0) {
|
||||
SEGMENT.setUpLeds();
|
||||
@@ -6744,23 +6745,41 @@ uint16_t mode_DJLight(void) { // Written by ??? Adapted by Wil
|
||||
if (SEGENV.aux0 != secondHand) { // Triggered millis timing.
|
||||
SEGENV.aux0 = secondHand;
|
||||
|
||||
//CRGB color = CRGB(fftResult[15]/2, fftResult[5]/2, fftResult[0]/2); // formula from 0.13.x (10Khz): R = 3880-5120, G=240-340, B=60-100
|
||||
//CRGB color = CRGB(fftResult[12]/2, fftResult[3]/2, fftResult[1]/2); // formula for 0.14.x (22Khz): R = 3015-3704, G=216-301, B=86-129
|
||||
// an attempt to get colors more balanced
|
||||
CRGB color = CRGB(fftResult[11]/2 + fftResult[12]/4 + fftResult[14]/4, // red : 2412-3704 + 4479-7106
|
||||
fftResult[4]/2 + fftResult[3]/4, // green: 216-430
|
||||
fftResult[1]/4 + fftResult[2]/4); // blue: 86-216
|
||||
CRGB color = CRGB(0,0,0);
|
||||
// color = CRGB(fftResult[15]/2, fftResult[5]/2, fftResult[0]/2); // formula from 0.13.x (10Khz): R = 3880-5120, G=240-340, B=60-100
|
||||
if (!SEGENV.check1) {
|
||||
color = CRGB(fftResult[12]/2, fftResult[3]/2, fftResult[1]/2); // formula for 0.14.x (22Khz): R = 3015-3704, G=216-301, B=86-129
|
||||
} else {
|
||||
// candy factory: an attempt to get more colors
|
||||
color = CRGB(fftResult[11]/2 + fftResult[12]/4 + fftResult[14]/4, // red : 2412-3704 + 4479-7106
|
||||
fftResult[4]/2 + fftResult[3]/4, // green: 216-430
|
||||
fftResult[0]/4 + fftResult[1]/4 + fftResult[2]/4); // blue: 46-216
|
||||
if ((color.getLuma() < 96) && (volumeSmth >= 1.5f)) { // enhance "almost dark" pixels with yellow, based on not-yet-used channels
|
||||
unsigned yello_g = (fftResult[5] + fftResult[6] + fftResult[7]) / 3;
|
||||
unsigned yello_r = (fftResult[7] + fftResult[8] + fftResult[9] + fftResult[10]) / 4;
|
||||
color.green += (uint8_t) yello_g / 2;
|
||||
color.red += (uint8_t) yello_r / 2;
|
||||
}
|
||||
}
|
||||
|
||||
if (volumeSmth < 1.0f) color = CRGB(0,0,0); // silence = black
|
||||
|
||||
// make colors less "pastel", by turning up color saturation in HSV space
|
||||
if (color.getLuma() > 32) { // don't change "dark" pixels
|
||||
CHSV hsvColor = rgb2hsv_approximate(color);
|
||||
hsvColor.v = min(max(hsvColor.v, (uint8_t)48), (uint8_t)212); // 48 < brightness < 212
|
||||
hsvColor.s = max(hsvColor.s, (uint8_t)192); // turn up color saturation (> 192)
|
||||
hsvColor.v = min(max(hsvColor.v, (uint8_t)48), (uint8_t)204); // 48 < brightness < 204
|
||||
if (SEGENV.check1)
|
||||
hsvColor.s = max(hsvColor.s, (uint8_t)204); // candy factory mode: strongly turn up color saturation (> 192)
|
||||
else
|
||||
hsvColor.s = max(hsvColor.s, (uint8_t)108); // normal mode: turn up color saturation to avoid pastels
|
||||
color = hsvColor;
|
||||
}
|
||||
//if (color.getLuma() > 12) color.maximizeBrightness(); // for testing
|
||||
|
||||
//SEGMENT.setPixelColor(mid, color.fadeToBlackBy(map(fftResult[4], 0, 255, 255, 4))); // 0.13.x fade -> 180hz-260hz
|
||||
SEGMENT.setPixelColor(mid, color.fadeToBlackBy(map(fftResult[3], 0, 255, 255, 4))); // 0.14.x fade -> 216hz-301hz
|
||||
uint8_t fadeVal = map(fftResult[3], 0, 255, 255, 4); // 0.14.x fade -> 216hz-301hz
|
||||
if (SEGENV.check1) fadeVal = constrain(fadeVal, 0, 176); // "candy factory" mode - avoid complete fade-out
|
||||
SEGMENT.setPixelColor(mid, color.fadeToBlackBy(fadeVal));
|
||||
|
||||
for (int i = SEGLEN - 1; i > mid; i--) SEGMENT.setPixelColor(i, SEGMENT.getPixelColor(i-1)); // move to the left
|
||||
for (int i = 0; i < mid; i++) SEGMENT.setPixelColor(i, SEGMENT.getPixelColor(i+1)); // move to the right
|
||||
@@ -6768,7 +6787,7 @@ uint16_t mode_DJLight(void) { // Written by ??? Adapted by Wil
|
||||
|
||||
return FRAMETIME;
|
||||
} // mode_DJLight()
|
||||
static const char _data_FX_MODE_DJLIGHT[] PROGMEM = "DJ Light@Speed;;;1f;m12=2,si=0"; // Arc, Beatsin
|
||||
static const char _data_FX_MODE_DJLIGHT[] PROGMEM = "DJ Light@Speed,,,,,Candy Factory;;;1f;m12=2,si=0"; // Arc, Beatsin
|
||||
|
||||
|
||||
////////////////////
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
*/
|
||||
|
||||
// version code in format yymmddb (b = daily build)
|
||||
#define VERSION 2303310
|
||||
#define VERSION 2303321
|
||||
|
||||
//uncomment this if you have a "my_config.h" file you'd like to use
|
||||
//#define WLED_USE_MY_CONFIG
|
||||
|
||||
Reference in New Issue
Block a user