Updated error-check for out-of-range PWM frequency (an ESP32-S2 check)
PWM has now been fully tested and verified with an ESP32 device under Arduino-ESP32 versions 1.0.6 and 2.0.0, and with an ESP32-S2 device under Arduino-ESP32 version 2.0.0. Tests confirmed using both high (5000 Hz) and low (1 Hz or 5Hz) frequencies to ensure timers are correctly configured. Next Task: Update RFControl routines for 2.0.0 and ESP32-S2 compatibility.
This commit is contained in:
parent
50bdfd7d37
commit
82ad33c98f
|
|
@ -30,6 +30,8 @@ LedC::LedC(uint8_t pin, uint16_t freq){
|
||||||
timerList[nTimer][nMode]->duty_resolution=(ledc_timer_bit_t)res;
|
timerList[nTimer][nMode]->duty_resolution=(ledc_timer_bit_t)res;
|
||||||
if(ledc_timer_config(timerList[nTimer][nMode])!=0){
|
if(ledc_timer_config(timerList[nTimer][nMode])!=0){
|
||||||
Serial.printf("\n*** ERROR: Frequency=%d Hz is out of allowed range ---",freq);
|
Serial.printf("\n*** ERROR: Frequency=%d Hz is out of allowed range ---",freq);
|
||||||
|
delete timerList[nTimer][nMode];
|
||||||
|
timerList[nTimer][nMode]=NULL;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue