Switch Button Long Push
Moderators: grovkillen, Stuntteam, TD-er
-
- Normal user
- Posts: 25
- Joined: 31 Jul 2018, 11:41
Switch Button Long Push
Hi,
I have a question regarding the use case when using a button.
- Is there a way to detect a long push (for example, to implement a dimmer -short push on/off, long push pwm increase)
I have a question regarding the use case when using a button.
- Is there a way to detect a long push (for example, to implement a dimmer -short push on/off, long push pwm increase)
Re: Switch Button Long Push
Honestly I don't like this workaround (it's not a real short/long push implementation) as 1 second can be too low and 2 seconds will make the normal behaviour odd (I push and release immediately but need to way 2 sec until the light will turn on).
I truly believe this should be implemented differently (if I press and release the action shuould be immediately triggered as it's pointless waiting the threshold for the long press) and it must be coded in ESPEasy and not in the rules (unless we change the rule interpretation to handle the above scenario properly...)
My TINDIE Store where you can find all ESP8266 boards I manufacture --> https://www.tindie.com/stores/GiovanniCas/
My Wiki Project page with self-made PCB/devices --> https://www.letscontrolit.com/wiki/inde ... :Papperone
My Wiki Project page with self-made PCB/devices --> https://www.letscontrolit.com/wiki/inde ... :Papperone
-
- Normal user
- Posts: 25
- Joined: 31 Jul 2018, 11:41
Re: Switch Button Long Push
Agreed,
long push should be implemented by the espeasy firmware. I wonder why such a basic feature hasnt been implemented before?
long push should be implemented by the espeasy firmware. I wonder why such a basic feature hasnt been implemented before?
- grovkillen
- Core team member
- Posts: 3621
- Joined: 19 Jan 2017, 12:56
- Location: Hudiksvall, Sweden
- Contact:
Re: Switch Button Long Push
The new scheduler will make it possible to have a higher resolution than seconds. So the timer will be working with 100mSec steps.
ESP Easy Flasher [flash tool and wifi setup at flash time]
ESP Easy Webdumper [easy screendumping of your units]
ESP Easy Netscan [find units]
Official shop: https://firstbyte.shop/
Sponsor ESP Easy, we need you
ESP Easy Webdumper [easy screendumping of your units]
ESP Easy Netscan [find units]
Official shop: https://firstbyte.shop/
Sponsor ESP Easy, we need you
Re: Switch Button Long Push
Just to make that remark a bit more clear, for that one person not familiar with the recent changes in the codegrovkillen wrote: ↑01 Aug 2018, 11:27 The new scheduler will make it possible to have a higher resolution than seconds. So the timer will be working with 100mSec steps.
I am now working on a new global GPIO handler to detect and handle GPIO inputs.
This handler will poll the GPIO states quite often and record timings for plugins to collect.
When this handler detects a change, it can schedule a plugin to manage the changes.
Just to make it clear, there will be support for it, but it is being worked on and proper operations also depends on improvement of timings, which is partly being dealt with by the new scheduler.
Re: Switch Button Long Push
Not sure I understood how this improvement should help to detect faster short/long push... Can you elaborate more?grovkillen wrote: ↑01 Aug 2018, 11:27 The new scheduler will make it possible to have a higher resolution than seconds. So the timer will be working with 100mSec steps.
My TINDIE Store where you can find all ESP8266 boards I manufacture --> https://www.tindie.com/stores/GiovanniCas/
My Wiki Project page with self-made PCB/devices --> https://www.letscontrolit.com/wiki/inde ... :Papperone
My Wiki Project page with self-made PCB/devices --> https://www.letscontrolit.com/wiki/inde ... :Papperone
- grovkillen
- Core team member
- Posts: 3621
- Joined: 19 Jan 2017, 12:56
- Location: Hudiksvall, Sweden
- Contact:
Re: Switch Button Long Push
You can then have a timer that would detect a hold that is less than one second since the timer would allow to be sub secund.
ESP Easy Flasher [flash tool and wifi setup at flash time]
ESP Easy Webdumper [easy screendumping of your units]
ESP Easy Netscan [find units]
Official shop: https://firstbyte.shop/
Sponsor ESP Easy, we need you
ESP Easy Webdumper [easy screendumping of your units]
ESP Easy Netscan [find units]
Official shop: https://firstbyte.shop/
Sponsor ESP Easy, we need you
Re: Switch Button Long Push
well I don't htink this will fix the problem, let me explain:grovkillen wrote: ↑02 Aug 2018, 06:24 You can then have a timer that would detect a hold that is less than one second since the timer would allow to be sub secund.
I woudl like a long push to be triggered after 2 seconds
I would like any time below 2 seconds to be recognized as short push
I would like the short pulse event to be triggered immediately not waiting the 2 secs of the long pulse threshold
and while 2 seconds can maybe still be reasonable for some users, let's imagine I want long pulse threshold 5 seconds or more!
Doing this with rules is complex and really not optimized, while in a proper "push button" plugin this can be implemented much more effectively without any rules if not the actions to be executed for all the possible events.
To summarize I'd like the push button device to be able to trigger at least 2 events with different timing (long push = fixed threshold, short push = variable threshold within the long push limit and immediate) and avoid false long push (with above ruleset if I press quickly 2 or more times within the threshold I could trigger the long push); and I think more events can be detected (double push, triple push, etc...)
I have no time unfortunately those days/weeks due to work related issues and as well I've been on deserved vacation for 3 weeks, but if nobody will be avail I'll add it anyway to the list of improvements I'd like to work with for ESPEasy
My TINDIE Store where you can find all ESP8266 boards I manufacture --> https://www.tindie.com/stores/GiovanniCas/
My Wiki Project page with self-made PCB/devices --> https://www.letscontrolit.com/wiki/inde ... :Papperone
My Wiki Project page with self-made PCB/devices --> https://www.letscontrolit.com/wiki/inde ... :Papperone
- grovkillen
- Core team member
- Posts: 3621
- Joined: 19 Jan 2017, 12:56
- Location: Hudiksvall, Sweden
- Contact:
Re: Switch Button Long Push
I think we're on the same page here. Only a quick add to the discussion. The upcoming GPIO handler will make stuff like this possible.
ESP Easy Flasher [flash tool and wifi setup at flash time]
ESP Easy Webdumper [easy screendumping of your units]
ESP Easy Netscan [find units]
Official shop: https://firstbyte.shop/
Sponsor ESP Easy, we need you
ESP Easy Webdumper [easy screendumping of your units]
ESP Easy Netscan [find units]
Official shop: https://firstbyte.shop/
Sponsor ESP Easy, we need you
Re: Switch Button Long Push
that's great news!!!grovkillen wrote: ↑02 Aug 2018, 12:09 I think we're on the same page here. Only a quick add to the discussion. The upcoming GPIO handler will make stuff like this possible.
My TINDIE Store where you can find all ESP8266 boards I manufacture --> https://www.tindie.com/stores/GiovanniCas/
My Wiki Project page with self-made PCB/devices --> https://www.letscontrolit.com/wiki/inde ... :Papperone
My Wiki Project page with self-made PCB/devices --> https://www.letscontrolit.com/wiki/inde ... :Papperone
Re: Switch Button Long Push
Just for completeness, a part of the discussion between Jimmy and I about this:
The idea is to read 1 single register to inspect all GPIO pins. Mask (AND) that with just the bits you want to check and compare with the last known value.
That's about 5 clock cycli, so can be done as often as possible.
When something has changed, it has to see what bit has changed (XOR) and process the change.
Such a change may result in an "event", which is now not more than add a job to the scheduler.
Then the plugin that should deal with the event can read the last change, the time high and the time low.
Also we have the actual pin state, because it is not cached
Re: Switch Button Long Push
hello, I'm making a switchboard with 4 channel mains relay module with 4 buttons. I want when one of the buttons long pressed to turn ON/OFF all 4 relays. anyway, Can I do this?
I love playing a digital piano
Re: Switch Button Long Push
I've done it with this plugin:
https://github.com/enesbcs/ESPEasyPlugi ... button.ino
Using "butonname#Longpress" event on all four buttons.
Re: Switch Button Long Push
enesbcs wrote: ↑29 Nov 2018, 12:08I've done it with this plugin:
https://github.com/enesbcs/ESPEasyPlugi ... button.ino
Using "butonname#Longpress" event on all four buttons.
Just wanted to say thanks for this. I've been using the plugin for ~ 6 months now
I also wrote a blog post about how to use it as well
https://techlife.nz/blog/create-an-esp8 ... g-espeasy/
Re: Switch Button Long Push
Thanks for mentioning. In fact, the new P001_Switch plugin in ESPEasy also capable of sensing longpress and doubleclick events.mattie47 wrote: ↑18 Jun 2019, 12:05 Just wanted to say thanks for this. I've been using the plugin for ~ 6 months now
I also wrote a blog post about how to use it as well
https://techlife.nz/blog/create-an-esp8 ... g-espeasy/
Who is online
Users browsing this forum: Bing [Bot] and 3 guests