From 2682d82628186ce10525e81963d50aa91f9a1085 Mon Sep 17 00:00:00 2001 From: Theo Arends <11044339+arendst@users.noreply.github.com> Date: Wed, 13 Sep 2023 23:16:38 +0200 Subject: [PATCH] Fix ESP32C3 relay click on restart --- tasmota/tasmota_support/support.ino | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tasmota/tasmota_support/support.ino b/tasmota/tasmota_support/support.ino index e5f926d9a..c38b83e89 100755 --- a/tasmota/tasmota_support/support.ino +++ b/tasmota/tasmota_support/support.ino @@ -1447,11 +1447,17 @@ void DigitalWrite(uint32_t gpio_pin, uint32_t index, uint32_t state) { if (PinUsed(gpio_pin, index)) { uint32_t pin = Pin(gpio_pin, index) & 0x3F; // Fix possible overflow over 63 gpios +#if CONFIG_IDF_TARGET_ESP32C3 + gpio_hold_dis((gpio_num_t)pin); // Allow state change +#endif if (!bitRead(pinmode_init[pin / 32], pin % 32)) { bitSet(pinmode_init[pin / 32], pin % 32); pinMode(pin, OUTPUT); } digitalWrite(pin, state &1); +#if CONFIG_IDF_TARGET_ESP32C3 + gpio_hold_en((gpio_num_t)pin); // Retain the state when the chip or system is reset, for example, when watchdog time-out or Deep-sleep +#endif } }