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

Button initial push shows up as button hold while sleeping

Hello all,

I'm using the Nordic SDK 14.2 BSP button handler.  I have a push, release, and long push event on a single button.  These are working as expected -

Except when the device goes to sleep.  I have a push-hold that does the following:

   1.  Turns off LCD
   2.  Turns off BLE advertising
   3.  Turns off a monitoring device
Then, the main loop sends the processor back to sleep as usual via sd_app_evt_wait().

When it is sleeping in this condition, a button hold (2 seconds) wakes the processor back up and it starts BLE advertising again.

If it sleeps long enough (several minutes), the button hold does not work properly.  It triggers a long hold immediately upon pressing the button.

Any ideas?  I checked whether sd_app_evt_wait() is ever waking up in the "sleep" state and it is not.  Perhaps app_timer is elapsing or not restarting properly?

Thanks!

  John

Parents
  • Hi,

    So the problem is that the BLE advertising is not starting again, because the action is 'push and not 'long push'?

    Is the device restarting?

    Maybe you are entering system off mode? Are you calinig sleep_mode_enter() or sd_power_system_off() somewhere?

  • Hi Sigurd,

    Thanks for your reply.  I have not called sleep_mode_enter() or sd_power_system_off() at any point.

    I don't think the device is restarting but I will check.  It is in fact starting up; the problem is that it does not wait for a long push - it starts immediately after touching the button. This generates a button press event, which is erroneously marked as a long push.

    Also to clarify, it usually works properly.  Occasionally, however, after being in standby (sd_app_evt_wait()) long enough the event occurs.

Reply
  • Hi Sigurd,

    Thanks for your reply.  I have not called sleep_mode_enter() or sd_power_system_off() at any point.

    I don't think the device is restarting but I will check.  It is in fact starting up; the problem is that it does not wait for a long push - it starts immediately after touching the button. This generates a button press event, which is erroneously marked as a long push.

    Also to clarify, it usually works properly.  Occasionally, however, after being in standby (sd_app_evt_wait()) long enough the event occurs.

Children
No Data
Related