This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Button long press strange behaviour(SDK12.3)

main.cHi,

I have implemented button long press with APP_BUTTON library with APP timer (a 5 seconds timer). Normally the detection works fine.

But I found that if the system has been left running for a period of time, it will immediate trigger the long press handler when i press the button (instead of after 5 seconds).

The pin in question is P0 (update. tested on another button have similar effect)

Any idea on this??

Thanks.

Parents
  • Thanks~

    • It is initialised in main: APP_TIMER_DEF(button_power_5sec_timer_id); //define 5 second timer id

    • Is configured as single shot timer

      case APP_BUTTON_RELEASE: NRF_LOG_INFO("Button%d Released \r\n", pin_no); switch(pin_no) { case BUTTON_POWER: app_timer_stop(button_power_5sec_timer_id); button_power_5sec_timer_enabled=false; break; case BUTTON_A: app_timer_stop(button_a_5sec_timer_id); button_a_5sec_timer_enabled=false; change_op_mode(); break; } break;

Reply
  • Thanks~

    • It is initialised in main: APP_TIMER_DEF(button_power_5sec_timer_id); //define 5 second timer id

    • Is configured as single shot timer

      case APP_BUTTON_RELEASE: NRF_LOG_INFO("Button%d Released \r\n", pin_no); switch(pin_no) { case BUTTON_POWER: app_timer_stop(button_power_5sec_timer_id); button_power_5sec_timer_enabled=false; break; case BUTTON_A: app_timer_stop(button_a_5sec_timer_id); button_a_5sec_timer_enabled=false; change_op_mode(); break; } break;

Children
No Data
Related