Closed nophead closed 3 years ago
I haven't used the basic OTA update or web updater yet, but it looks interesting. Therefore, I don't have any suggestions at this time regarding what can be done in the OTA code.
Note that with this library, its not really necessary to configure the PWM pin in setup. It will self-configure the pin with whatever parameters you specify on the first iteration, then only apply anything that changes in subsequent loop iterations. Therefore, you could skip the setup and just use analogWrite(FAN, fan_pwm, 20000, 8);
in the loop. Perhaps this would work.
No that still doesn't work. I guess the variables in RAM all get cleared when the program restarts but perhaps the hardware doesn't, so things get out of step.
Passing a value of -1 to detach the pin in ArduinoOTA.onStart() fixes the issue.
For a simple 8 bit 20KHz fan PWM on pin 22 of a DOIT ESP32 DEVKIT V1 :
In
setup()
I have:In
loop()
I have:This works as expected but if I do an over the air update the PWM value gets stuck until I cycle the power and then it works again.
Do I need to do something in the OTA code to stop the PWM or reinitialise it?