From 96cc933094a6f1f9ef1acca3ecf3248226aaca89 Mon Sep 17 00:00:00 2001 From: Hadinger Date: Tue, 10 Dec 2019 22:00:38 +0100 Subject: [PATCH] Fix flashing H801 led at boot (#7165, #649) --- tasmota/CHANGELOG.md | 1 + tasmota/support_tasmota.ino | 12 ++++++++---- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/tasmota/CHANGELOG.md b/tasmota/CHANGELOG.md index 9eab486f8..51277e62b 100644 --- a/tasmota/CHANGELOG.md +++ b/tasmota/CHANGELOG.md @@ -9,6 +9,7 @@ - Add Wifi Signal Strength in dBm in addition to RSSI Wifi Experience by Andreas Schultz (#7145) - Add Yaw, Pitch and Roll support for MPU6050 by Philip Barclay (#7058) - Add reporting of raw weight to JSON from HX711 to overcome auto-tare functionality by @tobox (#7171) +- Fix flashing H801 led at boot (#7165, #649) ### 7.1.2.3 20191208 diff --git a/tasmota/support_tasmota.ino b/tasmota/support_tasmota.ino index 2ab8fa0d7..34ce9f5dc 100644 --- a/tasmota/support_tasmota.ino +++ b/tasmota/support_tasmota.ino @@ -1286,15 +1286,19 @@ void GpioInit(void) } #endif // USE_SONOFF_SC - if (!light_type) { - for (uint32_t i = 0; i < MAX_PWMS; i++) { // Basic PWM control only - if (pin[GPIO_PWM1 +i] < 99) { + for (uint32_t i = 0; i < MAX_PWMS; i++) { // Basic PWM control only + if (pin[GPIO_PWM1 +i] < 99) { + pinMode(pin[GPIO_PWM1 +i], OUTPUT); + if (light_type) { + // force PWM GPIOs to low or high mode, see #7165 + analogWrite(pin[GPIO_PWM1 +i], bitRead(pwm_inverted, i) ? Settings.pwm_range : 0); + } else { pwm_present = true; - pinMode(pin[GPIO_PWM1 +i], OUTPUT); analogWrite(pin[GPIO_PWM1 +i], bitRead(pwm_inverted, i) ? Settings.pwm_range - Settings.pwm_value[i] : Settings.pwm_value[i]); } } } + for (uint32_t i = 0; i < MAX_RELAYS; i++) { if (pin[GPIO_REL1 +i] < 99) { pinMode(pin[GPIO_REL1 +i], OUTPUT);