ESPEasy - Device=PushButton - Delays of feedback [ISSUE FIXED]

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
papperone
Normal user
Posts: 497
Joined: 04 Oct 2016, 23:16

ESPEasy - Device=PushButton - Delays of feedback [ISSUE FIXED]

#1 Post by papperone » 17 Oct 2016, 10:29

Hi, I've been running this issue since I started using ESPEasy and I cannot find a way to solve it even looking at the code.
I setup a push button (physically attached to GPIO13/D7 to one of my unit) as per below:
Image

No matter what I setup (I tried literally everythign!) once I press the button I've an immediate change of its status to "1" that is triggering a relay.
But it takes around 1300ms (as per below screeshot) after I release the button until the device status is back to 0; this means if someone push the button meanwhile nothing happens!!!
Image

How can I have immediate reset of device status once button is released?
I've a virtual switch on node-red that sends on/off command to the same relay and this is perfectly working and I can send command once after the other without delays or lags.
If anyone can help or address me to the right piece of code handling this behaviour I'll be very thankfull...
Last edited by papperone on 27 Oct 2016, 11:11, edited 1 time in total.
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

papperone
Normal user
Posts: 497
Joined: 04 Oct 2016, 23:16

Re: ESPEasy - Device=PushButton - Delays of feedback

#2 Post by papperone » 18 Oct 2016, 10:32

Am I the only one with this problem?
Isn't there any other user using ESPEasy to get input from a physical push-button?
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

User avatar
moelski
Normal user
Posts: 126
Joined: 31 Aug 2016, 06:33
Location: Germany - NRW
Contact:

Re: ESPEasy - Device=PushButton - Delays of feedback

#3 Post by moelski » 18 Oct 2016, 13:31

Hi !

EVENT: indicates that you are using Rules ...
And the Rules are only fired once a second. Look at the code:

Code: Select all

void runOncePerSecond()
{
.....
  if (Settings.UseRules)
    rulesTimers();
I think that is your missing second ... And while the runOncePerSecond has to do a lot other stuff ... You end up with 1300ms ...

I suppose :ugeek:
regards
Dominik

papperone
Normal user
Posts: 497
Joined: 04 Oct 2016, 23:16

Re: ESPEasy - Device=PushButton - Delays of feedback

#4 Post by papperone » 18 Oct 2016, 14:45

moelski wrote:Hi !

EVENT: indicates that you are using Rules ...
And the Rules are only fired once a second. Look at the code:

Code: Select all

void runOncePerSecond()
{
.....
  if (Settings.UseRules)
    rulesTimers();
I think that is your missing second ... And while the runOncePerSecond has to do a lot other stuff ... You end up with 1300ms ...

I suppose :ugeek:
Thanks moelski, this indeed makes sense...
Now the issue is how to fix it :( I will give a thought this evening once back home...
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

User avatar
moelski
Normal user
Posts: 126
Joined: 31 Aug 2016, 06:33
Location: Germany - NRW
Contact:

Re: ESPEasy - Device=PushButton - Delays of feedback

#5 Post by moelski » 19 Oct 2016, 11:31

Hi !
Now the issue is how to fix it
Good question 8-)

* You could move the rule handling in the 100ms timer...
* You can add a custom timer for rules ... (I have done that with my Wifi Candle. It uses 40Hz update rate ...)
* Maybe write a plugin that don´t depend on rules ...

I think there are quit a few options. But most of them need coding ... :roll:
regards
Dominik

papperone
Normal user
Posts: 497
Joined: 04 Oct 2016, 23:16

Re: ESPEasy - Device=PushButton - Delays of feedback

#6 Post by papperone » 19 Oct 2016, 11:56

Coding is the less of my worries :) I just want make sure I choose the best option with minimal impact for me.
I guess the safest is to write my own plugin so I will disconnect from all the rules while maintaininig easy upgrate to future version of ESPEasy, but I do like as well the custom timer option...

I need further testing as I do believe there are other sources of delays, in the way the switch is handled in ESPEasy actual code, but it's just a sensation that needs to be confirmed or not looking to the code!

Will keep you updated on the evolution...
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

papperone
Normal user
Posts: 497
Joined: 04 Oct 2016, 23:16

Re: ESPEasy - Device=PushButton - Delays of feedback

#7 Post by papperone » 20 Oct 2016, 07:48

moelski wrote:* You can add a custom timer for rules ... (I have done that with my Wifi Candle. It uses 40Hz update rate ...)
Can you elaborate a bit more on this? Maybe shareing your wifi candle code will help me to leverage this technique and try to implement it for my push button handling...
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

Martinus

Re: ESPEasy - Device=PushButton - Delays of feedback

#8 Post by Martinus » 26 Oct 2016, 17:50

papperone wrote:Hi, I've been running this issue since I started using ESPEasy and I cannot find a way to solve it even looking at the code.
I setup a push button (physically attached to GPIO13/D7 to one of my unit) as per below:
Image

No matter what I setup (I tried literally everythign!) once I press the button I've an immediate change of its status to "1" that is triggering a relay.
But it takes around 1300ms (as per below screeshot) after I release the button until the device status is back to 0; this means if someone push the button meanwhile nothing happens!!!
Image

How can I have immediate reset of device status once button is released?
I've a virtual switch on node-red that sends on/off command to the same relay and this is perfectly working and I can send command once after the other without delays or lags.
If anyone can help or address me to the right piece of code handling this behaviour I'll be very thankfull...
This could be due to the default 1000 mSec delay after sending stuff to your controller. Try what happens if you set it to 0.

papperone
Normal user
Posts: 497
Joined: 04 Oct 2016, 23:16

Re: ESPEasy - Device=PushButton - Delays of feedback

#9 Post by papperone » 26 Oct 2016, 20:09

Martinus wrote: This could be due to the default 1000 mSec delay after sending stuff to your controller. Try what happens if you set it to 0.
I am not sure I understand. I don't see any delay parameter in the controller setup I have when I connect to ESPEasy device. Can you help clarify?

PS in RC firmware the footer should be changed to new domain instead of www.esp8266.nu
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

Martinus

Re: ESPEasy - Device=PushButton - Delays of feedback

#10 Post by Martinus » 26 Oct 2016, 22:08

Check this setting in tools/advanced menu:

Message Delay (ms):

defaults to 1000 but can be lowered. This could be the delay that you're experiencing.

papperone
Normal user
Posts: 497
Joined: 04 Oct 2016, 23:16

Re: ESPEasy - Device=PushButton - Delays of feedback

#11 Post by papperone » 27 Oct 2016, 11:11

Martinus wrote:Check this setting in tools/advanced menu:

Message Delay (ms):

defaults to 1000 but can be lowered. This could be the delay that you're experiencing.
Thanks Martinus, that was it! I admit I've never realize there was such parameter in the Advanced Tab.
FYI bringing it to 0 did not work as the button behaviour was faster but unstable, with lots of false event.
With tome trial&error I set it to 100ms, really stable and button reacts real time even with multiple pushes one after the other!

Thanks again, I'll update the title as issue is fixed :D
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

Domosapiens
Normal user
Posts: 307
Joined: 06 Nov 2016, 13:45

Re: ESPEasy - Device=PushButton - Delays of feedback [ISSUE FIXED]

#12 Post by Domosapiens » 14 Nov 2017, 23:50

Thanks Martinus for this explanation.
I thought this variable was related to MQTT only.

Some of my DS18B20 have an update rate of 500msec (close to the heater), so I tried to lower the message delay to 400msec.
The result was a very spiked memory usage: from normal operation 20300 bytes down to spikes of 14200 and even 12600.
Can you understand why? Is it something to worry about?

Martinus, what will happen with the measurements made every 500msec when the messages to the controller are send only every 1000msec?

@papperone: did you check your memory usage with the 100msec setting?
Thanks
Domosapiens
30+ ESP units for production and test. Ranging from control of heating equipment, flow sensing, floor temp sensing, energy calculation, floor thermostat, water usage, to an interactive "fun box" for my grandson. Mainly Wemos D1.

papperone
Normal user
Posts: 497
Joined: 04 Oct 2016, 23:16

Re: ESPEasy - Device=PushButton - Delays of feedback [ISSUE FIXED]

#13 Post by papperone » 15 Nov 2017, 06:56

Domosapiens wrote:
14 Nov 2017, 23:50
Thanks Martinus for this explanation.
I thought this variable was related to MQTT only.

Some of my DS18B20 have an update rate of 500msec (close to the heater), so I tried to lower the message delay to 400msec.
The result was a very spiked memory usage: from normal operation 20300 bytes down to spikes of 14200 and even 12600.
Can you understand why? Is it something to worry about?

Martinus, what will happen with the measurements made every 500msec when the messages to the controller are send only every 1000msec?

@papperone: did you check your memory usage with the 100msec setting?
Thanks
Domosapiens
I did and I saw no differences... this setting, in my case, was only affecting the reactiveness of some devices (swtiches) that's it...
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

Post Reply

Who is online

Users browsing this forum: No registered users and 15 guests