Merge branch 'main' into 0_15
This commit is contained in:
@@ -51,7 +51,7 @@ uint16_t triwave16(uint16_t in) {
|
||||
* Generates a tristate square wave w/ attac & decay
|
||||
* @param x input value 0-255
|
||||
* @param pulsewidth 0-127
|
||||
* @param attdec attac & decay, max. pulsewidth / 2
|
||||
* @param attdec attack & decay, max. pulsewidth / 2
|
||||
* @returns signed waveform value
|
||||
*/
|
||||
int8_t tristate_square8(uint8_t x, uint8_t pulsewidth, uint8_t attdec) {
|
||||
@@ -1239,7 +1239,7 @@ uint16_t mode_fireworks() {
|
||||
if (SEGMENT.is2D()) SEGMENT.setPixelColorXY(x, y, col);
|
||||
else SEGMENT.setPixelColor(index, col);
|
||||
SEGENV.aux1 = SEGENV.aux0; // old spark
|
||||
SEGENV.aux0 = index; // remember where spark occured
|
||||
SEGENV.aux0 = index; // remember where spark occurred
|
||||
}
|
||||
}
|
||||
return FRAMETIME;
|
||||
@@ -1272,8 +1272,8 @@ uint16_t mode_rain() {
|
||||
SEGENV.aux0++; // increase spark index
|
||||
SEGENV.aux1++;
|
||||
}
|
||||
if (SEGENV.aux0 == 0) SEGENV.aux0 = UINT16_MAX; // reset previous spark positiom
|
||||
if (SEGENV.aux1 == 0) SEGENV.aux0 = UINT16_MAX; // reset previous spark positiom
|
||||
if (SEGENV.aux0 == 0) SEGENV.aux0 = UINT16_MAX; // reset previous spark position
|
||||
if (SEGENV.aux1 == 0) SEGENV.aux0 = UINT16_MAX; // reset previous spark position
|
||||
if (SEGENV.aux0 >= width*height) SEGENV.aux0 = 0; // ignore
|
||||
if (SEGENV.aux1 >= width*height) SEGENV.aux1 = 0;
|
||||
}
|
||||
@@ -3777,7 +3777,7 @@ uint16_t mode_tetrix(void) {
|
||||
}
|
||||
|
||||
if (drop->step == 0) { // init brick
|
||||
// speed calcualtion: a single brick should reach bottom of strip in X seconds
|
||||
// speed calculation: a single brick should reach bottom of strip in X seconds
|
||||
// if the speed is set to 1 this should take 5s and at 255 it should take 0.25s
|
||||
// as this is dependant on SEGLEN it should be taken into account and the fact that effect runs every FRAMETIME s
|
||||
int speed = SEGMENT.speed ? SEGMENT.speed : random8(1,255);
|
||||
@@ -3860,7 +3860,7 @@ static const char _data_FX_MODE_PLASMA[] PROGMEM = "Plasma@Phase,!;!;!";
|
||||
|
||||
/*
|
||||
* Percentage display
|
||||
* Intesity values from 0-100 turn on the leds.
|
||||
* Intensity values from 0-100 turn on the leds.
|
||||
*/
|
||||
uint16_t mode_percent(void) {
|
||||
|
||||
@@ -3913,7 +3913,7 @@ static const char _data_FX_MODE_PERCENT[] PROGMEM = "Percent@,% of fill,,,,One c
|
||||
|
||||
/*
|
||||
* Modulates the brightness similar to a heartbeat
|
||||
* (unimplemented?) tries to draw an ECG aproximation on a 2D matrix
|
||||
* (unimplemented?) tries to draw an ECG approximation on a 2D matrix
|
||||
*/
|
||||
uint16_t mode_heartbeat(void) {
|
||||
uint8_t bpm = 40 + (SEGMENT.speed >> 3);
|
||||
@@ -4593,7 +4593,7 @@ uint16_t mode_tv_simulator(void) {
|
||||
// how much time is elapsed ?
|
||||
tvSimulator->elapsed = strip.now - tvSimulator->startTime;
|
||||
|
||||
// fade from prev volor to next color
|
||||
// fade from prev color to next color
|
||||
if (tvSimulator->elapsed < tvSimulator->fadeTime) {
|
||||
r = map(tvSimulator->elapsed, 0, tvSimulator->fadeTime, tvSimulator->pr, nr);
|
||||
g = map(tvSimulator->elapsed, 0, tvSimulator->fadeTime, tvSimulator->pg, ng);
|
||||
@@ -6498,7 +6498,7 @@ uint16_t mode_gravcenter(void) { // Gravcenter. By Andrew Tuline.
|
||||
SEGMENT.fade_out(251); // 30%
|
||||
|
||||
float segmentSampleAvg = volumeSmth * (float)SEGMENT.intensity / 255.0f;
|
||||
segmentSampleAvg *= 0.125; // divide by 8, to compensate for later "sensitivty" upscaling
|
||||
segmentSampleAvg *= 0.125; // divide by 8, to compensate for later "sensitivity" upscaling
|
||||
|
||||
float mySampleAvg = mapf(segmentSampleAvg*2.0, 0, 32, 0, (float)SEGLEN/2.0f); // map to pixels available in current segment
|
||||
uint16_t tempsamp = constrain(mySampleAvg, 0, SEGLEN/2); // Keep the sample from overflowing.
|
||||
@@ -6550,7 +6550,7 @@ uint16_t mode_gravcentric(void) { // Gravcentric. By Andrew
|
||||
SEGMENT.fade_out(253); // 50%
|
||||
|
||||
float segmentSampleAvg = volumeSmth * (float)SEGMENT.intensity / 255.0f;
|
||||
segmentSampleAvg *= 0.125f; // divide by 8, to compensate for later "sensitivty" upscaling
|
||||
segmentSampleAvg *= 0.125f; // divide by 8, to compensate for later "sensitivity" upscaling
|
||||
|
||||
float mySampleAvg = mapf(segmentSampleAvg*2.0, 0.0f, 32.0f, 0.0f, (float)SEGLEN/2.0f); // map to pixels availeable in current segment
|
||||
int tempsamp = constrain(mySampleAvg, 0, SEGLEN/2); // Keep the sample from overflowing.
|
||||
@@ -6599,7 +6599,7 @@ uint16_t mode_gravimeter(void) { // Gravmeter. By Andrew Tuline.
|
||||
SEGMENT.fade_out(249); // 25%
|
||||
|
||||
float segmentSampleAvg = volumeSmth * (float)SEGMENT.intensity / 255.0;
|
||||
segmentSampleAvg *= 0.25; // divide by 4, to compensate for later "sensitivty" upscaling
|
||||
segmentSampleAvg *= 0.25; // divide by 4, to compensate for later "sensitivity" upscaling
|
||||
|
||||
float mySampleAvg = mapf(segmentSampleAvg*2.0, 0, 64, 0, (SEGLEN-1)); // map to pixels availeable in current segment
|
||||
int tempsamp = constrain(mySampleAvg,0,SEGLEN-1); // Keep the sample from overflowing.
|
||||
@@ -6699,7 +6699,7 @@ uint16_t mode_midnoise(void) { // Midnoise. By Andrew Tuline.
|
||||
SEGMENT.fade_out(SEGMENT.speed);
|
||||
|
||||
float tmpSound2 = volumeSmth * (float)SEGMENT.intensity / 256.0; // Too sensitive.
|
||||
tmpSound2 *= (float)SEGMENT.intensity / 128.0; // Reduce sensitity/length.
|
||||
tmpSound2 *= (float)SEGMENT.intensity / 128.0; // Reduce sensitivity/length.
|
||||
|
||||
int maxLen = mapf(tmpSound2, 0, 127, 0, SEGLEN/2);
|
||||
if (maxLen >SEGLEN/2) maxLen = SEGLEN/2;
|
||||
@@ -7110,7 +7110,7 @@ uint16_t mode_freqmatrix(void) { // Freqmatrix. By Andreas Plesch
|
||||
|
||||
if (FFT_MajorPeak > MAX_FREQUENCY) FFT_MajorPeak = 1;
|
||||
// MajorPeak holds the freq. value which is most abundant in the last sample.
|
||||
// With our sampling rate of 10240Hz we have a usable freq range from roughtly 80Hz to 10240/2 Hz
|
||||
// With our sampling rate of 10240Hz we have a usable freq range from roughly 80Hz to 10240/2 Hz
|
||||
// we will treat everything with less than 65Hz as 0
|
||||
|
||||
if (FFT_MajorPeak < 80) {
|
||||
@@ -7131,7 +7131,7 @@ uint16_t mode_freqmatrix(void) { // Freqmatrix. By Andreas Plesch
|
||||
|
||||
return FRAMETIME;
|
||||
} // mode_freqmatrix()
|
||||
static const char _data_FX_MODE_FREQMATRIX[] PROGMEM = "Freqmatrix@Speed,Sound effect,Low bin,High bin,Sensivity;;;1f;m12=3,si=0"; // Corner, Beatsin
|
||||
static const char _data_FX_MODE_FREQMATRIX[] PROGMEM = "Freqmatrix@Speed,Sound effect,Low bin,High bin,Sensitivity;;;1f;m12=3,si=0"; // Corner, Beatsin
|
||||
|
||||
|
||||
//////////////////////
|
||||
@@ -7215,7 +7215,7 @@ uint16_t mode_freqwave(void) { // Freqwave. By Andreas Pleschun
|
||||
|
||||
if (FFT_MajorPeak > MAX_FREQUENCY) FFT_MajorPeak = 1.0f;
|
||||
// MajorPeak holds the freq. value which is most abundant in the last sample.
|
||||
// With our sampling rate of 10240Hz we have a usable freq range from roughtly 80Hz to 10240/2 Hz
|
||||
// With our sampling rate of 10240Hz we have a usable freq range from roughly 80Hz to 10240/2 Hz
|
||||
// we will treat everything with less than 65Hz as 0
|
||||
|
||||
if (FFT_MajorPeak < 80) {
|
||||
@@ -7262,7 +7262,7 @@ uint16_t mode_gravfreq(void) { // Gravfreq. By Andrew Tuline.
|
||||
SEGMENT.fade_out(250);
|
||||
|
||||
float segmentSampleAvg = volumeSmth * (float)SEGMENT.intensity / 255.0f;
|
||||
segmentSampleAvg *= 0.125f; // divide by 8, to compensate for later "sensitivty" upscaling
|
||||
segmentSampleAvg *= 0.125f; // divide by 8, to compensate for later "sensitivity" upscaling
|
||||
|
||||
float mySampleAvg = mapf(segmentSampleAvg*2.0f, 0,32, 0, (float)SEGLEN/2.0f); // map to pixels availeable in current segment
|
||||
int tempsamp = constrain(mySampleAvg,0,SEGLEN/2); // Keep the sample from overflowing.
|
||||
@@ -7290,7 +7290,7 @@ uint16_t mode_gravfreq(void) { // Gravfreq. By Andrew Tuline.
|
||||
|
||||
return FRAMETIME;
|
||||
} // mode_gravfreq()
|
||||
static const char _data_FX_MODE_GRAVFREQ[] PROGMEM = "Gravfreq@Rate of fall,Sensivity;!,!;!;1f;ix=128,m12=0,si=0"; // Pixels, Beatsin
|
||||
static const char _data_FX_MODE_GRAVFREQ[] PROGMEM = "Gravfreq@Rate of fall,Sensitivity;!,!;!;1f;ix=128,m12=0,si=0"; // Pixels, Beatsin
|
||||
|
||||
|
||||
//////////////////////
|
||||
@@ -7882,7 +7882,7 @@ static const char _data_FX_MODE_2DWAVINGCELL[] PROGMEM = "Waving Cell@!,,Amplitu
|
||||
static const char _data_RESERVED[] PROGMEM = "RSVD";
|
||||
|
||||
// add (or replace reserved) effect mode and data into vector
|
||||
// use id==255 to find unallocatd gaps (with "Reserved" data string)
|
||||
// use id==255 to find unallocated gaps (with "Reserved" data string)
|
||||
// if vector size() is smaller than id (single) data is appended at the end (regardless of id)
|
||||
void WS2812FX::addEffect(uint8_t id, mode_ptr mode_fn, const char *mode_name) {
|
||||
if (id == 255) { // find empty slot
|
||||
|
||||
Reference in New Issue
Block a user