Page 1 of 1

Detecting double clicks, long clicks on ext0 wake up source

Posted: Fri Sep 01, 2017 12:42 am
by mustafacc
Hi,

So I have my esp32 setup on deep sleep with ext0 wake up condition, everything works fine and all but I was wondering is it possible to detect "the type of click" on ext0? as in if the pin which ext0 is attached to is double pressed or long pressed. So far I can't get that to work because of the esp32 wake up boot time.

Cheers,

Re: Detecting double clicks, long clicks on ext0 wake up source

Posted: Fri Sep 01, 2017 1:35 am
by ESP_Sprite
You may be able to use an ULP program to do this.

Re: Detecting double clicks, long clicks on ext0 wake up source

Posted: Fri Sep 01, 2017 1:51 am
by mustafacc
Will ULP work with ext0? because according to http://esp-idf.readthedocs.io/en/latest ... sleep.html

"In revisions 0 and 1 of the ESP32, this wakeup source is incompatible with ULP and touch wakeup sources."

Is there an example on how to program the ULP that I can refer to? I'm using Mongoose OS with C if that matters.

Re: Detecting double clicks, long clicks on ext0 wake up source

Posted: Fri Sep 01, 2017 1:54 am
by ESP_Sprite
It will not, but if you're using the ULP to detect stuff, you may as well use it to wake the main processor.

There's a pulse counting example for the ULP in esp-idf, maybe you can modify that to do what you want?

Re: Detecting double clicks, long clicks on ext0 wake up source

Posted: Mon Sep 04, 2017 10:13 pm
by mustafacc
I'm having another issue related to ext0 wake up but I didn't want to open another thread so here it is

I have my ext0 attached to gpio33 (which is an rtc gpio). In terms of hardware, it is simply attached to a button that will ground it as soon as the button is pressed.

I'm printing the wakeup reason as soon as the program initiates using esp_deep_sleep_get_wakeup_cause(); and I'm getting ESP_DEEP_SLEEP_WAKEUP_UNDEFINED as the wakeup cause if the button press is too short, however, if the button press is long enough then the wakeup cause is actually correct (ESP_DEEP_SLEEP_WAKEUP_EXT0).

I have enabled the internal pull-up resistor to that pin as well with gpio_pullup_en(GPIO_NUM_33)

Is there a reason why this is happening?

Re: Detecting double clicks, long clicks on ext0 wake up source

Posted: Wed Sep 06, 2017 4:46 am
by mustafacc
Can anyone please give me any hints or insight about that ^?