Code works fine on Uno but throws weird errors on ESP8266 D1 Mini

I made some effects for neopixel. I defined them as classes with a tick method so I can easily switch them from the main loop. When I create two of these effect classes (doesn’t matter if it is the same) the thing crashes on the D1 Mini while working perfectly on the Arduino UNO.

This is my code:

The only effects that are in the correct format are rainbow and strobo.

I am really confused about this and would appreciate any help.

Error:
https://haste.thevillage.chat/qutelijalo

Can you insert some Serial.println() in setup() and loop() in the main.cpp file to see if setup() is even reached, or at which line it approximately crashes?

Does a simple serial print sketch like platform-espressif8266/WiFiScan.ino at develop · platformio/platform-espressif8266 · GitHub work as expected on the device?

1 Like

tried it, it does not get to setup.

Then the constructor code of a globally constructed object is crashing it before it can do anything.

Or something is so wrong with the board that no firmware can boot at all. Have you tried the linked WiFiScan.ino example?

The two classes and constructors where you copy the entire Adafruit_NeoPixel object by value instead of storing a pointer to it seem extremely suspicious to me (e.g this). Can you change that to a pointer reference?

1 Like

It works when I create only one of the effects so the ESP works. I tried using pointers and references, both resulted in all leds flashing randomly (even when creating just one instance of an effect). I have no idea why.

Can you upload the current code for the pointers version in the gitlab? It should be correct compared to the by-value one…

1 Like

I have pushed my changes.

I tried with normal pointers instead of references too, did not change the behaviour (same random color flashing)

fixed it now by rewriting, not sure what the issue was.