timer issue

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
michelin
New user
Posts: 3
Joined: 17 Jul 2020, 11:34

timer issue

#1 Post by michelin » 17 Jul 2020, 12:04

hi

i implemented this rules in easyesp to control a co2 valve for my aquarium

on System#Boot do
GPIO,5,0
timerSet,1,1
endon

On Rules#Timer=1 do
Pulse,5,1,40
timerSet,1,1
endon

mainly gio5 is used to activate the valve every second or less. the issue is that i checked at scope and the signal has an additional delay of 1 second. So when i put 1 in timerSet we have 2 second if i put 5 i have 6 second and so on....here is the issue in my code? is there any way to go lower than 1 second?

br
Amedeo

TD-er
Core team member
Posts: 8729
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: timer issue

#2 Post by TD-er » 17 Jul 2020, 12:18

The timer based execution of rules may have some latency in processing.
For example if something uses a blocking call, like sending data to a server or a timeout for a network request, you may be 'late' in executing rules events.

Also we don't have a timer option operating on msec resolution.
If timing is critical, I don't think running an ESP which does also do a lot of other stuff is the best choice here.
For example maintaining the network connectivity may sometimes stall the node for an undefined amount of time, which makes true real time operations impossible.

michelin
New user
Posts: 3
Joined: 17 Jul 2020, 11:34

Re: timer issue

#3 Post by michelin » 17 Jul 2020, 13:04

i understand ....but what was strange that i have 1 second of latecy.....probably is due to the manager of the timer......but i really dont know.....it is not due to network hanging of something like that......instead the time of the pulse is correct and is reflecting exactly what i programmed...

br
Amedeo

TD-er
Core team member
Posts: 8729
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: timer issue

#4 Post by TD-er » 17 Jul 2020, 14:16

What if you swap these 2 lines:

Code: Select all

timerSet,1,1
Pulse,5,1,40
Edit:
And maybe change the "pulse" into "LongPulse_mS"
That call is non blocking.

michelin
New user
Posts: 3
Joined: 17 Jul 2020, 11:34

Re: timer issue

#5 Post by michelin » 17 Jul 2020, 15:00

swapping the instrunctions doesnt change......

long pulse is not working in my firmware.....probably was implemented just in the last version

TD-er
Core team member
Posts: 8729
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: timer issue

#6 Post by TD-er » 17 Jul 2020, 23:39

Well not really the last version... I guess it is in there for over a year now.

User avatar
Ath
Normal user
Posts: 3480
Joined: 10 Jun 2018, 12:06
Location: NL

Re: timer issue

#7 Post by Ath » 09 Aug 2020, 17:20

TD-er added a pull-request implementing a timer with milliseconds resolution, and 2 repeating (loop) timers (no need to restart after the timer fired, with seconds and milliseconds resolutions).
It can be found here: https://github.com/letscontrolit/ESPEasy/pull/3204
There are downloads available from that link for testing, and some examples as well.
/Ton (PayPal.me)

Post Reply

Who is online

Users browsing this forum: No registered users and 10 guests