File tree Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -392,7 +392,12 @@ static void set_freq(machine_pwm_obj_t *self, unsigned int freq) {
392
392
timer .deconfigure = false;
393
393
394
394
timer .clk_cfg = LEDC_AUTO_CLK ;
395
-
395
+ #if !(CONFIG_IDF_TARGET_ESP32 || CONFIG_IDF_TARGET_ESP32S2 )
396
+ ledc_clk_cfg_t clk_cfg = find_clock_in_use ();
397
+ if (clk_cfg != LEDC_AUTO_CLK ) {
398
+ timer .clk_cfg = clk_cfg ;
399
+ } else
400
+ #endif
396
401
if (self -> lightsleep ) {
397
402
timer .clk_cfg = LEDC_USE_RC_FAST_CLK ; // 8 or 20 MHz
398
403
} else {
@@ -414,7 +419,7 @@ static void set_freq(machine_pwm_obj_t *self, unsigned int freq) {
414
419
}
415
420
#if !(CONFIG_IDF_TARGET_ESP32 || CONFIG_IDF_TARGET_ESP32S2 )
416
421
// Check for clock source conflict
417
- ledc_clk_cfg_t clk_cfg = find_clock_in_use ();
422
+ clk_cfg = find_clock_in_use ();
418
423
if ((clk_cfg != LEDC_AUTO_CLK ) && (clk_cfg != timer .clk_cfg )) {
419
424
mp_raise_msg (& mp_type_RuntimeError , MP_ERROR_TEXT ("one or more active timers use a different clock source, not supported by the current SoC." ));
420
425
}
You can’t perform that action at this time.
0 commit comments