neu-rah / ArduinoMenu

Arduino generic menu/interactivity system
GNU Lesser General Public License v2.1
951 stars 191 forks source link

Encoder error: "ISR not in IRAM" on Wemos D1 Mini #278

Closed aliusc closed 4 years ago

aliusc commented 4 years ago

Hello,

I trying to set up this library with my hardware. I use Wemos D1 Mini, rotary encoder, 1602 LCD via PCF8574. For ideal test condition I selected LCD > PCF8574 example.

I have wired encoder's CLK and DT to D5, D6, encoders switch to D7. I use ESP8266 core library 2.6.3. Code compiles well and starts up, but frequently reboots with Error in console:

Arduino Menu Library
ISR not in IRAM!

User exception (panic/abort/assert)
Abort called

I have tried to lower core library to 2.5.0, but error was still here.

When I comment out encoder and leave LCD and button only it starts up correctly. I have read interrupt functions should have attribute ICACHE_RAM_ATTR to make them work correctly. But I have difficulties to add them to proper functions. I have tried to add it to "menuIO/encoderIn.h" to functions "encodeInUpdateA" and "encoderInUpdateB" declarations: static void ICACHE_RAM_ATTR encoderInUpdateA(class encoderIn<pinA,pinB> *e); static void ICACHE_RAM_ATTR encoderInUpdateB(class encoderIn<pinA,pinB> *e);

and void ICACHE_RAM_ATTR encoderIn<pinA,pinB>::encoderInUpdateA(class encoderIn<pinA,pinB> *e) function declaration. Sadly it didn't helped. Maybe anybody had similar issue and may suggest where to add "ICACHE_RAM_ATTR" attribute? Thank you

neu-rah commented 4 years ago

Hi! The builtin encoder uses pin change interrupts and was tested on AVR's only, clickEncoder (an alternative) has been used with esp8266.

One can even use other encode/input method and issue menu commands when appropriate, after reading the input.

codeCtrl example is about menu commands

aliusc commented 4 years ago

Saldy clickEncoder did not compiles for my board, but I'm not sad as I found codeCtrl example! It opens all possibilities of menu I need. I can control rotary encoder and button from my code. So i will adopt my project to work with this menu and get rid my old menu code I used as it is bit hardly maintained. Thank you for your support.