Double press of setup button

Hello

Just wondering what the story is with double pressing the setup button, I find on all my devices running 0.4.7 it causes the LED to show a dim white color, which doesn’t revert to normal until the unit is reset.
Is this intended behavior? I can’t find anything in the docs about it…

I don’t see this behaviour on mine.
Is this a quick double-press (like you’d do a double-click on a mouse) or slower,

Are you sure this hasn’t got anything to do with your code on the devices?
I know there is a double-tap to send the Electron to sleep, but I didn’t think this was a feature on the Photons.

Thanks for your reply @ScruffR, yes a quick press, but it doesn’t have to be super quick, as in it’s quite easy to do. I first noticed this on custom hardware/software but I’ve replicated it on an unmodified photon running 0.4.7 with tinker installed. I’m surprised no one else has noticed this…

I have tested five devices and none of them does it.

On one of them I just performed a particle update with the most recent version of CLI and it still doesn’t do it.
So I’m rather confused about what you are seeing.

Thanks for taking a look, I’ve just found that one of my devices doesn’t do it, which gives me some more information. I’ll post back once I figure it out. I am running the latest develop branch which I should have mentioned…

Yup, that would have helped, since it is quite possible that the double-tap introduced for the Electron might be bleading into the Photon or might even be incorporated as a proper feature which will be doced some time :wink:

1 Like

Ok I reverted to the stable 0.4.7 and that seems to have fixed it. Sorry I forgot to mention that. It’s unfortunate as I was hoping to utilise a ‘quick press’ of the setup button to cycle through another mode. Not sure how I’ll do that now. Perhaps the new feature can be disabled. Any ideas @mdma?

Could you please explain the double tap feature and what function it calls in the firmware?

@G65434_2, I’m not sure what you want to do with the SETUP button, but give this a try

This already works on (stable) 0.4.7

void button_handler(system_event_t event, uint32_t duration, void* )
{
    if (!duration) { // just pressed
        RGB.control(true);
        RGB.color(255,0,128);
    }
    else {    // just released
        RGB.control(false);
    }
}

void setup(void)
{    
     System.on(button_status, button_handler);
}

@jvanier, on the Electron a double-tap on the SETUP button sends the device to sleep, e.g. if you only want to charge the battery but don’t want the device to be running.
Before the charging setup was tweaked, it could happen that despite having the device powered via USB the battery got drained when the device was left on.
A hardware workaround was to tie RST low, but this was not too nice, so this software was a workaround got introduced, which has developed into a feature.
No idea what function it calls, but Mat would sure know :wink:

1 Like

Thanks @ScruffR

I had seen this in another thread, and I’ve got it to work. Only problem is now with the latest firmware, if the user tries to cycle through my ‘modes’ too fast it will make the device go to sleep!

@mdma

Are you able to say if this ‘double tap’ feature will be able to be disabled in 0.4.8?
I have a mains powered product so won’t be needing the sleep feature.
The reason I’m asking is I’m about to order some menu overlays and would like to know if I can add an additional function to the setup button. As above if a user quick presses the setup button twice then it will go into ‘sleep’ instead of incrementing my menu twice if you get what I mean.

Hey all! This double tap (and now single tap) feature will be disabled in v0.4.9 for Photon. This PR addresses the issue while adding single tap for Electron RSSI UX https://github.com/spark/firmware/pull/767 (video to see it in action there)

In the future we would like to make the single/double tap feature user toggle-able, with it defaulting to off on non-electron devices (on for electron).

Do you think these would be useful features for the Photon/P1?

  • single tap = RSSI UX on RGB LED (0 - 5 bars representation)
  • double tap = System Deep Sleep (aka Soft Power Down) - wake up with RESET button, low on RST or active high on WKP pin.
3 Likes

Hi @BDub

Thanks for your reply, when you say it will be disabled in v0.4.9 do you mean 0.4.8? Or is 0.4.8 about to be released with the double tap feature included?

Purely from a product creator point of view I think it’s really important that this button does retain the ability to be customizable (at least from a quick press perspective). I’ve really tried to minimise the number of buttons on my product, hence the double use of the setup button.
Otherwise I think the features you’ve mentioned would be useful to have as an option :smile:

Can you give any indication as to when 0.4.8 will be released?

Cheers

0.4.8 was an internal release to manufacturing. 0.4.9 will be the next public release.

This is just a change in numbers - the schedule hasn’t changed.

All hands are on Electron right now - as soon as that is delivered we can focus on a Photon release, which will be early January.

1 Like