Update2: all my FastLED problems went away when I stopped trying to C++ inherit

Update2: all my FastLED problems went away when I stopped trying to C++ inherit from CFastLED :frowning: / I’m pretty damn certain my code was fine, but was triggering a subtle C++ inheritance, maybe compiler bug.

Update: Dear FastLED devs, do you know if CFastLED::show(); when inheriting from FastLED and FastLED.show() are indeed supposed to be the same thing?
For me, I get one that works, and one that crashes/hangs teensy. See my last update in the comments.

@PaulStoffregen , I’m not sure if teensy 3.1+FastLED support is better here than on https://forum.pjrc.com/threads/ . Are you generally the maintainer of FastLED for teensy, or are the FastLED devs in charge of it, along with a few patches from you from time to time?

Update: while the problem is gone with ESP8266, I can reproduce the same behaviour on ESP32, so it’s likely that it’s not a teensy toolchain problem, but likely something not obvious with my code that is platform dependent.

Problem (also posted on https://forum.pjrc.com/threads/50526-Another-vexing-problem-with-FastLED-(lastest-version)-code-hangs-on-show()?p=172866#post172866 ):

FastLED show() seems to be super slow on teensy 3.1/3.2 (as in one second+ per show() or sometimes even 15mn per show() after power cycle).
Then, I don’t change my code at all, I upload another sketch that does neopixels some other way, that one works at full speed and unlocks something so that when I re-upload my same sketch that was super slow, it works at full speed, until power cycle again.
I then put the same code on ESP8266, and it just worked, no problems at all.

I can get other test FastLED code working on teensy, but clearly my code is causing a weird issue, and I’m not sure if I have a weird bug that only affects teensy.
Code: https://github.com/marcmerlin/FastLED_NeoMatrix/blob/master/examples/MatrixGFXDemo/MatrixGFXDemo.ino
You don’t need a matrix to run it, a simple neopixel strip should be enough, or even just looking at the serial output hanging or not hanging should do it.

Thanks for looking/suggestions.

Well, I was able to run the code on ESP32, and I also get a very long hang before the first show() completes, and then I get a crash, which I guess is better for debugging.
Serial output:
malloc size: 768
If the code crashes here, decrease the brightness or turn off the all white display below
First matrix->show did not crash/hang
Guru Meditation Error: Core 0 panic’ed (Interrupt wdt timeout on CPU1)

decoding the backtrace gives:
0x400d7454: esp_vApplicationIdleHook at /Users/ficeto/Desktop/ESP32/ESP32/esp-idf-public/components/esp32/./freertos_hooks.c line 52
0x400d7454: esp_vApplicationIdleHook at /Users/ficeto/Desktop/ESP32/ESP32/esp-idf-public/components/esp32/./freertos_hooks.c line 52
0x400846dd: prvIdleTask at /Users/ficeto/Desktop/ESP32/ESP32/esp-idf-public/components/freertos/./tasks.c line 4421

I guess it gives me something to work with.

Well, the plot thickens: code works on ESP8266 “just works”, in works on teensy if I flash something else before that to “unlock it”. The first show() works on ESP32 and the 2nd one hangs.
I can’t get it on UNO because the code is too big, but on MEGA I get a hang on the first show()
I guess I’ll have to debug further…

I track pretty much all Teensy-specific issues via the PJRC forum. I replied just now to the thread you started over there. Replying here too, mainly to answer your question about where best to post. If you want me to look into a problem affecting Teensy, definitely on the forum. As I wrote just now on the forum, if you can trim your 700+ line program to something much smaller, just enough to demonstrate the problem, it’d really help me to investigate this problem.

This is getting more and more confusing…
While doing more debugging, I included FastLED demo code within my own code to see if that demo would work and then my code would work or not.

While doing this, I think I narrowed it down to replacing CFastLED::show() with FastLED.show();

on a C++ OOP standpoint, this kind of sucks, but code-wise it seems to have fixed my problem, and I’m not sure why yet.

that said, now it works on teensy (although the display looks garbled at times), still fails on ESP32.

ESP8266 which used to work, now show garbled display at times and crashes after a while:
0x40203878: ClocklessController5, 20, 50, 30, (EOrder)66, 0, false, 5>::showPixels(PixelController(EOrder)66, 1, 4294967295u>&) at /home/merlin/Arduino/libraries/FastLED_NeoMatrix/FastLED_NeoMatrix.cpp line 71
0x401076c8: delayMicroseconds at /home/merlin/Arduino/hardware/esp8266com/esp8266/cores/esp8266/core_esp8266_wiring.c line 76
0x40203878: ClocklessController5, 20, 50, 30, (EOrder)66, 0, false, 5>::showPixels(PixelController(EOrder)66, 1, 4294967295u>&) at /home/merlin/Arduino/libraries/FastLED_NeoMatrix/FastLED_NeoMatrix.cpp line 71
0x40203ab0: CPixelLEDController(EOrder)66, 1, 4294967295u>::show(CRGB const*, int, CRGB) at /home/merlin/Arduino/libraries/FastLED_NeoMatrix/FastLED_NeoMatrix.cpp line 71
0x40203bb2: CFastLED::countFPS(int) at /home/merlin/Arduino/libraries/FastLED/FastLED.cpp line 266
0x40203c50: CLEDController::setDither(unsigned char) at /home/merlin/Arduino/libraries/FastLED/FastLED.cpp line 266
: (inlined by) CFastLED::show(unsigned char) at /home/merlin/Arduino/libraries/FastLED/FastLED.cpp line 60
0x40203a4c: CPixelLEDController(EOrder)66, 1, 4294967295u>::show(CRGB const*, int, CRGB) at /home/merlin/Arduino/libraries/FastLED_NeoMatrix/FastLED_NeoMatrix.cpp line 71
0x402010a7: delay at /home/merlin/Arduino/hardware/esp8266com/esp8266/cores/esp8266/core_esp8266_wiring.c line 51
0x40201e9c: FastLED_NeoMatrix::show() at /home/merlin/Arduino/libraries/FastLED_NeoMatrix/FastLED_NeoMatrix.h line 104
0x40201ffa: count_pixels() at /home/merlin/Arduino/libraries/FastLED_NeoMatrix/examples/MatrixGFXDemo/MatrixGFXDemo.ino line 360 (discriminator 5)
0x402010b2: delay at /home/merlin/Arduino/hardware/esp8266com/esp8266/cores/esp8266/core_esp8266_wiring.c line 54
0x40202787: loop at /home/merlin/Arduino/libraries/FastLED_NeoMatrix/examples/MatrixGFXDemo/MatrixGFXDemo.ino line 634
0x402043f1: esp_schedule at /home/merlin/Arduino/hardware/esp8266com/esp8266/cores/esp8266/core_esp8266_main.cpp line 57
0x4020441c: loop_wrapper at /home/merlin/Arduino/hardware/esp8266com/esp8266/cores/esp8266/core_esp8266_main.cpp line 57
0x4010070c: cont_norm at /home/merlin/Arduino/hardware/esp8266com/esp8266/cores/esp8266/cont.S line 109
this is helpful though since at least I get a traceback, something to look into.