I am on 147 RC8.
I use a sonoff 4CH device to control my sunscreen.
I use longpulse for it.
However it seems to be not very accurate.
When I send /control?cmd=LongPulse,15,1,1 it runs for 2.3 seconds
When i send a longpulse of 5, it runs for 5.5 seconds.
Is there a way to make a long pulse of 1 second really 1 second?
Long pulse accurrancy
Moderators: grovkillen, Stuntteam, TD-er
-
- Core team member
- Posts: 3621
- Joined: 19 Jan 2017, 12:56
- Location: Hudiksvall, Sweden
Re: Long pulse accurrancy
I don't know the behind the scenes code that is handling this but you could try to use rules instead.
Trigger through:
http://<espeasyip>/control?cmd=event,1secondPulse
http://<espeasyip>/control?cmd=event,5secondPulse
Code: Select all
On 1secondPulse do
gpio,12,1
timerSet,1,1 //timer 1 set for 1 second
endon
On 5secondPulse do
gpio,12,1
timerSet,1,5 //timer 1 set to 5 seconds
endon
On Rules#Timer=1 do
gpio,12,0
endOn
http://<espeasyip>/control?cmd=event,1secondPulse
http://<espeasyip>/control?cmd=event,5secondPulse
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: Long pulse accurrancy
1 second should be considered short here. So better use the normal pulse command if you need this level of accuracy.ewaldharmsen wrote: ↑22 Jun 2017, 08:07 I am on 147 RC8.
I use a sonoff 4CH device to control my sunscreen.
I use longpulse for it.
However it seems to be not very accurate.
When I send /control?cmd=LongPulse,15,1,1 it runs for 2.3 seconds
When i send a longpulse of 5, it runs for 5.5 seconds.
Is there a way to make a long pulse of 1 second really 1 second?
(Longpulses are timed in background and with single threaded processing this can be inaccurate, unless it's build with hardware timers and interrupts)
-
- Normal user
- Posts: 66
- Joined: 16 Feb 2017, 09:23
Re: Long pulse accurrancy
Thanks all!
I am using normal pulse now, that seems to work better. Problem solved
I am using normal pulse now, that seems to work better. Problem solved
-
- Normal user
- Posts: 469
- Joined: 03 Jan 2017, 10:58
- Location: Germany
Re: Long pulse accurrancy
Yes normal pulse is much better for accurate timing. The reason for that accuracy is also the biggest downside of normal pulse: it blocks the ESP --> rules and webinterface do not respond in that time. AFAIK even the Timers in Rules get delayed. So its your choice: accurate but blocking, or less accurate and non-blockingewaldharmsen wrote: ↑23 Jun 2017, 13:19 Thanks all!
I am using normal pulse now, that seems to work better. Problem solved
Domoticz on Raspi 2 -- 14 ESP units (hacked Sonoff,NodeMCUs, Wemos, self-built units) running with RC140- Mega 2.0.0 dev8
-
- Normal user
- Posts: 66
- Joined: 16 Feb 2017, 09:23
Re: Long pulse accurrancy
clear explanation, thanks!
Who is online
Users browsing this forum: Anthropic Claude Bot [bot], Bing [Bot] and 18 guests