mirror of https://github.com/arendst/Tasmota.git
move the fix to esp32 adaptation layer
This commit is contained in:
parent
24a39f38a0
commit
785d8a75b5
|
@ -89,6 +89,7 @@ inline void analogAttach(uint32_t pin, uint32_t channel) {
|
||||||
inline void analogWrite(uint8_t pin, int val)
|
inline void analogWrite(uint8_t pin, int val)
|
||||||
{
|
{
|
||||||
uint32_t channel = _analog_pin2chan(pin);
|
uint32_t channel = _analog_pin2chan(pin);
|
||||||
|
if ( val >> (_pwm_bit_num-1) ) ++val;
|
||||||
ledcWrite(channel + PWM_CHANNEL_OFFSET, val);
|
ledcWrite(channel + PWM_CHANNEL_OFFSET, val);
|
||||||
// Serial.printf("write %d - %d\n",channel,val);
|
// Serial.printf("write %d - %d\n",channel,val);
|
||||||
}
|
}
|
||||||
|
|
|
@ -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
|
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) {
|
if (!Settings.flag4.zerocross_dimmer) {
|
||||||
uint16_t pwm = bitRead(TasmotaGlobal.pwm_inverted, i) ? Settings.pwm_range - cur_col : cur_col;
|
analogWrite(Pin(GPIO_PWM1, i), 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);
|
|
||||||
}
|
}
|
||||||
#ifdef USE_PWM_DIMMER
|
#ifdef USE_PWM_DIMMER
|
||||||
// Animate brightness LEDs to follow PWM dimmer brightness
|
// Animate brightness LEDs to follow PWM dimmer brightness
|
||||||
|
|
Loading…
Reference in New Issue