Skip to content

Commit be04d7a

Browse files
committed
feat(ledc): Print info about already set channel
1 parent 477527d commit be04d7a

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

Diff for: cores/esp32/esp32-hal-ledc.c

+6
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,12 @@ bool ledcAttachChannel(uint8_t pin, uint32_t freq, uint8_t resolution, uint8_t c
105105
uint8_t group = (channel / 8), timer = ((channel / 2) % 4);
106106
bool channel_used = ledc_handle.used_channels & (1UL << channel);
107107
if (channel_used) {
108+
log_i("Channel %u is already set up, given frequency and resolution will be ignored", channel);
109+
//log setup of the channel frequency and resolution
110+
uint32_t channel_freq = ledc_get_freq(group, timer);
111+
uint32_t channel_resolution = 0;
112+
ledc_ll_get_duty_resolution(LEDC_LL_GET_HW(), group, timer, &channel_resolution);
113+
log_i("Channel %u frequency: %u, resolution: %u", channel, channel_freq, channel_resolution);
108114
if (ledc_set_pin(pin, group, channel % 8) != ESP_OK) {
109115
log_e("Attaching pin to already used channel failed!");
110116
return false;

0 commit comments

Comments
 (0)