I’m developing a project where the ESP32 uses an encoder to trigger 2 GPIOs depending on the encoder value. The code works perfectly when compiled in one computer, but behaves slightly different when compiled and uploaded from my laptop.
After some investigation, I found some differences in the upload log output. The package’s versions are different, so the output binaries have different size and simply, does not do the same job.
I had to specify the working versions in my platform.ini file, but I believe it’s weird that old versions of the packages produce a faster and better code than the newer ones.
As an example, this is the memory usage with old libraries (code that works):
RAM: [== ] 20.1% (used 65700 bytes from 327680 bytes)
Flash: [======= ] 65.6% (used 860110 bytes from 1310720 bytes)
And this is the memory usage when using the latest and greatest packages, with a compact code that is not working as expected:
RAM: [== ] 21.0% (used 68808 bytes from 327680 bytes)
Flash: [====== ] 61.5% (used 806085 bytes from 1310720 bytes)
The difference is not big, but there’s something in that compilation that produces a smaller code that works slower!
When you compile your code with the latest Arduino-ESP32 core (2.0.4) in the Arduino IDE, does it also behave slower than when you install e.g. 1.0.6 in the board manager? If yes → issue to Issues · espressif/arduino-esp32 · GitHub