Page 1 of 1

PWM dimming, delay, decreasing??

Posted: 02 Apr 2019, 22:53
by bastibasti
Hi,

I'm trying to convert an old avr dimmer to esp8266 with espeasy. So far, hardware works as expected... However, it seems like, when setting the pwm, for example

pwm=12,1024,1000 -> ok nice and smooth
pwm=12,100,1000 -> it goes to 0 and then starts to increase to 100, instead of decreasing from 1024
if you set
pwm=12,0,1000 -> immediately off

is this intentionally or a bug??

Re: PWM dimming, delay, decreasing??

Posted: 03 Apr 2019, 05:09
by ThomasB
I reviewed _P001_Switch.ino to see if there is an explanation. As written, PWM (with optional duration function) is configured to "increase" the PWM value (e.g., brighten effect). It does not offer a traditional fade. But it will wrap around to a lower PWM value when the new PWM value is smaller than the previous. This matches what you are seeing.
is this intentionally or a bug??
I would label it as an intentional bug. :)

- Thomas

Re: PWM dimming, delay, decreasing??

Posted: 07 Apr 2019, 23:14
by bastibasti
what a mess.

mega-20181028 is able to slowly dim down.

are there any notes, why the behaviour was changed?

Re: PWM dimming, delay, decreasing??

Posted: 08 Apr 2019, 01:46
by ThomasB
The switch plugin went through some changes a few weeks ago. There was some discussion on it doing too much. Then it was reverted after things broke. I'm surprised you see it working differently than before.
- Thomas

Re: PWM dimming, delay, decreasing??

Posted: 12 Apr 2019, 21:07
by bastibasti
also, while I'm complaining like an old woman.... an option to set the pwm frequency would be great. like pwmfreq=100 for 100hz

Re: PWM dimming, delay, decreasing??

Posted: 13 Apr 2019, 00:46
by Domosapiens
PWM,<GPIO>,<duty>,<duration>,<frequency>
https://espeasy.readthedocs.io/en/lates ... hlight=pwm

Re: PWM dimming, delay, decreasing??

Posted: 13 Apr 2019, 17:36
by Rampler
This is a known bug !!
Use a version with Core 2.4.1, all is fine ...
I use ESPEasy_mega-20180506 and PWM is working.

Re: PWM dimming, delay, decreasing??

Posted: 13 Apr 2019, 23:05
by bastibasti
Rampler wrote: 13 Apr 2019, 17:36 This is a known bug !!
Use a version with Core 2.4.1, all is fine ...
I use ESPEasy_mega-20180506 and PWM is working.
No it isn't.... dimming down doesnt work on the 20190413 core241 i just loaded

Re: PWM dimming, delay, decreasing??

Posted: 15 Apr 2019, 12:36
by bastibasti
oh,

and I want to add:

/control?cmd=pwm,2,512,7000,500

-> I cannot find any release, where the pwmfreq is set to 500 either

its broken.

Re: PWM dimming, delay, decreasing??

Posted: 20 Apr 2019, 15:25
by Rampler
bastibasti wrote: 13 Apr 2019, 23:05
Rampler wrote: 13 Apr 2019, 17:36 This is a known bug !!
Use a version with Core 2.4.1, all is fine ...
I use ESPEasy_mega-20180506 and PWM is working.
No it isn't.... dimming down doesnt work on the 20190413 core241 i just loaded
As a said, try ESPEasy_mega-20180506 and all is fine ..

Re: PWM dimming, delay, decreasing??

Posted: 23 Apr 2019, 09:29
by bastibasti
I decided to go a different route. I'm currently making a wemos d1 shield with an avr that handles the pwm. (the easyesp also cannot simultaneously dim)

:-(

Re: PWM dimming, delay, decreasing??

Posted: 10 Jul 2019, 21:13
by jbishop129
I can confirm this is still an issue. I can fade up just fine, but cannot fade down. I can also confirm that loading the much older 2018-05-06 version, fading down works just fine. What's the deal with getting this fixed, since this seems to be a regression from over a year ago?

Re: PWM dimming, delay, decreasing??

Posted: 19 Jul 2019, 16:01
by fra290
bastibasti wrote: 02 Apr 2019, 22:53
... So far, hardware works as expected...
I'm interested to have the Hardware project, can you share?
MArco

Re: PWM dimming, delay, decreasing??

Posted: 29 Jul 2019, 14:50
by bastibasti
... so far still making changes and adjusting. might need a little change in hardware if i cannot adjust the speed correctly. I will reply to you later

Re: PWM dimming, delay, decreasing??

Posted: 04 Aug 2019, 15:35
by TD-er
This issue was caused by the pin state monitor which has been changed a while ago.
This tried to store the current PWM value in a parameter of only a few bits.
I just created a fix for this and it will be merged later today (and thus included in tomorrow's build)