debug code updates & fixes

better output when using WLED_DEBUG_HEAP without WLED_DEBUG
This commit is contained in:
Frank
2025-10-25 00:53:25 +02:00
parent 22d142942a
commit 60878305fb
4 changed files with 14 additions and 13 deletions

View File

@@ -1789,7 +1789,7 @@ uint32_t calculateNumberOfParticles1D(const uint32_t fraction, const bool isadva
numberofParticles = numberofParticles < 20 ? 20 : numberofParticles; // 20 minimum
//make sure it is a multiple of 4 for proper memory alignment (easier than using padding bytes)
numberofParticles = (numberofParticles+3) & ~0x03; // note: with a separate particle buffer, this is probably unnecessary
PSPRINTLN(" calc numparticles:" + String(numberofParticles))
PSPRINTLN(" calc numparticles:" + String(numberofParticles));
return numberofParticles;
}

View File

@@ -382,13 +382,13 @@ void WLED::loop()
#endif
#ifdef WLED_DEBUG_HEAP
if (millis() - debugTime > 4999 ) { // WLEDMM: Special case for debugging heap faster
DEBUG_PRINT(F("*** Free heap: ")); DEBUG_PRINT(heap_caps_get_free_size(0x1800));
DEBUG_PRINT(F("\tLargest free block: ")); DEBUG_PRINT(heap_caps_get_largest_free_block(0x1800));
DEBUG_PRINT(F(" *** \t\tArduino min free stack: ")); DEBUG_PRINT(uxTaskGetStackHighWaterMark(NULL));
USER_PRINT(F("*** Free heap: ")); USER_PRINT(heap_caps_get_free_size(0x1800));
USER_PRINT(F("\tLargest free block: ")); USER_PRINT(heap_caps_get_largest_free_block(0x1800));
USER_PRINT(F(" *** \t\tArduino min free stack: ")); USER_PRINT(uxTaskGetStackHighWaterMark(NULL));
#if INCLUDE_xTaskGetHandle
DEBUG_PRINT(F(" TCP min free stack: ")); DEBUG_PRINT(wledmm_get_tcp_stacksize());
USER_PRINT(F(" TCP min free stack: ")); USER_PRINT(wledmm_get_tcp_stacksize());
#endif
DEBUG_PRINTLN(F(" ***"));
USER_PRINTLN(F(" ***"));
debugTime = millis();
}
#endif // WLED_DEBUG_HEAP

View File

@@ -880,7 +880,7 @@ WLED_GLOBAL volatile uint8_t jsonBufferLock _INIT(0);
#endif
// debug macro variable definitions
#ifdef WLED_DEBUG
#if defined(WLED_DEBUG) || defined(WLED_DEBUG_HEAP)
WLED_GLOBAL unsigned long debugTime _INIT(0);
WLED_GLOBAL int lastWifiState _INIT(3);
WLED_GLOBAL unsigned long wifiStateChangedTime _INIT(0);

View File

@@ -76,19 +76,20 @@ void setup() {
void loop() __attribute__((used)); // needed for -flto
void loop() {
//WLEDMM show loops per second
#ifdef WLED_DEBUG
#if defined(WLED_DEBUG) || defined(WLED_DEBUG_HEAP)
loopCounter++;
//if (millis() - lastMillis >= 10000) {
if (millis() - lastMillis >= 8000) {
long delta = millis() - lastMillis;
if (delta > 0) {
if ((delta > 0) && (loopCounter > 0)) {
lps = (loopCounter*1000U) / delta;
//if (delta > (showtime / 1000)) lps2 = (loopCounter*1000U) / (delta - (showtime / 1000));
USER_PRINTF("%lu lps\t", lps);
USER_PRINTF("%u fps\t", strip.getFps());
USER_PRINTF("%3lu lps %5.1fms \t", lps, float(delta) / float(loopCounter));
USER_PRINTF("%3u fps\t\t", strip.getFps());
//USER_PRINTF("%lu lps without show\t\t", lps2);
USER_PRINTF("target frametime %dms\t", int(strip.getFrameTime()));
USER_PRINTF("target FPS %d\n", int(strip.getTargetFps()));
//USER_PRINTF("target frametime %dms\t", int(strip.getFrameTime()));
//USER_PRINTF("target FPS %d", int(strip.getTargetFps()));
USER_PRINTLN("");
}
lastMillis = millis();
loopCounter = 0;