rwmingis / InterruptButton

This is an interrupt based button event library for the ESP32. It enables binding user defined actions to button events including 'Key Down', Key Up' , 'Key Press', 'Long Key Press' 'AutoRepeat Press' and 'Double-Click'. The actions associated it these events may be executed Asynchronously, Synchronously, or a Hybrid between the two.
MIT License
30 stars 8 forks source link

interruptbutton stops working after some time #14

Closed goutamreddy closed 1 year ago

goutamreddy commented 1 year ago

Hi,

I'm using your library (thank you for making it!) as a component with esp-idf 4.4.2 on a TTGO T-Display (dual-core ESP32 V3).

I noticed that after some amount of time, the buttons become unresponsive - trying to figure out why.

Setting up the modules as such:

InterruptButton button_bottom(BUTTON_1, LOW);
InterruptButton button_top(BUTTON_2, LOW);

void buttonSetup()
{
  InterruptButton::setMenuCount(0);
  InterruptButton::setMenuLevel(0);               // Use the functions bound to the first menu associated with the button
  //InterruptButton::m_RTOSservicerStackDepth = 4096; // Use larger values for more memory intensive functions if using Asynchronous mode.
  InterruptButton::setMode(Mode_Asynchronous);    // Defaults to Asynchronous (immediate like an ISR and not actioned in main loop)
  buttonPressActions();
}
void buttonPressActions() {
  button_top.bind(Event_LongKeyPress, 0, []() {   // LONG PRESS ON BUTTON 2
      displayLCD(LCD_Something);
  });

  button_top.bind(Event_KeyPress, 0, []() {   // PRESS ON BUTTON 2
      displayLCD(LCD_Something);
  });

  button_top.bind(Event_DoubleClick, 0, []() {   // DOUBLE-CLICK ON BUTTON 2
      displayLCD(LCD_Something);
  });

  button_bottom.bind(Event_KeyPress, 0, []() {  // PRESS ON BUTTON 1
      displayLCD(LCD_Something);
  });

  button_bottom.bind(Event_DoubleClick, 0, []() {  // DOUBLE-CLICK ON BUTTON 1
      displayLCD(LCD_Something);
  });
}

Behavior- after some unknown amount of time, the button events stop being triggered. No errors. No stack overflows. It appears the rest of program execution keeps chugging along.

rwmingis commented 1 year ago

Hi There goutamreddy,

Glad to hear you are liking the library, bit sorry to hear you are having a bit of strife here.

Am travelling for work ATM so a bit short of time but, in the meantime, a few things come to mind:

Will have a better look when I return home but those are my first thoughts. Let me know how you go with any testing relative to the notes above .

Cheers

Rob

On Wed, 23 Nov 2022 at 17:11, goutamreddy @.***> wrote:

Hi,

I'm using your library (thank your for making it!) as a component with esp-idf 4.4.2 on a TTGO T-Display (dual-core ESP32 V3).

*I noticed that after some amount of time, the buttons become unresponsive

  • trying to figure out why.*

Setting up the modules as such: ` InterruptButton button_bottom(BUTTON_1, LOW); InterruptButton button_top(BUTTON_2, LOW); boolean button_bottom_pressed_flag = false; boolean button_bottom_double_clicked_flag = false;

void buttonSetup() { InterruptButton::setMenuCount(0); InterruptButton::setMenuLevel(0); // Use the functions bound to the first menu associated with the button //InterruptButton::m_RTOSservicerStackDepth = 4096; // Use larger values for more memory intensive functions if using Asynchronous mode. InterruptButton::setMode(Mode_Asynchronous); // Defaults to Asynchronous (immediate like an ISR and not actioned in main loop) buttonPressActions(); }

void buttonPressActions() { button_top.bind(Event_LongKeyPress, 0, { // LONG PRESS ON BUTTON 2 displayLCD(LCD_Something); });

button_top.bind(Event_KeyPress, 0, { // PRESS ON BUTTON 2 displayLCD(LCD_Something); });

button_top.bind(Event_DoubleClick, 0, { // DOUBLE-CLICK ON BUTTON 2 displayLCD(LCD_Something); });

button_bottom.bind(Event_KeyPress, 0, { // PRESS ON BUTTON 1 displayLCD(LCD_Something); });

button_bottom.bind(Event_DoubleClick, 0, { // DOUBLE-CLICK ON BUTTON 1 displayLCD(LCD_Something); }); }

`

Behavior- after some unknown amount of time, the button events stop being triggered. No errors. No stack overflows. It appears the rest of program execution keeps chugging along.

— Reply to this email directly, view it on GitHub https://github.com/rwmingis/InterruptButton/issues/14, or unsubscribe https://github.com/notifications/unsubscribe-auth/ALW24E7JX2Y476TPI7OJ2XTWJWYR7ANCNFSM6AAAAAASIS2K4E . You are receiving this because you are subscribed to this thread.Message ID: @.***>

goutamreddy commented 1 year ago

Hi Rob,

Thanks for getting back and for the suggestions.

Turns out I had some firmware updating code that disabled actions from the buttons and our OTA code was getting caught after an aborted fw update in an erroreous state.... which is to say the problem lay with our code- not yours - sorry to bother.