Skip to content

Commit

Permalink
Fixed update of led bug and GPIO16 support (#2110)
Browse files Browse the repository at this point in the history
* Fixed ignorance from the 16th PIN on ESP8266

* Added update to led every change of relay

* per #2110 (comment)

* gpio16 comment

Co-authored-by: Max Prokhorov <prokhorov.max@outlook.com>
  • Loading branch information
foxman69 and mcspr committed Jan 20, 2020
1 parent cb28cac commit ac2f9c2
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
4 changes: 4 additions & 0 deletions code/espurna/config/dependencies.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 3 additions & 2 deletions code/espurna/gpio.ino
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Copyright (C) 2017-2019 by Xose Pérez <xose dot perez at gmail dot com>

#include <bitset>

constexpr const size_t GPIO_PINS = 16;
constexpr const size_t GPIO_PINS = 17;

std::bitset<GPIO_PINS> _gpio_locked;
std::bitset<GPIO_PINS> _gpio_available;
Expand Down Expand Up @@ -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);
}

}
1 change: 0 additions & 1 deletion code/espurna/relay.ino
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,6 @@ void _relayProcess(bool mode) {
if (_relay_sync_locked && needs_unlock && changed) {
_relaySyncUnlock();
}

}

#if defined(ITEAD_SONOFF_IFAN02)
Expand Down

0 comments on commit ac2f9c2

Please sign in to comment.