move the fix to esp32 adaptation layer

This commit is contained in:
Barbudor 2021-04-20 08:18:25 +02:00
parent 24a39f38a0
commit 785d8a75b5
2 changed files with 2 additions and 6 deletions

View File

@ -89,6 +89,7 @@ inline void analogAttach(uint32_t pin, uint32_t channel) {
inline void analogWrite(uint8_t pin, int val)
{
uint32_t channel = _analog_pin2chan(pin);
if ( val >> (_pwm_bit_num-1) ) ++val;
ledcWrite(channel + PWM_CHANNEL_OFFSET, val);
// Serial.printf("write %d - %d\n",channel,val);
}

View File

@ -1967,12 +1967,7 @@ void LightSetOutputs(const uint16_t *cur_col_10) {
cur_col = cur_col > 0 ? changeUIntScale(cur_col, 0, Settings.pwm_range, Light.pwm_min, Light.pwm_max) : 0; // shrink to the range of pwm_min..pwm_max
}
if (!Settings.flag4.zerocross_dimmer) {
uint16_t pwm = bitRead(TasmotaGlobal.pwm_inverted, i) ? Settings.pwm_range - cur_col : cur_col;
#ifdef ESP32
if (pwm = Settings.pwm_range) pwm = Settings.pwm_range+1; // ESP32 full PWM is 1024 (1023 on ESP8266)
#endif
//AddLog(LOG_LEVEL_DEBUG_MORE, PSTR("LIT: PWM%d = %d"), i, pwm);
analogWrite(Pin(GPIO_PWM1, i), pwm);
analogWrite(Pin(GPIO_PWM1, i), bitRead(TasmotaGlobal.pwm_inverted, i) ? Settings.pwm_range - cur_col : cur_col);
}
#ifdef USE_PWM_DIMMER
// Animate brightness LEDs to follow PWM dimmer brightness