diff --git a/tasmota/xdrv_52_3_berry_gpio.ino b/tasmota/xdrv_52_3_berry_gpio.ino index 62a41db41..9672724dc 100644 --- a/tasmota/xdrv_52_3_berry_gpio.ino +++ b/tasmota/xdrv_52_3_berry_gpio.ino @@ -50,7 +50,7 @@ extern "C" { // DAC #if defined(CONFIG_IDF_TARGET_ESP32) if (25 == pin || 26 == pin) { - uint32_t channel = pin - 25; // 1 or 2 + uint32_t channel = pin - 25 + 1; // 1 or 2 esp_err_t err = dac_output_enable((dac_channel_t) channel); if (err) { be_raisef(vm, "value_error", "Error: dac_output_enable(%i) -> %i", channel, err); @@ -60,7 +60,7 @@ extern "C" { } #elif defined(CONFIG_IDF_TARGET_ESP32S2) if (17 == pin || 18 == pin) { - uint32_t channel = pin - 17; // 1 or 2 + uint32_t channel = pin - 17 + 1; // 1 or 2 esp_err_t err = dac_output_enable((dac_channel_t) channel); if (err) { be_raisef(vm, "value_error", "Error: dac_output_enable(%i) -> %i", channel, err); @@ -121,7 +121,7 @@ extern "C" { uint32_t dac_value = changeUIntScale(mV, 0, 3300, 0, 255); // convert from 0..3300 ms to 0..255 #if defined(CONFIG_IDF_TARGET_ESP32) if (25 == pin || 26 == pin) { - uint32_t channel = pin - 25; // 1 or 2 + uint32_t channel = pin - 25 + 1; // 1 or 2 esp_err_t err = dac_output_voltage((dac_channel_t) channel, dac_value); if (err) { be_raisef(vm, "internal_error", "Error: esp_err_tdac_output_voltage(%i, %i) -> %i", channel, dac_value, err); @@ -131,7 +131,7 @@ extern "C" { } #elif defined(CONFIG_IDF_TARGET_ESP32S2) if (17 == pin || 18 == pin) { - uint32_t channel = pin - 17; // 1 or 2 + uint32_t channel = pin - 17 + 1; // 1 or 2 esp_err_t err = dac_output_voltage((dac_channel_t) channel, dac_value); if (err) { be_raisef(vm, "internal_error", "Error: esp_err_tdac_output_voltage(%i, %i) -> %i", channel, dac_value, err);