From 4dc6adf37f0627924caeacb2a1cd9e1d041055d6 Mon Sep 17 00:00:00 2001 From: Stephan Hadinger Date: Tue, 2 Aug 2022 23:21:12 +0200 Subject: [PATCH] Temp fix for ledcReadFreq() --- lib/libesp32/ESP32-to-ESP8266-compat/src/esp8266toEsp32.cpp | 4 ++-- lib/libesp32/ESP32-to-ESP8266-compat/src/esp8266toEsp32.h | 2 +- tasmota/tasmota_support/support_pwm.ino | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/libesp32/ESP32-to-ESP8266-compat/src/esp8266toEsp32.cpp b/lib/libesp32/ESP32-to-ESP8266-compat/src/esp8266toEsp32.cpp index 83c51c32d..e4703a435 100644 --- a/lib/libesp32/ESP32-to-ESP8266-compat/src/esp8266toEsp32.cpp +++ b/lib/libesp32/ESP32-to-ESP8266-compat/src/esp8266toEsp32.cpp @@ -318,8 +318,8 @@ int32_t analogAttach(uint32_t pin, bool output_invert) { // returns ledc chan return chan; } -// uint32_t ledcReadFreq2(uint8_t chan) { -extern "C" uint32_t __wrap_ledcReadFreq(uint8_t chan) { +extern "C" uint32_t ledcReadFreq2(uint8_t chan) { +// extern "C" uint32_t __wrap_ledcReadFreq(uint8_t chan) { if (chan > MAX_PWMS) { return 0; // wrong channel } diff --git a/lib/libesp32/ESP32-to-ESP8266-compat/src/esp8266toEsp32.h b/lib/libesp32/ESP32-to-ESP8266-compat/src/esp8266toEsp32.h index 3bfb412a5..f6a6338c6 100644 --- a/lib/libesp32/ESP32-to-ESP8266-compat/src/esp8266toEsp32.h +++ b/lib/libesp32/ESP32-to-ESP8266-compat/src/esp8266toEsp32.h @@ -43,7 +43,7 @@ * So it all happens like if there were only 4 timers and a single group of PWM channels. \*******************************************************************************************/ -extern "C" uint32_t ledcReadFreq(uint8_t chan); +extern "C" uint32_t ledcReadFreq2(uint8_t chan); uint8_t ledcReadResolution(uint8_t chan); // // analogAttach - attach a GPIO to a hardware PWM diff --git a/tasmota/tasmota_support/support_pwm.ino b/tasmota/tasmota_support/support_pwm.ino index f34a82cfc..f729b628a 100644 --- a/tasmota/tasmota_support/support_pwm.ino +++ b/tasmota/tasmota_support/support_pwm.ino @@ -85,7 +85,7 @@ void PwmApplyGPIO(bool force_update_all) { int32_t chan = analogGetChannel2(pin); uint32_t res = ledcReadResolution(chan); uint32_t range = (1 << res) - 1; - uint32_t freq = ledcReadFreq(chan); + uint32_t freq = ledcReadFreq2(chan); // AddLog(LOG_LEVEL_INFO, "PWM: res0=%i freq0=%i pin=%i chan=%i res=%i timer=%i range=%i freq=%i", timer0_resolution, timer0_freq, pin, chan, res, analogGetTimerForChannel(chan), range, freq);