From ac2f9c2c57647ca37d7a9bf01e3771a28b89e794 Mon Sep 17 00:00:00 2001 From: foxman69 <52827101+foxman69@users.noreply.github.com> Date: Mon, 20 Jan 2020 14:41:11 +0200 Subject: [PATCH] Fixed update of led bug and GPIO16 support (#2110) * Fixed ignorance from the 16th PIN on ESP8266 * Added update to led every change of relay * per https://github.com/xoseperez/espurna/pull/2110#discussion_r367551042 * gpio16 comment Co-authored-by: Max Prokhorov --- code/espurna/config/dependencies.h | 4 ++++ code/espurna/gpio.ino | 5 +++-- code/espurna/relay.ino | 1 - 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/code/espurna/config/dependencies.h b/code/espurna/config/dependencies.h index 9a17f15f..989a65b3 100644 --- a/code/espurna/config/dependencies.h +++ b/code/espurna/config/dependencies.h @@ -47,6 +47,10 @@ #define MQTT_SUPPORT 1 #endif +#if LED_SUPPORT +#undef BROKER_SUPPORT +#define BROKER_SUPPORT 1 // If LED is enabled enable BROKER to supply status changes +#endif #if INFLUXDB_SUPPORT #undef BROKER_SUPPORT diff --git a/code/espurna/gpio.ino b/code/espurna/gpio.ino index e66e02d6..ba0f63bb 100644 --- a/code/espurna/gpio.ino +++ b/code/espurna/gpio.ino @@ -8,7 +8,7 @@ Copyright (C) 2017-2019 by Xose PĂ©rez #include -constexpr const size_t GPIO_PINS = 16; +constexpr const size_t GPIO_PINS = 17; std::bitset _gpio_locked; std::bitset _gpio_available; @@ -59,10 +59,11 @@ void gpioSetup() { || (efuse_blocks[2] & (1 << 16)) ); + // TODO: GPIO16 is only for basic I/O, gpioGetLock before attachInterrupt should check for that for (unsigned char pin=0; pin < GPIO_PINS; ++pin) { if (pin <= 5) _gpio_available.set(pin); if (((pin == 9) || (pin == 10)) && (esp8285)) _gpio_available.set(pin); - if (12 <= pin && pin <= 15) _gpio_available.set(pin); + if (12 <= pin && pin <= 16) _gpio_available.set(pin); } } diff --git a/code/espurna/relay.ino b/code/espurna/relay.ino index ee4b6582..de37e7fd 100644 --- a/code/espurna/relay.ino +++ b/code/espurna/relay.ino @@ -383,7 +383,6 @@ void _relayProcess(bool mode) { if (_relay_sync_locked && needs_unlock && changed) { _relaySyncUnlock(); } - } #if defined(ITEAD_SONOFF_IFAN02)