From 0707a9648b0a3da6f9cf6571c94fa9c88566fbe4 Mon Sep 17 00:00:00 2001 From: Thomas A Date: Mon, 8 Feb 2021 18:52:03 +0100 Subject: [PATCH] Enable higher PWM frequencies for ESP32 LEDC peripheral of ESP32 allows higher PWM frequencies than the ESP8266. Higher frequencies come with reduced available bit depth (as by https://esphome.io/components/output/ledc.html). New max value of 50 kHz to include at least the frequency for 4-pin pwm fans and a bit more. --- tasmota/tasmota.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tasmota/tasmota.h b/tasmota/tasmota.h index b7a3c60ae..784dec7d3 100644 --- a/tasmota/tasmota.h +++ b/tasmota/tasmota.h @@ -126,7 +126,11 @@ const uint32_t PWM_RANGE = 1023; // 255..1023 needs to be devisible b //const uint16_t PWM_FREQ = 1000; // 100..1000 Hz led refresh //const uint16_t PWM_FREQ = 910; // 100..1000 Hz led refresh (iTead value) const uint16_t PWM_FREQ = 977; // 100..4000 Hz led refresh +#ifdef ESP32 +const uint16_t PWM_MAX = 50000; // [PWM_MAX] Maximum frequency for ESP32 - Default: 4000 +#else const uint16_t PWM_MAX = 4000; // [PWM_MAX] Maximum frequency - Default: 4000 +#endif const uint16_t PWM_MIN = 40; // [PWM_MIN] Minimum frequency - Default: 40 // For Dimmers use double of your mains AC frequecy (100 for 50Hz and 120 for 60Hz) // For Controlling Servos use 50 and also set PWM_FREQ as 50 (DO NOT USE THESE VALUES FOR DIMMERS)