-
Notifications
You must be signed in to change notification settings - Fork 4.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Worked on ESP32 dimmer with Zero cross #18481
Conversation
Until now the ESP32 does not support zero-cross dimmer. I take a sneak how they did in in ESPhome and adapted the approach to TASMOTA. At the end it works that smooth that likely i will change ESP8266 either so we have a common code. Currently ESP8266 is not touched. There is a minor issue with savedata == default. When changing the dimmer value the interrupts get stopped during write of the config data to flash.
Worked all so well and the code is much smaller. There is no need for reconfiguration on existing users. But there are settings not needed anymore. Will work on the documentation. Anyhow existing installations can upgrade without hickup
Let me fix the issue. Some #ifdef missing. also checking on Dimmer 2..4. Will let you know when ready |
* Zero-Cross AC Dimmer PMM 1..xx use | ||
\*********************************************************************************************/ | ||
|
||
#define XDRV_91 1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Take xdrv_68 as it's supposed to work for esp8266 too. Do not forget to set it to 68 too. It currently is set to 1 which is not good.
Good choice to start a new driver. |
Yes, it started to get a mess. And I do not like mess. All moved to xdrv68 and als corrected the 1 -> 68. Was not aware that this is important. I got one problem on the ESP32. with savedata ON I got a HANG->CRASH after changing the dimmer value. I already know that during flash write ALL interrupts get "skipped". At least on the counter. Any idea to fix? With speed 40, fade on the hang happens AFTER the final light position is reached. Exactly where the save occur. |
I only happens if the high frequency trigger is in. If all dimmers OFF a savedata 1 works. Here the example with dimmer1 ON. It is not a crash. looks like a long hang
|
The hangs and/or restarts will happen on both savedata > 0 AND any filesystem action. Interrupting flash writes is fatal. The only solution I see is stop your interrupts at flash write times. I once had that functional on the webcam too where fast framerates also failed. They since changed the webcam code so it works again whith file saves. Stopping interrupts on esp32 is an art! Just calling noInterrupt won't work. You'll need to dive into idf or take a look at the ds18b20 driver. |
I worked around by changing the interrupt time. Now it is stable also with savedata. I did not find the hook that notify me to disable because there is an savedata comming. From my point it looks on ESP32 that disableAlarm does work quite well. Anyhow we can commit it here. It works for Esp8266 and ESP32 and for ESP32 it checks on the savedata setting and choose the right timing. |
This should be solved (a while ago) in Arduino code. The code of disabling interrupts was non functional since the beginning until this PR espressif/arduino-esp32#7226 |
Until now the ESP32 does not support zero-cross dimmer. I take a sneak how they did in in ESPhome and adapted the approach to TASMOTA. At the end it works that smooth that likely i will change ESP8266 either so we have a common code. Currently ESP8266 is not touched. There is a minor issue with savedata == default. When changing the dimmer value the interrupts get stopped during write of the config data to flash.
Description:
#14978
Related issue (if applicable): fixes #
Checklist:
NOTE: The code change must pass CI tests. Your PR cannot be merged unless tests pass