Skip to content

Commit 19c6500

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

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

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

+2
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@ 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);
108109
if (ledc_set_pin(pin, group, channel % 8) != ESP_OK) {
109110
log_e("Attaching pin to already used channel failed!");
110111
return false;
@@ -135,6 +136,7 @@ bool ledcAttachChannel(uint8_t pin, uint32_t freq, uint8_t resolution, uint8_t c
135136
//get resolution of selected channel when used
136137
if (channel_used) {
137138
uint32_t channel_resolution = 0;
139+
log_i("Channel %u frequency: %u, resolution: %u", channel, ledc_get_freq(group, timer), channel_resolution);
138140
ledc_ll_get_duty_resolution(LEDC_LL_GET_HW(), group, timer, &channel_resolution);
139141
handle->channel_resolution = (uint8_t)channel_resolution;
140142
}

0 commit comments

Comments
 (0)