Browse Source

Ledc PWM frequency issues are fixed

Setting the PWM channels and frequencies is now done fully from
the device yaml configuration file, so I removed the frequency
code from the CPP code.
pull/3/head
Maurice Makaay 3 years ago
parent
commit
49404b083d
1 changed files with 0 additions and 13 deletions
  1. +0
    -13
      yeelight_bs2_light_output.h

+ 0
- 13
yeelight_bs2_light_output.h View File

@ -22,11 +22,6 @@
// not be a problem. // not be a problem.
#define TRANSITION_TO_OFF_BUGFIX #define TRANSITION_TO_OFF_BUGFIX
// The PWM frequencies as used by the original device
// for driving the LED circuitry.
const float RGB_PWM_FREQUENCY = 3000.0f;
const float WHITE_PWM_FREQUENCY = 9765.0f;
namespace esphome { namespace esphome {
namespace rgbww { namespace rgbww {
@ -54,26 +49,18 @@ namespace rgbww {
void set_red_output(ledc::LEDCOutput *red) { void set_red_output(ledc::LEDCOutput *red) {
red_ = red; red_ = red;
red_->set_frequency(RGB_PWM_FREQUENCY);
} }
void set_green_output(ledc::LEDCOutput *green) { void set_green_output(ledc::LEDCOutput *green) {
green_ = green; green_ = green;
green_->set_frequency(RGB_PWM_FREQUENCY);
} }
void set_blue_output(ledc::LEDCOutput *blue) { void set_blue_output(ledc::LEDCOutput *blue) {
blue_ = blue; blue_ = blue;
blue_->set_frequency(RGB_PWM_FREQUENCY);
} }
void set_white_output(ledc::LEDCOutput *white) { void set_white_output(ledc::LEDCOutput *white) {
white_ = white; white_ = white;
// Quick fix; when using 10kHz like the original device
// firmware, the blue channel will use that frequency
// instead, causing issues in the RGB color settings.
// This looks like an issue with the ledc component.
white_->set_frequency(RGB_PWM_FREQUENCY);
} }
void set_master1_output(gpio::GPIOBinaryOutput *master1) { void set_master1_output(gpio::GPIOBinaryOutput *master1) {


Loading…
Cancel
Save