File tree Expand file tree Collapse file tree 1 file changed +12
-4
lines changed
Expand file tree Collapse file tree 1 file changed +12
-4
lines changed Original file line number Diff line number Diff line change @@ -379,12 +379,20 @@ void WLED::loop()
379379#endif
380380#ifdef WLED_DEBUG_HEAP
381381 if (millis () - debugTime > 4999 ) { // WLEDMM: Special case for debugging heap faster
382- DEBUG_PRINT (F (" *** Free heap: " )); DEBUG_PRINT (heap_caps_get_free_size (0x1800 ));
383- DEBUG_PRINT (F (" \t Largest free block: " )); DEBUG_PRINT (heap_caps_get_largest_free_block (0x1800 ));
384- DEBUG_PRINT (F (" *** \t\t Arduino min free stack: " )); DEBUG_PRINT (uxTaskGetStackHighWaterMark (NULL ));
382+ size_t largest_free = heap_caps_get_largest_free_block (0x1800 );
383+ size_t total_free = heap_caps_get_free_size (0x1800 );
384+ DEBUG_PRINT (F (" *** Free heap: " )); DEBUG_PRINT (total_free);
385+ DEBUG_PRINT (F (" - Largest free block: " )); DEBUG_PRINT (largest_free);
386+ float fragmentation = 100 .0f ;
387+ if ((largest_free > 1 ) && (total_free > largest_free)) {
388+ fragmentation = 100 .f * (1 .0f - (float (largest_free) / float (total_free)) );
389+ }
390+ DEBUG_PRINT (F (" (frag " )); DEBUG_PRINTF (" %0.2f" ,fragmentation); DEBUG_PRINT (F (" %)" ));
391+ DEBUG_PRINT (F (" - Arduino min free stack: " )); DEBUG_PRINT (uxTaskGetStackHighWaterMark (NULL ));
385392#if INCLUDE_xTaskGetHandle
386- DEBUG_PRINT (F (" TCP min free stack: " )); DEBUG_PRINT (wledmm_get_tcp_stacksize ());
393+ DEBUG_PRINT (F (" - TCP min free stack: " )); DEBUG_PRINT (wledmm_get_tcp_stacksize ());
387394#endif
395+
388396 DEBUG_PRINTLN (F (" ***" ));
389397 debugTime = millis ();
390398 }
You can’t perform that action at this time.
0 commit comments