Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WiP -Audio fastpath #40

Merged
merged 114 commits into from
Jul 13, 2023
Merged
Show file tree
Hide file tree
Changes from 9 commits
Commits
Show all changes
114 commits
Select commit Hold shift + click to select a range
fb03a37
fps help in LED settings
softhack007 Apr 30, 2023
40c96c1
a bunch of smaller speedups to core functions
softhack007 Apr 30, 2023
f69142d
optimization for AA setPixelColorXY()
softhack007 Apr 30, 2023
ac5aed8
websocket bugfix from upstream
softhack007 Apr 30, 2023
0c58c12
audio fastpath: reduce filter delay
softhack007 Apr 30, 2023
e1cadbc
(experimental) reduced websocket frequency
softhack007 Apr 30, 2023
56b6290
Update audio_reactive.h
softhack007 Apr 30, 2023
91d36fa
fastpath: use i2s#1 for 5th LED pin
softhack007 May 2, 2023
7d0e627
some effect optimizations
softhack007 May 3, 2023
4341d36
move main JSON doc into PSRAM (experimental)
softhack007 May 4, 2023
ca5a54b
Merge branch 'mdev' into audio_fastpath
ewoudwijma May 4, 2023
f57c39c
new pio environment for ESP32 rev3 with PSRAM (faster)
softhack007 May 4, 2023
63ffc6e
Update platformio.ini
softhack007 May 4, 2023
d4fb542
Merge branch 'mdev' into audio_fastpath
softhack007 May 6, 2023
9a4c020
reduce file search buffer, to reduce file access delays
softhack007 May 6, 2023
50b3c9d
library updates
softhack007 May 7, 2023
04b55a5
back to NeoPixelBus @ 2.7.1
softhack007 May 7, 2023
d8bd451
Merge branch 'mdev' into audio_fastpath
softhack007 May 8, 2023
237286f
npm run build
softhack007 May 8, 2023
4810a85
Merge branch 'mdev' into audio_fastpath
softhack007 May 9, 2023
f050e60
well-defined fastled version
softhack007 May 10, 2023
c4664e5
Merge branch 'mdev' into audio_fastpath
softhack007 May 10, 2023
f147d79
Merge branch 'mdev' into audio_fastpath
softhack007 May 11, 2023
d5c33df
file buffer size: back to default
softhack007 May 12, 2023
6317dcb
swapped-channel workaround needed a bit longer
softhack007 May 11, 2023
9f6278a
Bugfix.
blazoncek May 14, 2023
6d23eb6
improve robustness when heap is low
softhack007 May 15, 2023
2e6d58f
small LED performance improvement
softhack007 May 15, 2023
72f7f9c
fix 8266 compile error
softhack007 May 15, 2023
175375e
Merge branch 'mdev' into audio_fastpath
ewoudwijma May 16, 2023
40d1201
Merge branch 'mdev' into audio_fastpath
ewoudwijma May 17, 2023
ef12aaa
Temp fix for leds array crashes: size fixed to 10000pixels/30000bytes
ewoudwijma May 17, 2023
894fdce
Merge remote-tracking branch 'upstream/main' into mdev
softhack007 May 21, 2023
fc19340
(experimental) use malloc/realloc for customMappingTable
softhack007 May 21, 2023
63e63ad
minor speedup for liveview and websockets
softhack007 May 21, 2023
d872629
Merge remote-tracking branch 'upstream/main' into mdev
softhack007 May 22, 2023
e6fb6c4
Merge pull request #39 from troyhacks/ES8388-Lyra-T-Fixes-Test
netmindz May 23, 2023
4197f98
package.json and cdata.js: set urls to MoonModules
ewoudwijma May 24, 2023
5edd5e6
tiny
ewoudwijma May 24, 2023
71153ee
small debug improvements
softhack007 May 25, 2023
df26430
audioreactive: replace dynamic buffer with static buffer
softhack007 May 25, 2023
e2eb3e8
npm run build
softhack007 May 25, 2023
9cb6189
minor speedup for 2D
softhack007 May 26, 2023
6d78e46
strip.service() optimization
softhack007 May 26, 2023
49f2e26
arduinoFFT hash update
softhack007 May 26, 2023
5081cfb
Bug fix, allocate string to store ledmap name
ewoudwijma May 29, 2023
859adb3
Update platformio.ini: fastled version update
softhack007 May 29, 2023
d8bc5e2
Dynamic Peek framerates :tada:
ewoudwijma May 29, 2023
1daeecc
Merge branch 'mdev' into audio_fastpath
softhack007 May 30, 2023
c13a5d7
post-merge
softhack007 May 30, 2023
36c34b5
Merge branch 'mdev' into audio_fastpath
ewoudwijma May 31, 2023
52fe8e2
Merge branch 'mdev' into audio_fastpath
softhack007 Jun 1, 2023
1b8ebfd
Added heap debug - enable with WLED_DEBUG_HEAP
troyhacks Jun 1, 2023
63b03a4
Merge branch 'mdev' into audio_fastpath
softhack007 Jun 1, 2023
c052da9
Merge pull request #50 from troyhacks/heap_debug
softhack007 Jun 1, 2023
f877837
platformio.ini: WLED_DEBUG_HEAP for 16MB debug targets
softhack007 Jun 1, 2023
dc77c17
Merge branch 'mdev' into audio_fastpath
softhack007 Jun 1, 2023
0f45b4f
webserver: removing JSON_BUFFER_SIZE for esp32
softhack007 Jun 1, 2023
55b0463
heap debug: show total free + fragmentation level
softhack007 Jun 1, 2023
53c8f9f
Minor edit to remove a space for clarity
troyhacks Jun 1, 2023
be2da7b
minor edit: tab inserted
softhack007 Jun 1, 2023
62990cd
Minor edit: typo
troyhacks Jun 2, 2023
cfc1116
Force reconnect via Serial input
troyhacks Jun 2, 2023
35f3f28
Oops. Bonus brace.
troyhacks Jun 2, 2023
4d64efa
sendLiveLedsWs: don't kick clients
softhack007 Jun 4, 2023
aded74d
suspendStripService improvements
softhack007 Jun 4, 2023
143f842
WLED_DEBUG_MAPS flag added
troyhacks Jun 6, 2023
b6f1a59
global buffer for UDP sound sync
softhack007 Jun 7, 2023
e6334d8
hide "slow strip" when compiling with HEAP_DEBUG
softhack007 Jun 7, 2023
f0dd66e
SoundSync: use local static buffer
softhack007 Jun 7, 2023
4dc6a38
Added code for dealing with low heap, heap debug.
troyhacks Jun 7, 2023
06344ae
FFT UDP fush if not read.
troyhacks Jun 7, 2023
7e1d15c
Merge branch 'audio_fastpath' of https://github.com/MoonModules/WLED …
troyhacks Jun 7, 2023
309e66b
Added fallback for ESP8266 to original code.
troyhacks Jun 7, 2023
af6091b
fixing some memory leaks
softhack007 Jun 7, 2023
d8a6889
build fix
softhack007 Jun 7, 2023
7465be7
heap mud scrum
softhack007 Jun 7, 2023
82f9be5
npm run build
troyhacks Jun 7, 2023
337b117
Merge branch 'audio_fastpath' of https://github.com/MoonModules/WLED …
troyhacks Jun 7, 2023
5c79375
Bug fix segment view, use ledmapMaxSize (TroyHack)
ewoudwijma Jun 8, 2023
b473a40
Tiny things
ewoudwijma Jun 8, 2023
d1b2759
npm run build
softhack007 Jun 8, 2023
7dcc8f1
enumerateLedmaps improvements
softhack007 Jun 8, 2023
d4a37ec
clean up ledmap names when directly reading from file
softhack007 Jun 9, 2023
a9cdd21
prevent strip flickering
softhack007 Jun 12, 2023
6883996
another mitigation for flickering
softhack007 Jun 13, 2023
47de28e
2D Lissajous improvements
softhack007 Jun 14, 2023
2410c22
2D Lissajous: revive old anti-aliased code
softhack007 Jun 14, 2023
3127c60
Merge branch 'mdev' into audio_fastpath
softhack007 Jun 15, 2023
d51a41f
post-merge
softhack007 Jun 15, 2023
a7d627b
Merge branch 'mdev' into audio_fastpath
softhack007 Jun 16, 2023
553f234
npm run build
softhack007 Jun 16, 2023
8aef434
re-enable old peak detect algo, plus ripplepeak bugfix
softhack007 Jun 18, 2023
708cd8e
free udp receive buffers before parsePacket
softhack007 Jun 20, 2023
310daa6
improve segment code robustness
softhack007 Jun 20, 2023
582b96f
robustness improvements
softhack007 Jun 21, 2023
1c53f14
Temporary bugfix for #3264
blazoncek Jun 24, 2023
3cc1d30
optimization for ABL hotfix
softhack007 Jul 1, 2023
a84c361
build number ++
softhack007 Jul 1, 2023
ecf3317
de-optimization
softhack007 Jul 3, 2023
29644cc
ABL optimization
softhack007 Jul 3, 2023
601499b
XY: minor bugfix
softhack007 Jul 6, 2023
5fe12ee
Merge branch 'mdev' into audio_fastpath
softhack007 Jul 8, 2023
a2e2ead
npm run build
softhack007 Jul 8, 2023
a45306b
blur speedup
softhack007 Jul 6, 2023
c64f74a
fix for random crashes on changing presets (UI)
softhack007 Jul 8, 2023
9a832ed
build number upgrade
softhack007 Jul 8, 2023
9ed5dc7
npm run build
softhack007 Jul 8, 2023
c22c92e
preview at full brightness
softhack007 Jul 10, 2023
0fb5edc
robustness improvements from upstream
softhack007 Jul 13, 2023
3295579
jsonToPixels robustness
softhack007 Jul 13, 2023
9a3a97e
pre-merge
softhack007 Jul 13, 2023
99def64
live view: more updates in non-fastpath builds
softhack007 Jul 13, 2023
9243b90
max is faster than MAX
softhack007 Jul 13, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -812,6 +812,7 @@ build_flags_S =
-D USERMOD_AUDIOREACTIVE
-D UM_AUDIOREACTIVE_USE_NEW_FFT ; use latest (upstream) FFTLib, instead of older library modified by blazoncek. Slightly faster, more accurate, needs 2KB RAM extra
-D USERMOD_ARTIFX ; WLEDMM usermod
-D WLEDMM_FASTPATH ; WLEDMM experimental option. Reduces audio lag (latency), and allows for faster LED framerates
; -D WLED_DISABLE_LOXONE
; -D WLED_DISABLE_ALEXA
; -D WLED_DISABLE_HUESYNC
Expand Down Expand Up @@ -914,7 +915,9 @@ lib_deps = ${esp32_4MB_M_base.lib_deps} ${common_mm.lib_deps_XL}
board = esp32dev
upload_speed = 460800 ; or 921600
platform = ${esp32.platformV4}
platform_packages = ${esp32.platformV4_packages}
platform_packages =
${esp32.platformV4_packages}
toolchain-xtensa-esp32 @ 8.4.0+2021r2-patch5 ; align main tools with riscV tools
build_unflags = ${common.build_unflags}
build_flags = ${common.build_flags} ${esp32.build_flagsV4} ${common_mm.build_flags_S}
-Wno-misleading-indentation -Wno-format-truncation
Expand Down
13 changes: 13 additions & 0 deletions usermods/audioreactive/audio_reactive.h
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,11 @@ constexpr SRate_t SAMPLE_RATE = 22050; // Base sample rate in Hz - 22Khz
//constexpr SRate_t SAMPLE_RATE = 16000; // 16kHz - use if FFTtask takes more than 20ms. Physical sample time -> 32ms
//constexpr SRate_t SAMPLE_RATE = 20480; // Base sample rate in Hz - 20Khz is experimental. Physical sample time -> 25ms
//constexpr SRate_t SAMPLE_RATE = 10240; // Base sample rate in Hz - previous default. Physical sample time -> 50ms
#ifndef WLEDMM_FASTPATH
#define FFT_MIN_CYCLE 21 // minimum time before FFT task is repeated. Use with 22Khz sampling
#else
#define FFT_MIN_CYCLE 15 // reduce min time, to allow faster catch-up when I2S is lagging
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any downside to this change? "Compromise" for speed or just masking changes behind flag until we have done enough testing to know if this should just be right value for all uses?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, the downside is that the FFT task will block the core for longer (2ms in "standard", vs 7ms in "fastpath").

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we are using the second core, is that an issue? What else (if anything) is using that core?

#endif
//#define FFT_MIN_CYCLE 30 // Use with 16Khz sampling
//#define FFT_MIN_CYCLE 23 // minimum time before FFT task is repeated. Use with 20Khz sampling
//#define FFT_MIN_CYCLE 46 // minimum time before FFT task is repeated. Use with 10Khz sampling
Expand Down Expand Up @@ -1129,8 +1133,13 @@ class AudioReactive : public Usermod {
{
float sampleAdj; // Gain adjusted sample value
float tmpSample; // An interim sample variable used for calculatioins.
#ifdef WLEDMM_FASTPATH
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any downside to this change? "Compromise" for speed or just masking changes behind flag until we have done enough testing to know if this should just be right value for all uses?

constexpr float weighting = 0.35f; // slightly reduced filter strength, to reduce audio latency
constexpr float weighting2 = 0.25f;
#else
const float weighting = 0.2f; // Exponential filter weighting. Will be adjustable in a future release.
const float weighting2 = 0.073f; // Exponential filter weighting, for rising signal (a bit more robust against spikes)
#endif
const int AGC_preset = (soundAgc > 0)? (soundAgc-1): 0; // make sure the _compiler_ knows this value will not change while we are inside the function
static bool isFrozen = false;
static bool haveSilence = true;
Expand Down Expand Up @@ -1732,7 +1741,11 @@ class AudioReactive : public Usermod {

// get AGC sensitivity and sound pressure
static unsigned long lastEstimate = 0;
#ifdef WLEDMM_FASTPATH
if (millis() - lastEstimate > 7) {
#else
if (millis() - lastEstimate > 12) {
#endif
lastEstimate = millis();
agcSensitivity = getSensitivity();
if (limiterOn)
Expand Down
5 changes: 5 additions & 0 deletions usermods/audioreactive/audio_source.h
Original file line number Diff line number Diff line change
Expand Up @@ -180,8 +180,13 @@ class I2SSource : public AudioSource {
#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(4, 2, 0)
.communication_format = i2s_comm_format_t(I2S_COMM_FORMAT_STAND_I2S),
//.intr_alloc_flags = ESP_INTR_FLAG_LEVEL1,
#ifdef WLEDMM_FASTPATH
.intr_alloc_flags = ESP_INTR_FLAG_LEVEL2|ESP_INTR_FLAG_LEVEL3, // seems to reduce noise
.dma_buf_count = 28, // 160ms buffer (128 * dma_buf_count / sampleRate)
#else
.intr_alloc_flags = ESP_INTR_FLAG_LEVEL2,
.dma_buf_count = 8,
#endif
.dma_buf_len = _blockSize,
.use_apll = 0,
//.fixed_mclk = 0,
Expand Down
43 changes: 29 additions & 14 deletions wled00/FX.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2243,7 +2243,7 @@ uint16_t mode_colortwinkle() {
}
}
}
return FRAMETIME_FIXED;
return FRAMETIME_FIXED_SLOW;
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have all effects that use this constant been updated or just been changing one by one as you test?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just as I tested it. Some effects seem to be meant to be slow, like Halloween eyes.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should they not be time-based rather than FPS based?

}
static const char _data_FX_MODE_COLORTWINKLE[] PROGMEM = "Colortwinkles@Fade speed,Spawn speed;;!;;m12=0"; //pixels

Expand Down Expand Up @@ -3096,7 +3096,7 @@ uint16_t candle(bool multi)
}
}

return FRAMETIME_FIXED;
return FRAMETIME_FIXED_SLOW;
}


Expand Down Expand Up @@ -6042,6 +6042,7 @@ uint16_t mode_ripplepeak(void) { // * Ripple peak. By Andrew Tuli
// printUmData();

if (SEGENV.call == 0) {
SEGMENT.setUpLeds();
SEGENV.aux0 = 255;
SEGMENT.custom1 = *binNum;
SEGMENT.custom2 = *maxVol * 2;
Expand All @@ -6052,8 +6053,9 @@ uint16_t mode_ripplepeak(void) { // * Ripple peak. By Andrew Tuli
*binNum = SEGMENT.custom1; // Select a bin.
*maxVol = SEGMENT.custom2 / 2; // Our volume comparator.

SEGMENT.fade_out(240); // Lower frame rate means less effective fading than FastLED
SEGMENT.fade_out(240);
//SEGMENT.fade_out(240); // Lower frame rate means less effective fading than FastLED
//SEGMENT.fade_out(240);
SEGMENT.fade_out(224); // should be the same as 240 applied twice

for (int i = 0; i < SEGMENT.intensity/16; i++) { // Limit the number of ripples.
if (samplePeak) ripples[i].state = 255;
Expand All @@ -6066,7 +6068,8 @@ uint16_t mode_ripplepeak(void) { // * Ripple peak. By Andrew Tuli
ripples[i].pos = random16(SEGLEN);
#ifdef ESP32
if (FFT_MajorPeak > 1) // log10(0) is "forbidden" (throws exception)
ripples[i].color = (int)(log10f(FFT_MajorPeak)*128);
//ripples[i].color = (int)(log10f(FFT_MajorPeak)*128); // not to self: buggy !!
ripples[i].color = (int)(logf(FFT_MajorPeak)*32.0f); // works up to 10025 hz
else ripples[i].color = 0;
#else
ripples[i].color = random8();
Expand Down Expand Up @@ -6476,8 +6479,12 @@ uint16_t mode_midnoise(void) { // Midnoise. By Andrew Tuline.
}
float volumeSmth = *(float*) um_data->u_data[0];

SEGMENT.fade_out(SEGMENT.speed);
SEGMENT.fade_out(SEGMENT.speed);
if (SEGENV.call == 0) {
SEGMENT.setUpLeds();
SEGMENT.fill(BLACK);
}
SEGMENT.fadeToBlackBy(SEGMENT.speed/2);
//SEGMENT.fade_out(SEGMENT.speed);

float tmpSound2 = volumeSmth * (float)SEGMENT.intensity / 256.0; // Too sensitive.
tmpSound2 *= (float)SEGMENT.intensity / 128.0; // Reduce sensitity/length.
Expand Down Expand Up @@ -6622,8 +6629,13 @@ uint16_t mode_plasmoid(void) { // Plasmoid. By Andrew Tuline.
}
float volumeSmth = *(float*) um_data->u_data[0];

SEGMENT.fadeToBlackBy(32);

if (SEGENV.call == 0) {
SEGMENT.setUpLeds();
SEGMENT.fill(BLACK);
}
//SEGMENT.fadeToBlackBy(32);
SEGMENT.fadeToBlackBy(48);

plasmoip->thisphase += beatsin8(6,-4,4); // You can change direction and speed individually.
plasmoip->thatphase += beatsin8(7,-4,4); // Two phase values to make a complex pattern. By Andrew Tuline.

Expand Down Expand Up @@ -6832,7 +6844,7 @@ uint16_t mode_blurz(void) { // Blurz. By Andrew Tuline.
SEGMENT.setPixelColor(segLoc, color_blend(SEGCOLOR(1), SEGMENT.color_from_palette((uint16_t)pixColor, false, PALETTE_SOLID_WRAP, 0),(uint8_t)pixIntensity)); // repaint center pixel after blur
} else SEGMENT.blur(max(SEGMENT.intensity, (uint8_t)1)); // silence - just blur it again

return FRAMETIME;
return FRAMETIME_FIXED;
} // mode_blurz()
static const char _data_FX_MODE_BLURZ[] PROGMEM = "Blurz ☾@Fade rate,Blur;!,Color mix;!;1f;sx=48,ix=127,m12=0,si=0"; // Pixels, Beatsin
#endif
Expand Down Expand Up @@ -6921,7 +6933,10 @@ uint16_t mode_freqmap(void) { // Map FFT_MajorPeak to SEGLEN.
float my_magnitude = *(float*)um_data->u_data[5] / 4.0f;
if (FFT_MajorPeak < 1) FFT_MajorPeak = 1; // log10(0) is "forbidden" (throws exception)

if (SEGENV.call == 0) SEGMENT.fill(BLACK);
if (SEGENV.call == 0) {
SEGMENT.setUpLeds();
SEGMENT.fill(BLACK);
}
int fadeoutDelay = (256 - SEGMENT.speed) / 32;
if ((fadeoutDelay <= 1 ) || ((SEGENV.call % fadeoutDelay) == 0)) SEGMENT.fade_out(SEGMENT.speed);

Expand All @@ -6944,7 +6959,7 @@ uint16_t mode_freqmap(void) { // Map FFT_MajorPeak to SEGLEN.
SEGMENT.setPixelColor(locn, color_blend(SEGCOLOR(1), SEGMENT.color_from_palette(SEGMENT.intensity+pixCol, false, PALETTE_SOLID_WRAP, 0), bright));
}

return FRAMETIME;
return FRAMETIME_FIXED;
} // mode_freqmap()
static const char _data_FX_MODE_FREQMAP[] PROGMEM = "Freqmap@Fade rate,Starting color;!,!;!;1f;m12=0,si=0"; // Pixels, Beatsin

Expand Down Expand Up @@ -7068,8 +7083,8 @@ uint16_t mode_freqwave(void) { // Freqwave. By Andreas Pleschun
SEGMENT.fill(BLACK);
}

uint8_t secondHand = micros()/(256-SEGMENT.speed)/500 % 16;
if((SEGMENT.speed > 254) || (SEGENV.aux0 != secondHand)) { // WLEDMM allow run run at full speed
uint8_t secondHand = (SEGMENT.speed < 255) ? (micros()/(256-SEGMENT.speed)/500 % 16) : 0;
if((SEGMENT.speed > 254) || (SEGENV.aux0 != secondHand)) { // WLEDMM allow to run at full speed
SEGENV.aux0 = secondHand;

float sensitivity = 0.5f * mapf(SEGMENT.custom3, 1, 31, 0.5, 10); // reduced resolution slider
Expand Down
31 changes: 21 additions & 10 deletions wled00/FX.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,21 @@
#endif

/* Not used in all effects yet */
#if defined(ARDUINO_ARCH_ESP32) && defined(WLEDMM_FASTPATH) // WLEDMM go faster on ESP32
#define WLED_FPS 120
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Default value that you can then update in the config? Do we have any way to "force" an update to this value so users get the benefit without needing to read release notes to know to change the value?

Copy link
Collaborator

@softhack007 softhack007 May 4, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one is a very problematic constant ... it seems like just the the default value, however changing this also impacts some "internal clocking" code that may run faster - don't know how exactly that happens.

In general, yes this value should be part of the config. It looks like WLED-internal legacy - maybe older WLED versions only had a define, then later it became a user setting but the old constant still stayed in the code...

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, this was partly why I asked. I had a feeling it might have been a constant that became not-so-constant when gui option was added, but not 100% of the code changed to use the new runtime value

#define FRAMETIME_FIXED (strip.getFrameTime() < 10 ? 12 : 24)
#define WLED_FPS_SLOW 60
#define FRAMETIME_FIXED_SLOW (15) // = 66 FPS => 1000/66
//#define FRAMETIME _frametime
#define FRAMETIME strip.getFrameTime()
#else
#define WLED_FPS 42
#define FRAMETIME_FIXED (1000/WLED_FPS)
#define WLED_FPS_SLOW 42
#define FRAMETIME_FIXED_SLOW (1000/WLED_FPS_SLOW)
//#define FRAMETIME _frametime
#define FRAMETIME strip.getFrameTime()
#endif

/* each segment uses 52 bytes of SRAM memory, so if you're application fails because of
insufficient memory, decreasing MAX_NUM_SEGMENTS may help */
Expand Down Expand Up @@ -560,7 +571,7 @@ typedef struct Segment {
void setPixelColor(float i, uint32_t c, bool aa = true);
void setPixelColor(float i, uint8_t r, uint8_t g, uint8_t b, uint8_t w = 0, bool aa = true) { setPixelColor(i, RGBW32(r,g,b,w), aa); }
void setPixelColor(float i, CRGB c, bool aa = true) { setPixelColor(i, RGBW32(c.r,c.g,c.b,0), aa); }
uint32_t getPixelColor(int i);
uint32_t __attribute__((pure)) getPixelColor(int i); // WLEDMM attribute added
// 1D support functions (some implement 2D as well)
void blur(uint8_t);
void fill(uint32_t c);
Expand All @@ -573,7 +584,7 @@ typedef struct Segment {
void addPixelColor(int n, CRGB c) { addPixelColor(n, RGBW32(c.r,c.g,c.b,0)); } // automatically inline
void fadePixelColor(uint16_t n, uint8_t fade);
uint8_t get_random_wheel_index(uint8_t pos);
uint32_t color_from_palette(uint16_t, bool mapping, bool wrap, uint8_t mcol, uint8_t pbri = 255);
uint32_t __attribute__((pure)) color_from_palette(uint_fast16_t, bool mapping, bool wrap, uint8_t mcol, uint8_t pbri = 255);
uint32_t color_wheel(uint8_t pos);

// 2D matrix
Expand All @@ -583,14 +594,14 @@ typedef struct Segment {
void createjMap(); //WLEDMM jMap
void deletejMap(); //WLEDMM jMap
#ifndef WLED_DISABLE_2D
uint16_t XY(uint16_t x, uint16_t y); // support function to get relative index within segment (for leds[])
uint16_t __attribute__((pure)) XY(uint16_t x, uint16_t y); // support function to get relative index within segment (for leds[]) // WLEDMM attribute pure
void setPixelColorXY(int x, int y, uint32_t c); // set relative pixel within segment with color
void setPixelColorXY(int x, int y, byte r, byte g, byte b, byte w = 0) { setPixelColorXY(x, y, RGBW32(r,g,b,w)); } // automatically inline
void setPixelColorXY(int x, int y, CRGB c) { setPixelColorXY(x, y, RGBW32(c.r,c.g,c.b,0)); } // automatically inline
void setPixelColorXY(float x, float y, uint32_t c, bool aa = true);
void setPixelColorXY(float x, float y, uint32_t c, bool aa = true, bool fast = true);
void setPixelColorXY(float x, float y, byte r, byte g, byte b, byte w = 0, bool aa = true) { setPixelColorXY(x, y, RGBW32(r,g,b,w), aa); }
void setPixelColorXY(float x, float y, CRGB c, bool aa = true) { setPixelColorXY(x, y, RGBW32(c.r,c.g,c.b,0), aa); }
uint32_t getPixelColorXY(uint16_t x, uint16_t y);
uint32_t __attribute__((pure)) getPixelColorXY(uint16_t x, uint16_t y); // WLEDMM attribute pure
// 2D support functions
void blendPixelColorXY(uint16_t x, uint16_t y, uint32_t color, uint8_t blend);
void blendPixelColorXY(uint16_t x, uint16_t y, CRGB c, uint8_t blend) { blendPixelColorXY(x, y, RGBW32(c.r,c.g,c.b,0), blend); }
Expand Down Expand Up @@ -686,11 +697,11 @@ class WS2812FX { // 96 bytes
_length(DEFAULT_LED_COUNT),
_brightness(DEFAULT_BRIGHTNESS),
_transitionDur(750),
_targetFps(WLED_FPS),
_frametime(FRAMETIME_FIXED),
_targetFps(WLED_FPS_SLOW), // WLEDMM
_frametime(FRAMETIME_FIXED_SLOW), // WLEDMM
_cumulativeFps(2),
#ifdef ARDUINO_ARCH_ESP32
_cumulativeFps500(2*500), // WLEDMM more accurate FPS measurement for ESP32
_cumulativeFps500(2*500), // WLEDMM more accurate FPS measurement for ESP32
_lastShow500(0),
#endif
_isServicing(false),
Expand Down Expand Up @@ -809,8 +820,8 @@ class WS2812FX { // 96 bytes

uint32_t
now,
timebase,
getPixelColor(uint16_t);
timebase;
uint32_t __attribute__((pure)) getPixelColor(uint_fast16_t); // WLEDMM attribute pure = does not have side-effects

inline uint32_t getLastShow(void) { return _lastShow; }
inline uint32_t segColor(uint8_t i) { return _colors_t[i]; }
Expand Down
Loading