|
36 | 36 | #include "esp_err.h"
|
37 | 37 | #include "soc/gpio_sig_map.h"
|
38 | 38 |
|
39 |
| -#define PWM_DBG(...) |
40 |
| -// #define PWM_DBG(...) mp_printf(&mp_plat_print, __VA_ARGS__); mp_printf(&mp_plat_print, "\n"); |
| 39 | +#if 0 // print debugging info |
| 40 | +#define DEBUG_printf DEBUG_printf |
| 41 | +#else // don't print debugging info |
| 42 | +#define DEBUG_printf(...) (void)0 |
| 43 | +#endif |
41 | 44 |
|
42 | 45 | // Total number of channels
|
43 | 46 | #define PWM_CHANNEL_MAX (LEDC_SPEED_MODE_MAX * LEDC_CHANNEL_MAX)
|
@@ -348,10 +351,10 @@ STATIC void set_duty_u16(machine_pwm_obj_t *self, int duty) {
|
348 | 351 | // Bug: It has been experimentally established that the duty is set during 2 signal periods, but 1 period is expected.
|
349 | 352 | // See https://github.com/espressif/esp-idf/issues/7288
|
350 | 353 | if (duty != get_duty_u16(self)) {
|
351 |
| - PWM_DBG("set_duty_u16(%u), get_duty_u16():%u, channel_duty:%d, duty_resolution:%d, freq_hz:%d", duty, get_duty_u16(self), channel_duty, timer.duty_resolution, timer.freq_hz); |
| 354 | + DEBUG_printf("set_duty_u16(%u), get_duty_u16():%u, channel_duty:%d, duty_resolution:%d, freq_hz:%d\n", duty, get_duty_u16(self), channel_duty, timer.duty_resolution, timer.freq_hz); |
352 | 355 | esp_rom_delay_us(2 * 1000000 / timer.freq_hz);
|
353 | 356 | if (duty != get_duty_u16(self)) {
|
354 |
| - PWM_DBG("set_duty_u16(%u), get_duty_u16():%u, channel_duty:%d, duty_resolution:%d, freq_hz:%d", duty, get_duty_u16(self), channel_duty, timer.duty_resolution, timer.freq_hz); |
| 357 | + DEBUG_printf("set_duty_u16(%u), get_duty_u16():%u, channel_duty:%d, duty_resolution:%d, freq_hz:%d\n", duty, get_duty_u16(self), channel_duty, timer.duty_resolution, timer.freq_hz); |
355 | 358 | }
|
356 | 359 | }
|
357 | 360 | */
|
|
0 commit comments