From 892be892fab222c09d1f04f3a604c88b9b799de0 Mon Sep 17 00:00:00 2001 From: Theo Arends <11044339+arendst@users.noreply.github.com> Date: Fri, 1 May 2020 17:37:56 +0200 Subject: [PATCH] Remove gpio to pin support --- tasmota/support.ino | 16 ---------------- tasmota/support_tasmota.ino | 13 ------------- tasmota/tasmota.ino | 4 ---- tasmota/tasmota_globals.h | 20 +++++++++----------- tasmota/xdrv_10_scripter.ino | 5 ++--- tasmota/xdrv_31_tasmota_slave.ino | 3 --- tasmota/xnrg_01_hlw8012.ino | 6 ------ tasmota/xsns_53_sml.ino | 7 +++---- 8 files changed, 14 insertions(+), 60 deletions(-) diff --git a/tasmota/support.ino b/tasmota/support.ino index db0d08b5e..0a8fec164 100644 --- a/tasmota/support.ino +++ b/tasmota/support.ino @@ -1079,9 +1079,6 @@ uint32_t Pin(uint32_t gpio, uint32_t index) ICACHE_RAM_ATTR; uint32_t Pin(uint32_t gpio, uint32_t index = 0); uint32_t Pin(uint32_t gpio, uint32_t index) { -#ifdef LEGACY_GPIO_ARRAY - return pin_gpio[gpio + index]; // Pin number configured for gpio or 99 if not used -#else // No LEGACY_GPIO_ARRAY #ifdef ESP8266 uint16_t real_gpio = gpio + index; #else // ESP32 @@ -1093,7 +1090,6 @@ uint32_t Pin(uint32_t gpio, uint32_t index) { } } return 99; // No pin used for gpio -#endif // No LEGACY_GPIO_ARRAY } boolean PinUsed(uint32_t gpio, uint32_t index = 0); @@ -1102,21 +1098,9 @@ boolean PinUsed(uint32_t gpio, uint32_t index) { } void SetPin(uint32_t lpin, uint32_t gpio) { -#ifdef LEGACY_GPIO_ARRAY - pin_gpio[gpio] = lpin; -#else gpio_pin[lpin] = gpio; -#endif } -#ifdef LEGACY_GPIO_ARRAY -void InitAllPins(void) { - for (uint32_t i = 0; i < ARRAY_SIZE(pin_gpio); i++) { - SetPin(99, i); - } -} -#endif - void DigitalWrite(uint32_t gpio_pin, uint32_t index, uint32_t state) { if (PinUsed(gpio_pin, index)) { diff --git a/tasmota/support_tasmota.ino b/tasmota/support_tasmota.ino index d49633939..71ec2f269 100644 --- a/tasmota/support_tasmota.ino +++ b/tasmota/support_tasmota.ino @@ -1385,9 +1385,6 @@ void GpioInit(void) } #endif -#ifdef LEGACY_GPIO_ARRAY - InitAllPins(); -#endif for (uint32_t i = 0; i < ARRAY_SIZE(my_module.io); i++) { uint32_t mpin = ValidPin(i, my_module.io[i]); @@ -1440,9 +1437,7 @@ void GpioInit(void) if (mpin) { SetPin(i, mpin); } // Anything above GPIO_NONE and below GPIO_SENSOR_END } -#ifndef LEGACY_GPIO_ARRAY // AddLogBufferSize(LOG_LEVEL_DEBUG, (uint8_t*)gpio_pin, ARRAY_SIZE(gpio_pin), sizeof(gpio_pin[0])); -#endif #ifdef ESP8266 if ((2 == Pin(GPIO_TXD)) || (H801 == my_module_type)) { Serial.set_tx(2); } @@ -1454,11 +1449,6 @@ void GpioInit(void) #ifdef USE_SPI spi_flg = (((PinUsed(GPIO_SPI_CS) && (Pin(GPIO_SPI_CS) > 14)) || (Pin(GPIO_SPI_CS) < 12)) || ((PinUsed(GPIO_SPI_DC) && (Pin(GPIO_SPI_DC) > 14)) || (Pin(GPIO_SPI_DC) < 12))); if (spi_flg) { -#ifdef LEGACY_GPIO_ARRAY - for (uint32_t i = 0; i < GPIO_MAX; i++) { - if ((Pin(i) >= 12) && (Pin(i) <=14)) { SetPin(99, i); } - } -#endif my_module.io[12] = GPIO_SPI_MISO; SetPin(12, GPIO_SPI_MISO); my_module.io[13] = GPIO_SPI_MOSI; @@ -1544,9 +1534,6 @@ void GpioInit(void) #ifdef USE_ARILUX_RF if ((3 == i) && (leds_present < 2) && !PinUsed(GPIO_ARIRFSEL)) { SetPin(Pin(GPIO_LED4), GPIO_ARIRFSEL); // Legacy support where LED4 was Arilux RF enable -#ifdef LEGACY_GPIO_ARRAY - SetPin(99, GPIO_LED4); -#endif } else { #endif pinMode(Pin(GPIO_LED1, i), OUTPUT); diff --git a/tasmota/tasmota.ino b/tasmota/tasmota.ino index e0710278a..6425d7fae 100644 --- a/tasmota/tasmota.ino +++ b/tasmota/tasmota.ino @@ -133,11 +133,7 @@ uint8_t ssleep; // Current copy of Settings.sleep uint8_t blinkspeed = 1; // LED blink rate #ifdef ESP8266 -#ifdef LEGACY_GPIO_ARRAY -uint8_t pin_gpio[GPIO_MAX]; // Pin numbers indexed by GPIO function -#else // No LEGACY_GPIO_ARRAY uint8_t gpio_pin[MAX_GPIO_PIN] = { 0 }; // GPIO functions indexed by pin number -#endif // LEGACY_GPIO_ARRAY #endif // ESP8266 - ESP32 uint8_t active_device = 1; // Active device in ExecuteCommandPower diff --git a/tasmota/tasmota_globals.h b/tasmota/tasmota_globals.h index e18d8800a..27a730ec5 100644 --- a/tasmota/tasmota_globals.h +++ b/tasmota/tasmota_globals.h @@ -49,20 +49,10 @@ extern "C" void resetPins(); #include "tasmota_configurations.h" // Preconfigured configurations -/*********************************************************************************************\ - * Theo transition defines - DO NOT TOUCH -\*********************************************************************************************/ - -//#define LEGACY_GPIO_ARRAY // Uncomment to use legacy GPIO array instead of new PIN array - /*********************************************************************************************\ * Mandatory defines satisfying disabled defines \*********************************************************************************************/ -#ifndef MODULE -#define MODULE SONOFF_BASIC // [Module] Select default model -#endif - #ifdef USE_EMULATION_HUE #define USE_EMULATION #endif @@ -284,6 +274,10 @@ const char kWebColors[] PROGMEM = #ifdef ESP8266 +#ifndef MODULE +#define MODULE SONOFF_BASIC // [Module] Select default model +#endif + #ifndef ARDUINO_ESP8266_RELEASE #define ARDUINO_CORE_RELEASE "STAGE" #else @@ -294,6 +288,10 @@ const char kWebColors[] PROGMEM = #ifdef ESP32 +#ifndef MODULE +#define MODULE WEMOS // [Module] Select default model +#endif + #ifndef ARDUINO_ESP32_RELEASE #define ARDUINO_CORE_RELEASE "STAGE" #else @@ -301,7 +299,7 @@ const char kWebColors[] PROGMEM = #endif // ARDUINO_ESP32_RELEASE #undef USE_HM10 // Disable support for HM-10 as a BLE-bridge as an alternative is using the internal ESP32 BLE -#undef USE_KEELOQ // Disable support for Jarolift rollers by Keeloq algorithm ss it's library cc1101 is not compatible with ESP32 +#undef USE_KEELOQ // Disable support for Jarolift rollers by Keeloq algorithm as it's library cc1101 is not compatible with ESP32 #undef USE_DISPLAY_ILI9488 // Disable as it's library JaretBurkett_ILI9488-gemu-1.0 is not compatible with ESP32 #undef USE_DISPLAY_SSD1351 // Disable as it's library Adafruit_SSD1351_gemu-1.0 is not compatible with ESP32 diff --git a/tasmota/xdrv_10_scripter.ino b/tasmota/xdrv_10_scripter.ino index 8078c7bce..8208606fa 100755 --- a/tasmota/xdrv_10_scripter.ino +++ b/tasmota/xdrv_10_scripter.ino @@ -1582,7 +1582,7 @@ chknext: if (!strncmp(vname,"pd[",3)) { GetNumericResult(vname+3,OPER_EQU,&fvar,0); uint8_t gpiopin=fvar; -#ifdef LEGACY_GPIO_ARRAY +/* for (uint8_t i=0;i 0)) { fvar = gpio_pin[gpiopin]; // skip ] bracket len++; goto exit; } -#endif fvar=999; goto exit; } diff --git a/tasmota/xdrv_31_tasmota_slave.ino b/tasmota/xdrv_31_tasmota_slave.ino index 370a3f6d6..e0a773728 100644 --- a/tasmota/xdrv_31_tasmota_slave.ino +++ b/tasmota/xdrv_31_tasmota_slave.ino @@ -447,9 +447,6 @@ void TasmotaSlave_Init(void) TasmotaSlave_Serial->setTimeout(50); if (PinUsed(GPIO_TASMOTASLAVE_RST_INV)) { SetPin(Pin(GPIO_TASMOTASLAVE_RST_INV), GPIO_TASMOTASLAVE_RST); -#ifdef LEGACY_GPIO_ARRAY - SetPin(99, GPIO_TASMOTASLAVE_RST_INV); -#endif TSlave.inverted = HIGH; } pinMode(Pin(GPIO_TASMOTASLAVE_RST), OUTPUT); diff --git a/tasmota/xnrg_01_hlw8012.ino b/tasmota/xnrg_01_hlw8012.ino index 7a3becf0a..d0c17353a 100644 --- a/tasmota/xnrg_01_hlw8012.ino +++ b/tasmota/xnrg_01_hlw8012.ino @@ -250,9 +250,6 @@ void HlwDrvInit(void) Hlw.model_type = 0; // HLW8012 if (PinUsed(GPIO_HJL_CF)) { SetPin(Pin(GPIO_HJL_CF), GPIO_HLW_CF); -#ifdef LEGACY_GPIO_ARRAY - SetPin(99, GPIO_HJL_CF); -#endif Hlw.model_type = 1; // HJL-01/BL0937 } @@ -261,9 +258,6 @@ void HlwDrvInit(void) Hlw.ui_flag = true; // Voltage on high if (PinUsed(GPIO_NRG_SEL_INV)) { SetPin(Pin(GPIO_NRG_SEL_INV), GPIO_NRG_SEL); -#ifdef LEGACY_GPIO_ARRAY - SetPin(99, GPIO_NRG_SEL_INV); -#endif Hlw.ui_flag = false; // Voltage on low } diff --git a/tasmota/xsns_53_sml.ino b/tasmota/xsns_53_sml.ino index efe3b89bc..cb08856b1 100755 --- a/tasmota/xsns_53_sml.ino +++ b/tasmota/xsns_53_sml.ino @@ -1831,18 +1831,17 @@ uint8_t *script_meter; #endif bool Gpio_used(uint8_t gpiopin) { -#ifdef LEGACY_GPIO_ARRAY - for (uint16_t i=0;i 0)) { return true; } -#endif return false; }