diff --git a/sonoff/_changelog.ino b/sonoff/_changelog.ino index 981557afa..2e65c4a16 100644 --- a/sonoff/_changelog.ino +++ b/sonoff/_changelog.ino @@ -1,4 +1,7 @@ -/* 6.4.1.2 20181228 +/* 6.4.1.3 20181229 + * Change sonoff_template.h module lay-out by removing non-configurable GPIOs + * + * 6.4.1.2 20181228 * Change switch driver making it modular and introduce input filter (#4665, #4724) * Add define DS18B20_INTERNAL_PULLUP to select internal input pullup when only one DS18B20 sensor is connected eliminating external resistor (#4738) * Add variable %timestamp% to rules (#4749) diff --git a/sonoff/settings.ino b/sonoff/settings.ino index 46c1d849d..3c6a6465e 100644 --- a/sonoff/settings.ino +++ b/sonoff/settings.ino @@ -424,7 +424,7 @@ void SettingsDefaultSet2(void) // Module // Settings.flag.interlock = 0; Settings.module = MODULE; -// for (byte i = 0; i < MAX_GPIO_PIN; i++) { Settings.my_gp.io[i] = 0; } +// for (byte i = 0; i < sizeof(Settings.my_gp); i++) { Settings.my_gp.io[i] = GPIO_NONE; } strlcpy(Settings.friendlyname[0], FRIENDLY_NAME, sizeof(Settings.friendlyname[0])); strlcpy(Settings.friendlyname[1], FRIENDLY_NAME"2", sizeof(Settings.friendlyname[1])); strlcpy(Settings.friendlyname[2], FRIENDLY_NAME"3", sizeof(Settings.friendlyname[2])); @@ -742,7 +742,7 @@ void SettingsDelta(void) Settings.altitude = 0; } if (Settings.version < 0x0508000B) { - for (byte i = 0; i < MAX_GPIO_PIN; i++) { // Move GPIO_LEDs + for (byte i = 0; i < sizeof(Settings.my_gp); i++) { // Move GPIO_LEDs if ((Settings.my_gp.io[i] >= 25) && (Settings.my_gp.io[i] <= 32)) { // Was GPIO_LED1 Settings.my_gp.io[i] += 23; // Move GPIO_LED1 } @@ -829,7 +829,7 @@ void SettingsDelta(void) Settings.switchmode[i] = SWITCH_MODE; } } - for (byte i = 0; i < MAX_GPIO_PIN; i++) { + for (byte i = 0; i < sizeof(Settings.my_gp); i++) { if (Settings.my_gp.io[i] >= GPIO_SWT5) { // Move up from GPIO_SWT5 to GPIO_KEY1 Settings.my_gp.io[i] += 4; } diff --git a/sonoff/sonoff.ino b/sonoff/sonoff.ino index 0deb833dd..e1d796c57 100755 --- a/sonoff/sonoff.ino +++ b/sonoff/sonoff.ino @@ -850,8 +850,8 @@ void MqttDataHandler(char* topic, byte* data, unsigned int data_len) Settings.last_module = Settings.module; Settings.module = payload; if (Settings.last_module != payload) { - for (byte i = 0; i < MAX_GPIO_PIN; i++) { - Settings.my_gp.io[i] = 0; + for (byte i = 0; i < sizeof(Settings.my_gp); i++) { + Settings.my_gp.io[i] = GPIO_NONE; } } restart_flag = 2; @@ -876,7 +876,7 @@ void MqttDataHandler(char* topic, byte* data, unsigned int data_len) } mqtt_data[0] = '\0'; } - else if ((CMND_GPIO == command_code) && (index < MAX_GPIO_PIN)) { + else if ((CMND_GPIO == command_code) && (index < sizeof(Settings.my_gp))) { myio cmodule; ModuleGpios(&cmodule); if ((GPIO_USER == ValidGPIO(index, cmodule.io[index])) && (payload >= 0) && (payload < GPIO_SENSOR_END)) { @@ -886,9 +886,9 @@ void MqttDataHandler(char* topic, byte* data, unsigned int data_len) if (midx == payload) { present = true; } } if (present) { - for (byte i = 0; i < MAX_GPIO_PIN; i++) { + for (byte i = 0; i < sizeof(Settings.my_gp); i++) { if ((GPIO_USER == ValidGPIO(i, cmodule.io[i])) && (Settings.my_gp.io[i] == payload)) { - Settings.my_gp.io[i] = 0; + Settings.my_gp.io[i] = GPIO_NONE; } } Settings.my_gp.io[index] = payload; @@ -896,7 +896,7 @@ void MqttDataHandler(char* topic, byte* data, unsigned int data_len) } } snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("{")); - for (byte i = 0; i < MAX_GPIO_PIN; i++) { + for (byte i = 0; i < sizeof(Settings.my_gp); i++) { if (GPIO_USER == ValidGPIO(i, cmodule.io[i])) { if (jsflg) snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s,"), mqtt_data); jsflg = 1; @@ -2327,9 +2327,8 @@ void GpioInit(void) myio def_gp; ModuleGpios(&def_gp); -// AddLogSerial(LOG_LEVEL_DEBUG, (uint8_t *)&def_gp, sizeof(def_gp)); - for (byte i = 0; i < MAX_GPIO_PIN; i++) { + for (byte i = 0; i < sizeof(Settings.my_gp); i++) { if (Settings.my_gp.io[i] > GPIO_NONE) { my_module.io[i] = Settings.my_gp.io[i]; } @@ -2341,7 +2340,7 @@ void GpioInit(void) for (byte i = 0; i < GPIO_MAX; i++) { pin[i] = 99; } - for (byte i = 0; i < MAX_GPIO_PIN; i++) { + for (byte i = 0; i < sizeof(my_module.io); i++) { mpin = ValidGPIO(i, my_module.io[i]); // snprintf_P(log_data, sizeof(log_data), PSTR("DBG: gpio pin %d, mpin %d"), i, mpin); @@ -2567,7 +2566,7 @@ void setup(void) if (RtcReboot.fast_reboot_count > 4) { // Restarted 5 times Settings.module = SONOFF_BASIC; // Reset module to Sonoff Basic // Settings.last_module = SONOFF_BASIC; - for (byte i = 0; i < MAX_GPIO_PIN; i++) { + for (byte i = 0; i < sizeof(Settings.my_gp); i++) { Settings.my_gp.io[i] = GPIO_NONE; // Reset user defined GPIO disabling sensors } } diff --git a/sonoff/sonoff_template.h b/sonoff/sonoff_template.h index 48af9cf4b..bc14adb9a 100644 --- a/sonoff/sonoff_template.h +++ b/sonoff/sonoff_template.h @@ -275,6 +275,7 @@ enum SupportedModules { /********************************************************************************************/ #define MAX_GPIO_PIN 18 // Number of supported GPIO +#define MIN_FLASH_PINS 4 // Number of flash chip pins unusable for configuration (GPIO6, 7, 8 and 11) const char PINS_WEMOS[] PROGMEM = "D3TXD4RXD2D1flashcFLFLolD6D7D5D8D0A0"; @@ -282,9 +283,13 @@ typedef struct MYIO { uint8_t io[MAX_GPIO_PIN]; } myio; +typedef struct MYCFGIO { + uint8_t io[MAX_GPIO_PIN - MIN_FLASH_PINS]; +} mycfgio; + typedef struct MYTMPLT { char name[15]; - myio gp; + mycfgio gp; } mytmplt; const uint8_t kGpioNiceList[] PROGMEM = { @@ -535,12 +540,12 @@ const mytmplt kModules[MAXMODULE] PROGMEM = { GPIO_USER, // GPIO03 Serial TXD and Optional sensor GPIO_USER, // GPIO04 Optional sensor 0, // GPIO05 - 0, // GPIO06 (SD_CLK Flash) - 0, // GPIO07 (SD_DATA0 Flash QIO/DIO/DOUT) - 0, // GPIO08 (SD_DATA1 Flash QIO/DIO/DOUT) - 0, // GPIO09 (SD_DATA2 Flash QIO) - 0, // GPIO10 (SD_DATA3 Flash QIO) - 0, // GPIO11 (SD_CMD Flash) + // GPIO06 (SD_CLK Flash) + // GPIO07 (SD_DATA0 Flash QIO/DIO/DOUT) + // GPIO08 (SD_DATA1 Flash QIO/DIO/DOUT) + 0, // GPIO09 (SD_DATA2 Flash QIO or ESP8285) + 0, // GPIO10 (SD_DATA3 Flash QIO or ESP8285) + // GPIO11 (SD_CMD Flash) GPIO_REL1, // GPIO12 Red Led and Relay (0 = Off, 1 = On) GPIO_LED1_INV, // GPIO13 Green Led (0 = On, 1 = Off) GPIO_USER, // GPIO14 Optional sensor @@ -555,7 +560,12 @@ const mytmplt kModules[MAXMODULE] PROGMEM = { GPIO_USER, // GPIO03 Serial TXD and Optional sensor GPIO_USER, // GPIO04 Optional sensor 0, - 0, 0, 0, 0, 0, 0, // Flash connection + // GPIO06 (SD_CLK Flash) + // GPIO07 (SD_DATA0 Flash QIO/DIO/DOUT) + // GPIO08 (SD_DATA1 Flash QIO/DIO/DOUT) + 0, // GPIO09 (SD_DATA2 Flash QIO or ESP8285) + 0, // GPIO10 (SD_DATA3 Flash QIO or ESP8285) + // GPIO11 (SD_CMD Flash) GPIO_REL1, // GPIO12 Red Led and Relay (0 = Off, 1 = On) GPIO_LED1_INV, // GPIO13 Green Led (0 = On, 1 = Off) GPIO_USER, // GPIO14 Optional sensor @@ -568,7 +578,12 @@ const mytmplt kModules[MAXMODULE] PROGMEM = { GPIO_USER, // GPIO03 Serial TXD and Optional sensor GPIO_USER, // GPIO04 Optional sensor GPIO_USER, // GPIO05 Optional sensor - 0, 0, 0, 0, 0, 0, // Flash connection + // GPIO06 (SD_CLK Flash) + // GPIO07 (SD_DATA0 Flash QIO/DIO/DOUT) + // GPIO08 (SD_DATA1 Flash QIO/DIO/DOUT) + 0, // GPIO09 (SD_DATA2 Flash QIO or ESP8285) + 0, // GPIO10 (SD_DATA3 Flash QIO or ESP8285) + // GPIO11 (SD_CMD Flash) GPIO_REL1, // GPIO12 Red Led and Relay (0 = Off, 1 = On) GPIO_LED1_INV, // GPIO13 Green Led (0 = On, 1 = Off) GPIO_USER, // GPIO14 Optional sensor @@ -582,7 +597,12 @@ const mytmplt kModules[MAXMODULE] PROGMEM = { GPIO_USER, // GPIO03 Serial TXD and Optional sensor GPIO_USER, // GPIO04 Optional sensor 0, - 0, 0, 0, 0, 0, 0, // Flash connection + // GPIO06 (SD_CLK Flash) + // GPIO07 (SD_DATA0 Flash QIO/DIO/DOUT) + // GPIO08 (SD_DATA1 Flash QIO/DIO/DOUT) + 0, // GPIO09 (SD_DATA2 Flash QIO or ESP8285) + 0, // GPIO10 (SD_DATA3 Flash QIO or ESP8285) + // GPIO11 (SD_CMD Flash) GPIO_REL1, // GPIO12 Red Led and Relay (0 = Off, 1 = On) GPIO_LED1_INV, // GPIO13 Green Led (0 = On, 1 = Off) GPIO_USER, // GPIO14 Optional sensor @@ -595,7 +615,12 @@ const mytmplt kModules[MAXMODULE] PROGMEM = { GPIO_RXD, // GPIO03 Relay control GPIO_USER, // GPIO04 Optional sensor 0, - 0, 0, 0, 0, 0, 0, // Flash connection + // GPIO06 (SD_CLK Flash) + // GPIO07 (SD_DATA0 Flash QIO/DIO/DOUT) + // GPIO08 (SD_DATA1 Flash QIO/DIO/DOUT) + 0, // GPIO09 (SD_DATA2 Flash QIO or ESP8285) + 0, // GPIO10 (SD_DATA3 Flash QIO or ESP8285) + // GPIO11 (SD_CMD Flash) 0, GPIO_LED1_INV, // GPIO13 Blue Led (0 = On, 1 = Off) GPIO_USER, // GPIO14 Optional sensor @@ -605,7 +630,12 @@ const mytmplt kModules[MAXMODULE] PROGMEM = { GPIO_KEY1, // GPIO00 Button 0, 0, 0, 0, GPIO_NRG_SEL, // GPIO05 HLW8012 Sel output (1 = Voltage) - 0, 0, 0, 0, 0, 0, // Flash connection + // GPIO06 (SD_CLK Flash) + // GPIO07 (SD_DATA0 Flash QIO/DIO/DOUT) + // GPIO08 (SD_DATA1 Flash QIO/DIO/DOUT) + 0, // GPIO09 (SD_DATA2 Flash QIO or ESP8285) + 0, // GPIO10 (SD_DATA3 Flash QIO or ESP8285) + // GPIO11 (SD_CMD Flash) GPIO_REL1, // GPIO12 Red Led and Relay (0 = Off, 1 = On) GPIO_NRG_CF1, // GPIO13 HLW8012 CF1 voltage / current GPIO_HLW_CF, // GPIO14 HLW8012 CF power @@ -619,10 +649,12 @@ const mytmplt kModules[MAXMODULE] PROGMEM = { GPIO_USER, // GPIO03 Serial TXD and Optional sensor GPIO_REL3, // GPIO04 Sonoff 4CH Red Led and Relay 3 (0 = Off, 1 = On) GPIO_REL2, // GPIO05 Sonoff 4CH Red Led and Relay 2 (0 = Off, 1 = On) - 0, 0, 0, // Flash connection + // GPIO06 (SD_CLK Flash) + // GPIO07 (SD_DATA0 Flash QIO/DIO/DOUT) + // GPIO08 (SD_DATA1 Flash QIO/DIO/DOUT) GPIO_KEY2, // GPIO09 Button 2 GPIO_KEY3, // GPIO10 Button 3 - 0, // Flash connection + // GPIO11 (SD_CMD Flash) GPIO_REL1, // GPIO12 Red Led and Relay 1 (0 = Off, 1 = On) GPIO_LED1_INV, // GPIO13 Blue Led (0 = On, 1 = Off) GPIO_KEY4, // GPIO14 Button 4 @@ -635,7 +667,12 @@ const mytmplt kModules[MAXMODULE] PROGMEM = { GPIO_USER, // GPIO02 Optional sensor GPIO_USER, // GPIO03 Serial TXD and Optional sensor 0, 0, - 0, 0, 0, 0, 0, 0, // Flash connection + // GPIO06 (SD_CLK Flash) + // GPIO07 (SD_DATA0 Flash QIO/DIO/DOUT) + // GPIO08 (SD_DATA1 Flash QIO/DIO/DOUT) + 0, // GPIO09 (SD_DATA2 Flash QIO or ESP8285) + 0, // GPIO10 (SD_DATA3 Flash QIO or ESP8285) + // GPIO11 (SD_CMD Flash) GPIO_REL1, // GPIO12 Red Led and Relay (0 = Off, 1 = On) GPIO_LED1_INV, // GPIO13 Green/Blue Led (0 = On, 1 = Off) 0, 0, 0, 0 @@ -646,7 +683,12 @@ const mytmplt kModules[MAXMODULE] PROGMEM = { 0, GPIO_USER, // GPIO03 Serial TXD and Optional sensor 0, 0, - 0, 0, 0, 0, 0, 0, // Flash connection + // GPIO06 (SD_CLK Flash) + // GPIO07 (SD_DATA0 Flash QIO/DIO/DOUT) + // GPIO08 (SD_DATA1 Flash QIO/DIO/DOUT) + 0, // GPIO09 (SD_DATA2 Flash QIO or ESP8285) + 0, // GPIO10 (SD_DATA3 Flash QIO or ESP8285) + // GPIO11 (SD_CMD Flash) GPIO_REL1, // GPIO12 Red Led and Relay (0 = Off, 1 = On) GPIO_LED1_INV, // GPIO13 Blue Led (0 = On, 1 = Off) 0, 0, 0, 0 @@ -657,9 +699,12 @@ const mytmplt kModules[MAXMODULE] PROGMEM = { 0, GPIO_USER, // GPIO03 Serial TXD and Optional sensor 0, 0, - 0, 0, 0, // Flash connection - 0, 0, - 0, // Flash connection + // GPIO06 (SD_CLK Flash) + // GPIO07 (SD_DATA0 Flash QIO/DIO/DOUT) + // GPIO08 (SD_DATA1 Flash QIO/DIO/DOUT) + 0, // GPIO09 + 0, // GPIO10 + // GPIO11 (SD_CMD Flash) GPIO_REL1, // GPIO12 Red Led and Relay (0 = Off, 1 = On) GPIO_LED1_INV, // GPIO13 Blue Led (0 = On, 1 = Off) 0, 0, 0, 0 @@ -669,7 +714,12 @@ const mytmplt kModules[MAXMODULE] PROGMEM = { 0, 0, 0, GPIO_USER, // GPIO04 Optional sensor (PWM3 Green) GPIO_USER, // GPIO05 Optional sensor (PWM2 Red) - 0, 0, 0, 0, 0, 0, // Flash connection + // GPIO06 (SD_CLK Flash) + // GPIO07 (SD_DATA0 Flash QIO/DIO/DOUT) + // GPIO08 (SD_DATA1 Flash QIO/DIO/DOUT) + 0, // GPIO09 (SD_DATA2 Flash QIO or ESP8285) + 0, // GPIO10 (SD_DATA3 Flash QIO or ESP8285) + // GPIO11 (SD_CMD Flash) GPIO_PWM1, // GPIO12 Cold light (PWM0 Cold) GPIO_LED1_INV, // GPIO13 Blue Led (0 = On, 1 = Off) GPIO_PWM2, // GPIO14 Warm light (PWM1 Warm) @@ -679,7 +729,12 @@ const mytmplt kModules[MAXMODULE] PROGMEM = { { "1 Channel", // 1 Channel Inching/Latching Relay using (PSA-B01 - ESP8266 and PSF-B01 - ESP8285) GPIO_KEY1, // GPIO00 Button 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, // Flash connection + // GPIO06 (SD_CLK Flash) + // GPIO07 (SD_DATA0 Flash QIO/DIO/DOUT) + // GPIO08 (SD_DATA1 Flash QIO/DIO/DOUT) + 0, // GPIO09 (SD_DATA2 Flash QIO or ESP8285) + 0, // GPIO10 (SD_DATA3 Flash QIO or ESP8285) + // GPIO11 (SD_CMD Flash) GPIO_REL1, // GPIO12 Red Led and Relay (0 = Off, 1 = On) GPIO_LED1_INV, // GPIO13 Green Led (0 = On, 1 = Off) 0, 0, 0, 0 @@ -690,7 +745,12 @@ const mytmplt kModules[MAXMODULE] PROGMEM = { 0, GPIO_RXD, // GPIO03 Relay control 0, 0, - 0, 0, 0, 0, 0, 0, // Flash connection + // GPIO06 (SD_CLK Flash) + // GPIO07 (SD_DATA0 Flash QIO/DIO/DOUT) + // GPIO08 (SD_DATA1 Flash QIO/DIO/DOUT) + 0, // GPIO09 (SD_DATA2 Flash QIO or ESP8285) + 0, // GPIO10 (SD_DATA3 Flash QIO or ESP8285) + // GPIO11 (SD_CMD Flash) 0, GPIO_LED1_INV, // GPIO13 Blue Led (0 = On, 1 = Off) 0, 0, 0, 0 @@ -698,7 +758,12 @@ const mytmplt kModules[MAXMODULE] PROGMEM = { { "Motor C/AC", // Motor Clockwise / Anti clockwise (PSA-B01 - ESP8266) GPIO_KEY1, // GPIO00 Button 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, // Flash connection + // GPIO06 (SD_CLK Flash) + // GPIO07 (SD_DATA0 Flash QIO/DIO/DOUT) + // GPIO08 (SD_DATA1 Flash QIO/DIO/DOUT) + 0, // GPIO09 (SD_DATA2 Flash QIO or ESP8285) + 0, // GPIO10 (SD_DATA3 Flash QIO or ESP8285) + // GPIO11 (SD_CMD Flash) GPIO_REL1, // GPIO12 Red Led and Relay (0 = Off, 1 = On) GPIO_LED1_INV, // GPIO13 Green Led (0 = On, 1 = Off) 0, 0, 0, 0 @@ -710,7 +775,12 @@ const mytmplt kModules[MAXMODULE] PROGMEM = { GPIO_USER, // GPIO03 Serial TXD and Optional sensor GPIO_USER, // GPIO04 Optional sensor GPIO_USER, // GPIO05 Optional sensor - 0, 0, 0, 0, 0, 0, // Flash connection + // GPIO06 (SD_CLK Flash) + // GPIO07 (SD_DATA0 Flash QIO/DIO/DOUT) + // GPIO08 (SD_DATA1 Flash QIO/DIO/DOUT) + 0, // GPIO09 (SD_DATA2 Flash QIO or ESP8285) + 0, // GPIO10 (SD_DATA3 Flash QIO or ESP8285) + // GPIO11 (SD_CMD Flash) GPIO_REL2, // GPIO12 Red Led and Relay 2 (0 = Off, 1 = On) GPIO_REL1, // GPIO13 Red Led and Relay 1 (0 = Off, 1 = On) GPIO_USER, // GPIO14 Optional sensor @@ -728,7 +798,12 @@ const mytmplt kModules[MAXMODULE] PROGMEM = { GPIO_USER, // GPIO03 UART0_RXD V3.1 Module Pin 3 GPIO_USER, // GPIO04 V3.1 Module Pin 10 - V5.0 Module Pin 2 GPIO_USER, // GPIO05 V3.1 Module Pin 9 - V5.0 Module Pin 1 - 0, 0, 0, 0, 0, 0, // Flash connection + // GPIO06 (SD_CLK Flash) + // GPIO07 (SD_DATA0 Flash QIO/DIO/DOUT) + // GPIO08 (SD_DATA1 Flash QIO/DIO/DOUT) + 0, // GPIO09 (SD_DATA2 Flash QIO or ESP8285) + 0, // GPIO10 (SD_DATA3 Flash QIO or ESP8285) + // GPIO11 (SD_CMD Flash) GPIO_REL1, // GPIO12 Relay1 ( 1 = Off) GPIO_REL2, // GPIO13 Relay1 ( 1 = On) GPIO_USER, // GPIO14 V3.1 Module Pin 5 - V5.0 GPIO_REL3_INV Relay2 ( 1 = Off) @@ -742,7 +817,12 @@ const mytmplt kModules[MAXMODULE] PROGMEM = { 0, GPIO_LED1, // GPIO02 Green Led (1 = On, 0 = Off) 0, 0, 0, - 0, 0, 0, 0, 0, 0, // Flash connection + // GPIO06 (SD_CLK Flash) + // GPIO07 (SD_DATA0 Flash QIO/DIO/DOUT) + // GPIO08 (SD_DATA1 Flash QIO/DIO/DOUT) + 0, // GPIO09 (SD_DATA2 Flash QIO or ESP8285) + 0, // GPIO10 (SD_DATA3 Flash QIO or ESP8285) + // GPIO11 (SD_CMD Flash) GPIO_USER, // GPIO12 Optional sensor (pm data) GPIO_KEY1, // GPIO13 Button 0, @@ -756,10 +836,12 @@ const mytmplt kModules[MAXMODULE] PROGMEM = { GPIO_USER, // GPIO03 RX Serial TXD and Optional sensor GPIO_USER, // GPIO04 D2 Wemos I2C SDA GPIO_USER, // GPIO05 D1 Wemos I2C SCL / Wemos Relay Shield (0 = Off, 1 = On) / Wemos WS2812B RGB led Shield - 0, 0, 0, // Flash connection - GPIO_USER, // Flash connection or GPIO09 on ESP8285 only! - GPIO_USER, // Flash connection or GPIO10 on ESP8285 only! - 0, // Flash connection + // GPIO06 (SD_CLK Flash) + // GPIO07 (SD_DATA0 Flash QIO/DIO/DOUT) + // GPIO08 (SD_DATA1 Flash QIO/DIO/DOUT) + GPIO_USER, // GPIO09 (SD_DATA2 Flash QIO or ESP8285) + GPIO_USER, // GPIO10 (SD_DATA3 Flash QIO or ESP8285) + // GPIO11 (SD_CMD Flash) GPIO_USER, // GPIO12 D6 GPIO_USER, // GPIO13 D7 GPIO_USER, // GPIO14 D5 @@ -774,7 +856,12 @@ const mytmplt kModules[MAXMODULE] PROGMEM = { GPIO_USER, // GPIO03 RX Serial TXD and Optional sensor GPIO_USER, // GPIO04 Optional sensor GPIO_USER, // GPIO05 Optional sensor - 0, 0, 0, 0, 0, 0, // Flash connection + // GPIO06 (SD_CLK Flash) + // GPIO07 (SD_DATA0 Flash QIO/DIO/DOUT) + // GPIO08 (SD_DATA1 Flash QIO/DIO/DOUT) + 0, // GPIO09 (SD_DATA2 Flash QIO or ESP8285) + 0, // GPIO10 (SD_DATA3 Flash QIO or ESP8285) + // GPIO11 (SD_CMD Flash) GPIO_USER, // GPIO12 GPIO_USER, // GPIO13 BLUE LED GPIO_USER, // GPIO14 Optional sensor @@ -789,7 +876,12 @@ const mytmplt kModules[MAXMODULE] PROGMEM = { GPIO_USER, // GPIO03 RX and Optional sensor - Pin next to GND on the PCB GPIO_PWM5, // GPIO04 W2 - PWM5 GPIO_LED2_INV, // GPIO05 Red LED - 0, 0, 0, 0, 0, 0, // Flash connection + // GPIO06 (SD_CLK Flash) + // GPIO07 (SD_DATA0 Flash QIO/DIO/DOUT) + // GPIO08 (SD_DATA1 Flash QIO/DIO/DOUT) + 0, // GPIO09 (SD_DATA2 Flash QIO or ESP8285) + 0, // GPIO10 (SD_DATA3 Flash QIO or ESP8285) + // GPIO11 (SD_CMD Flash) GPIO_PWM3, // GPIO12 Blue GPIO_PWM2, // GPIO13 Green GPIO_PWM4, // GPIO14 W1 - PWM4 @@ -802,16 +894,24 @@ const mytmplt kModules[MAXMODULE] PROGMEM = { GPIO_USER, // GPIO02 Optional sensor GPIO_RXD, // GPIO03 TXD to ATMEGA328P 0, 0, - 0, 0, 0, 0, 0, 0, // Flash connection + // GPIO06 (SD_CLK Flash) + // GPIO07 (SD_DATA0 Flash QIO/DIO/DOUT) + // GPIO08 (SD_DATA1 Flash QIO/DIO/DOUT) + 0, // GPIO09 (SD_DATA2 Flash QIO or ESP8285) + 0, // GPIO10 (SD_DATA3 Flash QIO or ESP8285) + // GPIO11 (SD_CMD Flash) 0, GPIO_LED1_INV, // GPIO13 Green Led (0 = On, 1 = Off) 0, 0, 0, 0 }, { "Sonoff BN-SZ", // Sonoff BN-SZ01 Ceiling led (ESP8285) 0, 0, 0, 0, 0, 0, - 0, 0, 0, // Flash connection - 0, 0, - 0, // Flash connection + // GPIO06 (SD_CLK Flash) + // GPIO07 (SD_DATA0 Flash QIO/DIO/DOUT) + // GPIO08 (SD_DATA1 Flash QIO/DIO/DOUT) + 0, // GPIO09 + 0, // GPIO10 + // GPIO11 (SD_CMD Flash) GPIO_PWM1, // GPIO12 Light GPIO_LED1_INV, // GPIO13 Red Led (0 = On, 1 = Off) 0, 0, @@ -824,10 +924,12 @@ const mytmplt kModules[MAXMODULE] PROGMEM = { GPIO_USER, // GPIO03 Serial TXD and Optional sensor GPIO_REL3, // GPIO04 Sonoff 4CH Red Led and Relay 3 (0 = Off, 1 = On) GPIO_REL2, // GPIO05 Sonoff 4CH Red Led and Relay 2 (0 = Off, 1 = On) - 0, 0, 0, // Flash connection + // GPIO06 (SD_CLK Flash) + // GPIO07 (SD_DATA0 Flash QIO/DIO/DOUT) + // GPIO08 (SD_DATA1 Flash QIO/DIO/DOUT) GPIO_KEY2, // GPIO09 Button 2 GPIO_KEY3, // GPIO10 Button 3 - 0, // Flash connection + // GPIO11 (SD_CMD Flash) GPIO_REL1, // GPIO12 Red Led and Relay 1 (0 = Off, 1 = On) GPIO_LED1_INV, // GPIO13 Blue Led (0 = On, 1 = Off) GPIO_KEY4, // GPIO14 Button 4 @@ -835,12 +937,17 @@ const mytmplt kModules[MAXMODULE] PROGMEM = { 0, 0 }, { "Huafan SS", // Hua Fan Smart Socket (ESP8266) - like Sonoff Pow - GPIO_LED1_INV, // GPIO0 Blue Led (0 = On, 1 = Off) + GPIO_LED1_INV, // GPIO00 Blue Led (0 = On, 1 = Off) 0, 0, - GPIO_LED2_INV, // GPIO3 Red Led (0 = On, 1 = Off) - GPIO_KEY1, // GPIO4 Button - GPIO_REL1_INV, // GPIO5 Relay (0 = On, 1 = Off) - 0, 0, 0, 0, 0, 0, // Flash connection + GPIO_LED2_INV, // GPIO03 Red Led (0 = On, 1 = Off) + GPIO_KEY1, // GPIO04 Button + GPIO_REL1_INV, // GPIO05 Relay (0 = On, 1 = Off) + // GPIO06 (SD_CLK Flash) + // GPIO07 (SD_DATA0 Flash QIO/DIO/DOUT) + // GPIO08 (SD_DATA1 Flash QIO/DIO/DOUT) + 0, // GPIO09 (SD_DATA2 Flash QIO or ESP8285) + 0, // GPIO10 (SD_DATA3 Flash QIO or ESP8285) + // GPIO11 (SD_CMD Flash) GPIO_NRG_CF1, // GPIO12 HLW8012 CF1 voltage / current GPIO_NRG_SEL, // GPIO13 HLW8012 Sel output (1 = Voltage) GPIO_HLW_CF, // GPIO14 HLW8012 CF power @@ -853,9 +960,12 @@ const mytmplt kModules[MAXMODULE] PROGMEM = { GPIO_RXD, // GPIO03 RF bridge control GPIO_USER, // GPIO04 Optional sensor GPIO_USER, // GPIO05 Optional sensor - 0, 0, 0, // Flash connection - 0, 0, - 0, // Flash connection + // GPIO06 (SD_CLK Flash) + // GPIO07 (SD_DATA0 Flash QIO/DIO/DOUT) + // GPIO08 (SD_DATA1 Flash QIO/DIO/DOUT) + 0, // GPIO09 + 0, // GPIO10 + // GPIO11 (SD_CMD Flash) 0, GPIO_LED1_INV, // GPIO13 Blue Led (0 = On, 1 = Off) 0, 0, 0, 0 @@ -866,9 +976,12 @@ const mytmplt kModules[MAXMODULE] PROGMEM = { GPIO_USER, // GPIO02 Optional sensor SDA pad GPIO_USER, // GPIO03 Serial TXD and Optional sensor pad 0, 0, - 0, 0, 0, // Flash connection - 0, 0, - 0, // Flash connection + // GPIO06 (SD_CLK Flash) + // GPIO07 (SD_DATA0 Flash QIO/DIO/DOUT) + // GPIO08 (SD_DATA1 Flash QIO/DIO/DOUT) + 0, // GPIO09 + 0, // GPIO10 + // GPIO11 (SD_CMD Flash) GPIO_DI, // GPIO12 my9231 DI 0, GPIO_DCKI, // GPIO14 my9231 DCKI @@ -880,9 +993,12 @@ const mytmplt kModules[MAXMODULE] PROGMEM = { GPIO_USER, // GPIO02 Optional sensor SDA pad GPIO_USER, // GPIO03 Serial TXD and Optional sensor pad 0, 0, - 0, 0, 0, // Flash connection - 0, 0, - 0, // Flash connection + // GPIO06 (SD_CLK Flash) + // GPIO07 (SD_DATA0 Flash QIO/DIO/DOUT) + // GPIO08 (SD_DATA1 Flash QIO/DIO/DOUT) + 0, // GPIO09 (SD_DATA2 Flash QIO or ESP8285) + 0, // GPIO10 (SD_DATA3 Flash QIO or ESP8285) + // GPIO11 (SD_CMD Flash) 0, GPIO_DI, // GPIO13 my9291 DI 0, @@ -895,9 +1011,12 @@ const mytmplt kModules[MAXMODULE] PROGMEM = { GPIO_USER, // GPIO02 Optional Sensor (J3 Pin 5) GPIO_USER, // GPIO03 Serial TXD and Optional sensor 0, 0, - 0, 0, 0, // Flash connection - 0, 0, - 0, // Flash connection + // GPIO06 (SD_CLK Flash) + // GPIO07 (SD_DATA0 Flash QIO/DIO/DOUT) + // GPIO08 (SD_DATA1 Flash QIO/DIO/DOUT) + 0, // GPIO09 + 0, // GPIO10 + // GPIO11 (SD_CMD Flash) GPIO_REL1, // GPIO12 Blue Led and Relay 1 (0 = Off, 1 = On) GPIO_LED1_INV, // GPIO13 Blue Led (0 = On, 1 = Off) 0, 0, 0, 0 @@ -909,10 +1028,12 @@ const mytmplt kModules[MAXMODULE] PROGMEM = { GPIO_USER, // GPIO03 Serial TXD and Optional sensor 0, GPIO_REL2, // GPIO05 Blue Led and Relay 2 (0 = Off, 1 = On) - 0, 0, 0, // Flash connection + // GPIO06 (SD_CLK Flash) + // GPIO07 (SD_DATA0 Flash QIO/DIO/DOUT) + // GPIO08 (SD_DATA1 Flash QIO/DIO/DOUT) GPIO_KEY2, // GPIO09 Button 2 - 0, - 0, // Flash connection + 0, // GPIO10 + // GPIO11 (SD_CMD Flash) GPIO_REL1, // GPIO12 Blue Led and Relay 1 (0 = Off, 1 = On) GPIO_LED1_INV, // GPIO13 Blue Led (0 = On, 1 = Off) 0, 0, 0, 0 @@ -924,10 +1045,12 @@ const mytmplt kModules[MAXMODULE] PROGMEM = { GPIO_USER, // GPIO03 Serial TXD and Optional sensor GPIO_REL3, // GPIO04 Blue Led and Relay 3 (0 = Off, 1 = On) GPIO_REL2, // GPIO05 Blue Led and Relay 2 (0 = Off, 1 = On) - 0, 0, 0, // Flash connection + // GPIO06 (SD_CLK Flash) + // GPIO07 (SD_DATA0 Flash QIO/DIO/DOUT) + // GPIO08 (SD_DATA1 Flash QIO/DIO/DOUT) GPIO_KEY2, // GPIO09 Button 2 GPIO_KEY3, // GPIO10 Button 3 - 0, // Flash connection + // GPIO11 (SD_CMD Flash) GPIO_REL1, // GPIO12 Blue Led and Relay 1 (0 = Off, 1 = On) GPIO_LED1_INV, // GPIO13 Blue Led (0 = On, 1 = Off) 0, 0, 0, 0 @@ -940,7 +1063,12 @@ const mytmplt kModules[MAXMODULE] PROGMEM = { GPIO_USER, // GPIO03 Serial TXD and Optional sensor GPIO_KEY1, // GPIO04 Button 1 GPIO_REL1, // GPIO05 Relay 1 (0 = Off, 1 = On) - 0, 0, 0, 0, 0, 0, // Flash connection + // GPIO06 (SD_CLK Flash) + // GPIO07 (SD_DATA0 Flash QIO/DIO/DOUT) + // GPIO08 (SD_DATA1 Flash QIO/DIO/DOUT) + 0, // GPIO09 (SD_DATA2 Flash QIO or ESP8285) + 0, // GPIO10 (SD_DATA3 Flash QIO or ESP8285) + // GPIO11 (SD_CMD Flash) GPIO_USER, // GPIO12 Optional sensor GPIO_REL2, // GPIO13 Relay 2 (0 = Off, 1 = On) GPIO_USER, // GPIO14 Optional sensor @@ -956,7 +1084,12 @@ const mytmplt kModules[MAXMODULE] PROGMEM = { GPIO_USER, // GPIO03 Serial TXD and Optional sensor GPIO_KEY1, // GPIO04 D2 push button on ESP-12F board GPIO_USER, // GPIO05 D1 optional sensor - 0, 0, 0, 0, 0, 0, // Flash connection + // GPIO06 (SD_CLK Flash) + // GPIO07 (SD_DATA0 Flash QIO/DIO/DOUT) + // GPIO08 (SD_DATA1 Flash QIO/DIO/DOUT) + 0, // GPIO09 (SD_DATA2 Flash QIO or ESP8285) + 0, // GPIO10 (SD_DATA3 Flash QIO or ESP8285) + // GPIO11 (SD_CMD Flash) GPIO_PWM2, // GPIO12 D6 RGB LED Green GPIO_PWM3, // GPIO13 D7 RGB LED Blue GPIO_USER, // GPIO14 D5 optional sensor @@ -973,7 +1106,12 @@ const mytmplt kModules[MAXMODULE] PROGMEM = { GPIO_USER, // GPIO03 Serial TXD and Optional sensor - Module Pin 3 GPIO_REL1, // GPIO04 Red Led and Relay (0 = Off, 1 = On) - Module Pin 10 GPIO_KEY1, // GPIO05 Blue Led and OptoCoupler input - Module Pin 9 - 0, 0, 0, 0, 0, 0, // Flash connection + // GPIO06 (SD_CLK Flash) + // GPIO07 (SD_DATA0 Flash QIO/DIO/DOUT) + // GPIO08 (SD_DATA1 Flash QIO/DIO/DOUT) + 0, // GPIO09 (SD_DATA2 Flash QIO or ESP8285) + 0, // GPIO10 (SD_DATA3 Flash QIO or ESP8285) + // GPIO11 (SD_CMD Flash) 0, 0, 0, 0, 0 }, { "MagicHome", // Magic Home (aka Flux-light) (ESP8266) and Arilux LC10 (ESP8285) @@ -984,7 +1122,12 @@ const mytmplt kModules[MAXMODULE] PROGMEM = { GPIO_USER, // GPIO03 Serial TXD and Optional sensor GPIO_ARIRFRCV, // GPIO04 IR or RF receiver (optional) (Arilux LC10) GPIO_PWM2, // GPIO05 RGB LED Green - 0, 0, 0, 0, 0, 0, // Flash connection + // GPIO06 (SD_CLK Flash) + // GPIO07 (SD_DATA0 Flash QIO/DIO/DOUT) + // GPIO08 (SD_DATA1 Flash QIO/DIO/DOUT) + 0, // GPIO09 (SD_DATA2 Flash QIO or ESP8285) + 0, // GPIO10 (SD_DATA3 Flash QIO or ESP8285) + // GPIO11 (SD_CMD Flash) GPIO_PWM3, // GPIO12 RGB LED Blue GPIO_USER, // GPIO13 RGBW LED White (optional - set to PWM4 for Cold White or Warm White as used on Arilux LC10) GPIO_PWM1, // GPIO14 RGB LED Red @@ -999,7 +1142,12 @@ const mytmplt kModules[MAXMODULE] PROGMEM = { GPIO_USER, // GPIO03 Serial TXD and Optional sensor GPIO_REL1, // GPIO04 Relay 1 (0 = Off, 1 = On) GPIO_REL2, // GPIO05 Relay 2 (0 = Off, 1 = On) - 0, 0, 0, 0, 0, 0, // Flash connection + // GPIO06 (SD_CLK Flash) + // GPIO07 (SD_DATA0 Flash QIO/DIO/DOUT) + // GPIO08 (SD_DATA1 Flash QIO/DIO/DOUT) + 0, // GPIO09 (SD_DATA2 Flash QIO or ESP8285) + 0, // GPIO10 (SD_DATA3 Flash QIO or ESP8285) + // GPIO11 (SD_CMD Flash) GPIO_SWT1, // GPIO12 External input 1 (0 = On, 1 = Off) GPIO_SWT2, // GPIO13 External input 2 (0 = On, 1 = Off) GPIO_USER, // GPIO14 Optional sensor / I2C SCL pad @@ -1013,7 +1161,12 @@ const mytmplt kModules[MAXMODULE] PROGMEM = { 0, 0, 0, GPIO_HLW_CF, // GPIO04 HLW8012 CF power GPIO_NRG_CF1, // GPIO05 HLW8012 CF1 voltage / current - 0, 0, 0, 0, 0, 0, // Flash connection + // GPIO06 (SD_CLK Flash) + // GPIO07 (SD_DATA0 Flash QIO/DIO/DOUT) + // GPIO08 (SD_DATA1 Flash QIO/DIO/DOUT) + 0, // GPIO09 (SD_DATA2 Flash QIO or ESP8285) + 0, // GPIO10 (SD_DATA3 Flash QIO or ESP8285) + // GPIO11 (SD_CMD Flash) GPIO_NRG_SEL, // GPIO12 HLW8012 SEL (1 = Voltage) GPIO_LED1_INV, // GPIO13 Green Led GPIO_REL1, // GPIO14 Relay @@ -1028,7 +1181,12 @@ const mytmplt kModules[MAXMODULE] PROGMEM = { GPIO_USER, // GPIO03 Serial TXD and Optional sensor GPIO_ARIRFRCV, // GPIO04 IR or RF receiver (optional) GPIO_PWM1, // GPIO05 RGB LED Red - 0, 0, 0, 0, 0, 0, // Flash connection + // GPIO06 (SD_CLK Flash) + // GPIO07 (SD_DATA0 Flash QIO/DIO/DOUT) + // GPIO08 (SD_DATA1 Flash QIO/DIO/DOUT) + 0, // GPIO09 (SD_DATA2 Flash QIO or ESP8285) + 0, // GPIO10 (SD_DATA3 Flash QIO or ESP8285) + // GPIO11 (SD_CMD Flash) GPIO_PWM2, // GPIO12 RGB LED Green GPIO_PWM3, // GPIO13 RGB LED Blue GPIO_USER, // GPIO14 RGBW LED White (optional - set to PWM4 for Cold White or Warm White) @@ -1043,7 +1201,12 @@ const mytmplt kModules[MAXMODULE] PROGMEM = { GPIO_USER, // GPIO03 Serial TXD and Optional sensor GPIO_PWM2, // GPIO04 RGB LED Green GPIO_PWM1, // GPIO05 RGB LED Red - 0, 0, 0, 0, 0, 0, // Flash connection + // GPIO06 (SD_CLK Flash) + // GPIO07 (SD_DATA0 Flash QIO/DIO/DOUT) + // GPIO08 (SD_DATA1 Flash QIO/DIO/DOUT) + 0, // GPIO09 (SD_DATA2 Flash QIO or ESP8285) + 0, // GPIO10 (SD_DATA3 Flash QIO or ESP8285) + // GPIO11 (SD_CMD Flash) GPIO_PWM5, // GPIO12 RGBCW LED Warm GPIO_PWM4, // GPIO13 RGBW LED Cold GPIO_PWM3, // GPIO14 RGB LED Blue @@ -1057,10 +1220,12 @@ const mytmplt kModules[MAXMODULE] PROGMEM = { GPIO_USER, // GPIO03 Serial TXD and Optional sensor 0, GPIO_REL2, // GPIO05 Relay 2 (0 = Off, 1 = On) - 0, 0, 0, // Flash connection + // GPIO06 (SD_CLK Flash) + // GPIO07 (SD_DATA0 Flash QIO/DIO/DOUT) + // GPIO08 (SD_DATA1 Flash QIO/DIO/DOUT) GPIO_USER, // GPIO09 Button 1 on header (0 = On, 1 = Off) GPIO_KEY1, // GPIO10 Button on casing - 0, // Flash connection + // GPIO11 (SD_CMD Flash) GPIO_REL1, // GPIO12 Relay 1 (0 = Off, 1 = On) GPIO_LED1_INV, // GPIO13 Blue Led (0 = On, 1 = Off) 0, 0, 0, 0 @@ -1073,7 +1238,12 @@ const mytmplt kModules[MAXMODULE] PROGMEM = { GPIO_USER, // GPIO03 Serial TXD and Optional sensor GPIO_USER, // GPIO04 W2 - PWM5 0, - 0, 0, 0, 0, 0, 0, // Flash connection + // GPIO06 (SD_CLK Flash) + // GPIO07 (SD_DATA0 Flash QIO/DIO/DOUT) + // GPIO08 (SD_DATA1 Flash QIO/DIO/DOUT) + 0, // GPIO09 (SD_DATA2 Flash QIO or ESP8285) + 0, // GPIO10 (SD_DATA3 Flash QIO or ESP8285) + // GPIO11 (SD_CMD Flash) GPIO_PWM2, // GPIO12 RGB LED Green GPIO_PWM3, // GPIO13 RGB LED Blue GPIO_PWM1, // GPIO14 RGB LED Red @@ -1086,7 +1256,12 @@ const mytmplt kModules[MAXMODULE] PROGMEM = { 0, 0, // GPIO03 Serial TXD 0, 0, - 0, 0, 0, 0, 0, 0, // Flash connection + // GPIO06 (SD_CLK Flash) + // GPIO07 (SD_DATA0 Flash QIO/DIO/DOUT) + // GPIO08 (SD_DATA1 Flash QIO/DIO/DOUT) + 0, // GPIO09 (SD_DATA2 Flash QIO or ESP8285) + 0, // GPIO10 (SD_DATA3 Flash QIO or ESP8285) + // GPIO11 (SD_CMD Flash) GPIO_REL1, // GPIO12 Red Led and Relay (0 = Off, 1 = On) GPIO_LED1_INV, // GPIO13 Green Led (0 = On, 1 = Off) 0, 0, 0, 0 @@ -1099,7 +1274,12 @@ const mytmplt kModules[MAXMODULE] PROGMEM = { 0, GPIO_USER, // GPIO04 W2 - PWM5 0, - 0, 0, 0, 0, 0, 0, // Flash connection + // GPIO06 (SD_CLK Flash) + // GPIO07 (SD_DATA0 Flash QIO/DIO/DOUT) + // GPIO08 (SD_DATA1 Flash QIO/DIO/DOUT) + 0, // GPIO09 (SD_DATA2 Flash QIO or ESP8285) + 0, // GPIO10 (SD_DATA3 Flash QIO or ESP8285) + // GPIO11 (SD_CMD Flash) GPIO_PWM2, // GPIO12 RGB LED Green GPIO_PWM1, // GPIO13 RGB LED Red GPIO_PWM3, // GPIO14 RGB LED Blue @@ -1111,7 +1291,12 @@ const mytmplt kModules[MAXMODULE] PROGMEM = { 0, 0, // GPIO03 Serial TXD 0, 0, - 0, 0, 0, 0, 0, 0, // Flash connection + // GPIO06 (SD_CLK Flash) + // GPIO07 (SD_DATA0 Flash QIO/DIO/DOUT) + // GPIO08 (SD_DATA1 Flash QIO/DIO/DOUT) + 0, // GPIO09 (SD_DATA2 Flash QIO or ESP8285) + 0, // GPIO10 (SD_DATA3 Flash QIO or ESP8285) + // GPIO11 (SD_CMD Flash) GPIO_REL1, // GPIO12 Red Led and Relay (0 = Off, 1 = On) GPIO_LED1_INV, // GPIO13 Blue Led (0 = On, 1 = Off) 0, 0, 0, 0 @@ -1123,10 +1308,12 @@ const mytmplt kModules[MAXMODULE] PROGMEM = { GPIO_USER, // GPIO03 ESP_RXD Serial TXD and Optional sensor GPIO_REL3, // GPIO04 WIFI_O2 Relay 3 (0 = Off, 1 = On) controlling the fan GPIO_REL2, // GPIO05 WIFI_O1 Relay 2 (0 = Off, 1 = On) controlling the fan - 0, 0, 0, // Flash connection + // GPIO06 (SD_CLK Flash) + // GPIO07 (SD_DATA0 Flash QIO/DIO/DOUT) + // GPIO08 (SD_DATA1 Flash QIO/DIO/DOUT) GPIO_KEY2, // GPIO09 WIFI_KEY1 Virtual button 2 as feedback from RC GPIO_KEY3, // GPIO10 WIFI_KEY2 Virtual button 3 as feedback from RC - 0, // Flash connection + // GPIO11 (SD_CMD Flash) GPIO_REL1, // GPIO12 WIFI_O0 Relay 1 (0 = Off, 1 = On) controlling the light GPIO_LED1_INV, // GPIO13 WIFI_CHK Blue Led on PCA (0 = On, 1 = Off) GPIO_KEY4, // GPIO14 WIFI_KEY3 Virtual button 4 as feedback from RC @@ -1144,37 +1331,57 @@ const mytmplt kModules[MAXMODULE] PROGMEM = { GPIO_USER, // GPIO03 Serial TXD and Optional sensor 0, GPIO_HJL_CF, // GPIO05 BL0937 or HJL-01 CF power - 0, 0, 0, 0, 0, 0, // Flash connection + // GPIO06 (SD_CLK Flash) + // GPIO07 (SD_DATA0 Flash QIO/DIO/DOUT) + // GPIO08 (SD_DATA1 Flash QIO/DIO/DOUT) + 0, // GPIO09 (SD_DATA2 Flash QIO or ESP8285) + 0, // GPIO10 (SD_DATA3 Flash QIO or ESP8285) + // GPIO11 (SD_CMD Flash) GPIO_NRG_SEL_INV, // GPIO12 BL0937 or HJL-01 Sel output (0 = Voltage) GPIO_KEY1, // GPIO13 Button GPIO_NRG_CF1, // GPIO14 BL0937 or HJL-01 CF1 current / voltage GPIO_REL1, // GPIO15 Relay (0 = Off, 1 = On) 0, 0 }, - { "Shelly 1", // Shelly1 Open Source (ESP8266 - 2MB) - https://shelly.cloud/shelly1-open-source/ + { "Shelly 1", // Shelly1 Open Source (ESP8266 - 2MB) - https://shelly.cloud/shelly1-open-source/ 0, 0, 0, 0, - GPIO_REL1, // GPIO04 Relay (0 = Off, 1 = On) - GPIO_SWT1_NP, // GPIO05 SW pin - 0, 0, 0, 0, 0, 0, // Flash connection + GPIO_REL1, // GPIO04 Relay (0 = Off, 1 = On) + GPIO_SWT1_NP, // GPIO05 SW pin + // GPIO06 (SD_CLK Flash) + // GPIO07 (SD_DATA0 Flash QIO/DIO/DOUT) + // GPIO08 (SD_DATA1 Flash QIO/DIO/DOUT) + 0, // GPIO09 (SD_DATA2 Flash QIO or ESP8285) + 0, // GPIO10 (SD_DATA3 Flash QIO or ESP8285) + // GPIO11 (SD_CMD Flash) 0, 0, 0, 0, 0, 0 }, - { "Shelly 2", // Shelly2 (ESP8266 - 2MB) - https://shelly.cloud/shelly2/ + { "Shelly 2", // Shelly2 (ESP8266 - 2MB) - https://shelly.cloud/shelly2/ 0, - GPIO_TXD, // GPIO01 MCP39F501 Serial input + GPIO_TXD, // GPIO01 MCP39F501 Serial input 0, - GPIO_RXD, // GPIO03 MCP39F501 Serial output - GPIO_REL1, // GPIO04 - GPIO_REL2, // GPIO05 - 0, 0, 0, 0, 0, 0, // Flash connection - GPIO_SWT1, // GPIO12 + GPIO_RXD, // GPIO03 MCP39F501 Serial output + GPIO_REL1, // GPIO04 + GPIO_REL2, // GPIO05 + // GPIO06 (SD_CLK Flash) + // GPIO07 (SD_DATA0 Flash QIO/DIO/DOUT) + // GPIO08 (SD_DATA1 Flash QIO/DIO/DOUT) + 0, // GPIO09 (SD_DATA2 Flash QIO or ESP8285) + 0, // GPIO10 (SD_DATA3 Flash QIO or ESP8285) + // GPIO11 (SD_CMD Flash) + GPIO_SWT1, // GPIO12 0, - GPIO_SWT2, // GPIO14 - 0, // GPIO15 MCP39F501 Reset + GPIO_SWT2, // GPIO14 + 0, // GPIO15 MCP39F501 Reset 0, 0 }, { "Xiaomi Philips", // Xiaomi Philips bulb (ESP8266) 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, + // GPIO06 (SD_CLK Flash) + // GPIO07 (SD_DATA0 Flash QIO/DIO/DOUT) + // GPIO08 (SD_DATA1 Flash QIO/DIO/DOUT) + 0, // GPIO09 (SD_DATA2 Flash QIO or ESP8285) + 0, // GPIO10 (SD_DATA3 Flash QIO or ESP8285) + // GPIO11 (SD_CMD Flash) GPIO_PWM2, // GPIO12 cold/warm light 0, 0, GPIO_PWM1, // GPIO15 light intensity @@ -1185,7 +1392,12 @@ const mytmplt kModules[MAXMODULE] PROGMEM = { 0, 0, 0, 0, GPIO_LED1_INV, // GPIO04 Red Led (0 = On, 1 = Off) 0, - 0, 0, 0, 0, 0, 0, // Flash connection + // GPIO06 (SD_CLK Flash) + // GPIO07 (SD_DATA0 Flash QIO/DIO/DOUT) + // GPIO08 (SD_DATA1 Flash QIO/DIO/DOUT) + 0, // GPIO09 (SD_DATA2 Flash QIO or ESP8285) + 0, // GPIO10 (SD_DATA3 Flash QIO or ESP8285) + // GPIO11 (SD_CMD Flash) GPIO_REL1, // GPIO12 Red Led and Relay (0 = Off, 1 = On) GPIO_KEY1, // GPIO13 Button 0, 0, 0, 0 @@ -1198,7 +1410,12 @@ const mytmplt kModules[MAXMODULE] PROGMEM = { GPIO_USER, // GPIO03 Serial TXD and Optional sensor GPIO_KEY1, // GPIO04 Button 1 GPIO_REL2_INV, // GPIO05 Red Led 2 (0 = On, 1 = Off) - 0, 0, 0, 0, 0, 0, // Flash connection + // GPIO06 (SD_CLK Flash) + // GPIO07 (SD_DATA0 Flash QIO/DIO/DOUT) + // GPIO08 (SD_DATA1 Flash QIO/DIO/DOUT) + 0, // GPIO09 (SD_DATA2 Flash QIO or ESP8285) + 0, // GPIO10 (SD_DATA3 Flash QIO or ESP8285) + // GPIO11 (SD_CMD Flash) GPIO_REL4_INV, // GPIO12 Blue Led 4 (0 = On, 1 = Off) GPIO_KEY4, // GPIO13 Button 4 GPIO_KEY3, // GPIO14 Button 3 @@ -1212,7 +1429,12 @@ const mytmplt kModules[MAXMODULE] PROGMEM = { GPIO_USER, // GPIO03 Serial TXD GPIO_LED1, // GPIO04 Blue LED GPIO_REL1, // GPIO05 (Relay OFF, but used as Relay Switch) - 0, 0, 0, 0, 0, 0, // Flash connection + // GPIO06 (SD_CLK Flash) + // GPIO07 (SD_DATA0 Flash QIO/DIO/DOUT) + // GPIO08 (SD_DATA1 Flash QIO/DIO/DOUT) + 0, // GPIO09 (SD_DATA2 Flash QIO or ESP8285) + 0, // GPIO10 (SD_DATA3 Flash QIO or ESP8285) + // GPIO11 (SD_CMD Flash) GPIO_LED2, // GPIO12 (Relay ON, but set to LOW, so we can switch with GPIO05) GPIO_USER, // GPIO13 GPIO_KEY1, // GPIO14 Button @@ -1227,7 +1449,12 @@ const mytmplt kModules[MAXMODULE] PROGMEM = { GPIO_LED2_INV, // GPIO03 Serial RXD and Red Led (0 = On, 1 = Off) GPIO_HJL_CF, // GPIO04 BL0937 or HJL-01 CF power GPIO_NRG_CF1, // GPIO05 BL0937 or HJL-01 CF1 current / voltage - 0, 0, 0, 0, 0, 0, // Flash connection + // GPIO06 (SD_CLK Flash) + // GPIO07 (SD_DATA0 Flash QIO/DIO/DOUT) + // GPIO08 (SD_DATA1 Flash QIO/DIO/DOUT) + 0, // GPIO09 (SD_DATA2 Flash QIO or ESP8285) + 0, // GPIO10 (SD_DATA3 Flash QIO or ESP8285) + // GPIO11 (SD_CMD Flash) GPIO_NRG_SEL_INV, // GPIO12 BL0937 or HJL-01 Sel output (0 = Voltage) GPIO_LED1_INV, // GPIO13 Blue Led (0 = On, 1 = Off) GPIO_REL1, // GPIO14 Relay (0 = Off, 1 = On) @@ -1239,7 +1466,12 @@ const mytmplt kModules[MAXMODULE] PROGMEM = { GPIO_KEY1, // GPIO03 Button GPIO_HLW_CF, // GPIO04 HLW8012 CF power GPIO_NRG_CF1, // GPIO05 HLW8012 CF1 current / voltage - 0, 0, 0, 0, 0, 0, // Flash connection + // GPIO06 (SD_CLK Flash) + // GPIO07 (SD_DATA0 Flash QIO/DIO/DOUT) + // GPIO08 (SD_DATA1 Flash QIO/DIO/DOUT) + 0, // GPIO09 (SD_DATA2 Flash QIO or ESP8285) + 0, // GPIO10 (SD_DATA3 Flash QIO or ESP8285) + // GPIO11 (SD_CMD Flash) GPIO_NRG_SEL_INV, // GPIO12 HLW8012 CF Sel output (0 = Voltage) GPIO_LED1_INV, // GPIO13 LED (0 = On, 1 = Off) GPIO_REL1, // GPIO14 Relay SRU 5VDC SDA (0 = Off, 1 = On ) @@ -1253,7 +1485,12 @@ const mytmplt kModules[MAXMODULE] PROGMEM = { GPIO_USER, // GPIO03 MCU serial control GPIO_USER, GPIO_USER, - 0, 0, 0, 0, 0, 0, // Flash connection + // GPIO06 (SD_CLK Flash) + // GPIO07 (SD_DATA0 Flash QIO/DIO/DOUT) + // GPIO08 (SD_DATA1 Flash QIO/DIO/DOUT) + 0, // GPIO09 (SD_DATA2 Flash QIO or ESP8285) + 0, // GPIO10 (SD_DATA3 Flash QIO or ESP8285) + // GPIO11 (SD_CMD Flash) GPIO_USER, GPIO_USER, GPIO_USER, // GPIO14 Green Led @@ -1268,22 +1505,32 @@ const mytmplt kModules[MAXMODULE] PROGMEM = { GPIO_KEY1, // GPIO03 Serial TXD and Button GPIO_HJL_CF, // GPIO04 BL0937 or HJL-01 CF power GPIO_NRG_CF1, // GPIO05 BL0937 or HJL-01 CF1 current / voltage - 0, 0, 0, 0, 0, 0, // Flash connection + // GPIO06 (SD_CLK Flash) + // GPIO07 (SD_DATA0 Flash QIO/DIO/DOUT) + // GPIO08 (SD_DATA1 Flash QIO/DIO/DOUT) + 0, // GPIO09 (SD_DATA2 Flash QIO or ESP8285) + 0, // GPIO10 (SD_DATA3 Flash QIO or ESP8285) + // GPIO11 (SD_CMD Flash) GPIO_NRG_SEL_INV, // GPIO12 BL0937 or HJL-01 Sel output (0 = Voltage) GPIO_LED2_INV, // GPIO13 LED2 (red) inv GPIO_REL1, // GPIO14 Relay (0 = Off, 1 = On) 0, 0, 0 }, - { "ARMTR Dimmer", // ARMTRONIX Dimmer, one or two channel (ESP8266 w/ separate MCU dimmer) - // https://www.tindie.com/products/Armtronix/wifi-ac-dimmer-two-triac-board/ - // https://www.tindie.com/products/Armtronix/wifi-ac-dimmer-esp8266-one-triac-board-alexaecho/ + { "ARMTR Dimmer", // ARMTRONIX Dimmer, one or two channel (ESP8266 w/ separate MCU dimmer) + // https://www.tindie.com/products/Armtronix/wifi-ac-dimmer-two-triac-board/ + // https://www.tindie.com/products/Armtronix/wifi-ac-dimmer-esp8266-one-triac-board-alexaecho/ GPIO_USER, - GPIO_TXD, // GPIO01 MCU serial control + GPIO_TXD, // GPIO01 MCU serial control GPIO_USER, - GPIO_RXD, // GPIO03 MCU serial control + GPIO_RXD, // GPIO03 MCU serial control GPIO_USER, GPIO_USER, - 0, 0, 0, 0, 0, 0, // Flash connection + // GPIO06 (SD_CLK Flash) + // GPIO07 (SD_DATA0 Flash QIO/DIO/DOUT) + // GPIO08 (SD_DATA1 Flash QIO/DIO/DOUT) + 0, // GPIO09 (SD_DATA2 Flash QIO or ESP8285) + 0, // GPIO10 (SD_DATA3 Flash QIO or ESP8285) + // GPIO11 (SD_CMD Flash) GPIO_USER, GPIO_USER, GPIO_USER, @@ -1296,7 +1543,12 @@ const mytmplt kModules[MAXMODULE] PROGMEM = { 0, 0, 0, GPIO_HLW_CF, // GPIO04 HLW8012 CF power GPIO_NRG_CF1, // GPIO05 HLW8012 CF1 current / voltage - 0, 0, 0, 0, 0, 0, // Flash connection + // GPIO06 (SD_CLK Flash) + // GPIO07 (SD_DATA0 Flash QIO/DIO/DOUT) + // GPIO08 (SD_DATA1 Flash QIO/DIO/DOUT) + 0, // GPIO09 (SD_DATA2 Flash QIO or ESP8285) + 0, // GPIO10 (SD_DATA3 Flash QIO or ESP8285) + // GPIO11 (SD_CMD Flash) GPIO_NRG_SEL_INV, // GPIO12 HLW8012 CF Sel output (0 = Voltage) GPIO_LED2_INV, // GPIO13 Red Led (0 = On, 1 = Off) GPIO_LED1_INV, // GPIO14 Blue Led (0 = On, 1 = Off) @@ -1311,7 +1563,12 @@ const mytmplt kModules[MAXMODULE] PROGMEM = { GPIO_RXD, // GPIO03 MCU serial control GPIO_USER, GPIO_USER, - 0, 0, 0, 0, 0, 0, // Flash connection + // GPIO06 (SD_CLK Flash) + // GPIO07 (SD_DATA0 Flash QIO/DIO/DOUT) + // GPIO08 (SD_DATA1 Flash QIO/DIO/DOUT) + 0, // GPIO09 (SD_DATA2 Flash QIO or ESP8285) + 0, // GPIO10 (SD_DATA3 Flash QIO or ESP8285) + // GPIO11 (SD_CMD Flash) GPIO_USER, GPIO_LED1, // GPIO13 WiFi LED GPIO_USER, @@ -1328,7 +1585,12 @@ const mytmplt kModules[MAXMODULE] PROGMEM = { 0, GPIO_REL1, // GPIO04 Relay (0 = Off, 1 = On) GPIO_HJL_CF, // GPIO05 BL0937 or HJL-01 CF power - 0, 0, 0, 0, 0, 0, // Flash connection + // GPIO06 (SD_CLK Flash) + // GPIO07 (SD_DATA0 Flash QIO/DIO/DOUT) + // GPIO08 (SD_DATA1 Flash QIO/DIO/DOUT) + 0, // GPIO09 (SD_DATA2 Flash QIO or ESP8285) + 0, // GPIO10 (SD_DATA3 Flash QIO or ESP8285) + // GPIO11 (SD_CMD Flash) GPIO_NRG_SEL_INV, // GPIO12 BL0937 or HJL-01 Sel output (0 = Voltage) GPIO_KEY1, // GPIO13 Button GPIO_NRG_CF1, // GPIO14 BL0937 or HJL-01 CF1 current / voltage @@ -1343,7 +1605,12 @@ const mytmplt kModules[MAXMODULE] PROGMEM = { GPIO_KEY1, // GPIO03 Serial TXD + Button GPIO_REL2, // GPIO04 Relay 2 GPIO_REL1, // GPIO05 Relay 1 - 0, 0, 0, 0, 0, 0, // Flash connection + // GPIO06 (SD_CLK Flash) + // GPIO07 (SD_DATA0 Flash QIO/DIO/DOUT) + // GPIO08 (SD_DATA1 Flash QIO/DIO/DOUT) + 0, // GPIO09 (SD_DATA2 Flash QIO or ESP8285) + 0, // GPIO10 (SD_DATA3 Flash QIO or ESP8285) + // GPIO11 (SD_CMD Flash) GPIO_REL3, // GPIO12 Relay 3 GPIO_REL4, // GPIO13 Relay 4 GPIO_USER, // GPIO14 @@ -1364,7 +1631,12 @@ const mytmplt kModules[MAXMODULE] PROGMEM = { GPIO_USER, // GPIO03 Serial TXD and Optional sensor GPIO_USER, // GPIO04 IR receiver (optional) GPIO_PWM2, // GPIO05 RGB LED Green - 0, 0, 0, 0, 0, 0, // Flash connection + // GPIO06 (SD_CLK Flash) + // GPIO07 (SD_DATA0 Flash QIO/DIO/DOUT) + // GPIO08 (SD_DATA1 Flash QIO/DIO/DOUT) + 0, // GPIO09 (SD_DATA2 Flash QIO or ESP8285) + 0, // GPIO10 (SD_DATA3 Flash QIO or ESP8285) + // GPIO11 (SD_CMD Flash) GPIO_PWM3, // GPIO12 RGB LED Blue GPIO_USER, // GPIO13 RGBW LED White (optional - set to PWM4 for Cold White or Warm White) GPIO_PWM1, // GPIO14 RGB LED Red @@ -1380,7 +1652,12 @@ const mytmplt kModules[MAXMODULE] PROGMEM = { GPIO_USER, // GPIO03 Serial TXD and Optional sensor0 GPIO_ARIRFRCV, // GPIO04 RF receiver input GPIO_PWM2, // GPIO05 RGB LED Green - 0, 0, 0, 0, 0, 0, // Flash connection + // GPIO06 (SD_CLK Flash) + // GPIO07 (SD_DATA0 Flash QIO/DIO/DOUT) + // GPIO08 (SD_DATA1 Flash QIO/DIO/DOUT) + 0, // GPIO09 (SD_DATA2 Flash QIO or ESP8285) + 0, // GPIO10 (SD_DATA3 Flash QIO or ESP8285) + // GPIO11 (SD_CMD Flash) GPIO_PWM3, // GPIO12 RGB LED Blue GPIO_PWM4, // GPIO13 RGBW LED White GPIO_PWM1, // GPIO14 RGB LED Red @@ -1393,7 +1670,12 @@ const mytmplt kModules[MAXMODULE] PROGMEM = { GPIO_KEY2, // GPIO03 Serial TXD and Optional sensor GPIO_REL2, // GPIO04 Relay 2 GPIO_KEY3, // GPIO05 Input 2 - 0, 0, 0, 0, 0, 0, // Flash connection + // GPIO06 (SD_CLK Flash) + // GPIO07 (SD_DATA0 Flash QIO/DIO/DOUT) + // GPIO08 (SD_DATA1 Flash QIO/DIO/DOUT) + 0, // GPIO09 (SD_DATA2 Flash QIO or ESP8285) + 0, // GPIO10 (SD_DATA3 Flash QIO or ESP8285) + // GPIO11 (SD_CMD Flash) GPIO_KEY1, // GPIO12 Key input GPIO_REL1, // GPIO13 Relay 1 0, @@ -1405,7 +1687,12 @@ const mytmplt kModules[MAXMODULE] PROGMEM = { 0, 0, 0, 0, GPIO_REL1, // GPIO04 Relay (0 = Off, 1 = On) 0, - 0, 0, 0, 0, 0, 0, // Flash connection + // GPIO06 (SD_CLK Flash) + // GPIO07 (SD_DATA0 Flash QIO/DIO/DOUT) + // GPIO08 (SD_DATA1 Flash QIO/DIO/DOUT) + 0, // GPIO09 (SD_DATA2 Flash QIO or ESP8285) + 0, // GPIO10 (SD_DATA3 Flash QIO or ESP8285) + // GPIO11 (SD_CMD Flash) GPIO_KEY1, // GPIO12 Button 0, 0, GPIO_LED1, // GPIO15 Led (1 = On, 0 = Off) @@ -1416,7 +1703,12 @@ const mytmplt kModules[MAXMODULE] PROGMEM = { 0, 0, 0, 0, GPIO_LED1_INV, // GPIO04 Blue Led (0 = On, 1 = Off) 0, // GPIO05 IR or RF receiver (optional) - 0, 0, 0, 0, 0, 0, // Flash connection + // GPIO06 (SD_CLK Flash) + // GPIO07 (SD_DATA0 Flash QIO/DIO/DOUT) + // GPIO08 (SD_DATA1 Flash QIO/DIO/DOUT) + 0, // GPIO09 (SD_DATA2 Flash QIO or ESP8285) + 0, // GPIO10 (SD_DATA3 Flash QIO or ESP8285) + // GPIO11 (SD_CMD Flash) GPIO_REL1, // GPIO12 Relay and Red Led (0 = Off, 1 = On) GPIO_KEY1, // GPIO13 Button 0, 0, 0, 0 @@ -1429,7 +1721,12 @@ const mytmplt kModules[MAXMODULE] PROGMEM = { GPIO_USER, // GPIO03 GPIO_LED1_INV, // GPIO04 Blue LED GPIO_REL1, // GPIO05 Red LED and relay - 0, 0, 0, 0, 0, 0, // Flash connection + // GPIO06 (SD_CLK Flash) + // GPIO07 (SD_DATA0 Flash QIO/DIO/DOUT) + // GPIO08 (SD_DATA1 Flash QIO/DIO/DOUT) + 0, // GPIO09 (SD_DATA2 Flash QIO or ESP8285) + 0, // GPIO10 (SD_DATA3 Flash QIO or ESP8285) + // GPIO11 (SD_CMD Flash) 0, GPIO_KEY1, // GPIO13 Button (normally GPIO00) GPIO_USER, // GPIO14 @@ -1442,7 +1739,12 @@ const mytmplt kModules[MAXMODULE] PROGMEM = { 0, GPIO_USER, // GPIO04 IR receiver (optional) GPIO_PWM2, // GPIO05 RGB LED Green - 0, 0, 0, 0, 0, 0, // Flash connection + // GPIO06 (SD_CLK Flash) + // GPIO07 (SD_DATA0 Flash QIO/DIO/DOUT) + // GPIO08 (SD_DATA1 Flash QIO/DIO/DOUT) + 0, // GPIO09 (SD_DATA2 Flash QIO or ESP8285) + 0, // GPIO10 (SD_DATA3 Flash QIO or ESP8285) + // GPIO11 (SD_CMD Flash) GPIO_PWM1, // GPIO12 RGB LED Red GPIO_PWM3, // GPIO13 RGB LED Blue 0, @@ -1457,7 +1759,12 @@ const mytmplt kModules[MAXMODULE] PROGMEM = { GPIO_USER, // GPIO03 (D8) Serial TXD GPIO_USER, // GPIO04 (D4) 4 x WS2812 Leds, (DOUT) Extents WS2812 string GPIO_USER, // GPIO05 (D5) Blue Led - 0, 0, 0, 0, 0, 0, // Flash connection + // GPIO06 (SD_CLK Flash) + // GPIO07 (SD_DATA0 Flash QIO/DIO/DOUT) + // GPIO08 (SD_DATA1 Flash QIO/DIO/DOUT) + 0, // GPIO09 (SD_DATA2 Flash QIO or ESP8285) + 0, // GPIO10 (SD_DATA3 Flash QIO or ESP8285) + // GPIO11 (SD_CMD Flash) GPIO_USER, // GPIO12 (D12) GPIO_USER, // GPIO13 (D13) GPIO_USER, // GPIO14 (D14) @@ -1469,7 +1776,12 @@ const mytmplt kModules[MAXMODULE] PROGMEM = { { "Delock 11826", // Delock 11826 (ESP8285) = Sonoff Basic GPIO_KEY1, // GPIO00 Button 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, // Flash connection + // GPIO06 (SD_CLK Flash) + // GPIO07 (SD_DATA0 Flash QIO/DIO/DOUT) + // GPIO08 (SD_DATA1 Flash QIO/DIO/DOUT) + 0, // GPIO09 (SD_DATA2 Flash QIO or ESP8285) + 0, // GPIO10 (SD_DATA3 Flash QIO or ESP8285) + // GPIO11 (SD_CMD Flash) GPIO_REL1, // GPIO12 Red Led and Relay (0 = Off, 1 = On) GPIO_LED1_INV, // GPIO13 Green Led (0 = On, 1 = Off) 0, 0, 0, 0 diff --git a/sonoff/sonoff_version.h b/sonoff/sonoff_version.h index 490491e1c..8bb04be1a 100644 --- a/sonoff/sonoff_version.h +++ b/sonoff/sonoff_version.h @@ -20,7 +20,7 @@ #ifndef _SONOFF_VERSION_H_ #define _SONOFF_VERSION_H_ -#define VERSION 0x06040102 +#define VERSION 0x06040103 #define D_PROGRAMNAME "Sonoff-Tasmota" #define D_AUTHOR "Theo Arends" diff --git a/sonoff/support.ino b/sonoff/support.ino index 77b23eb5d..77e2223c0 100644 --- a/sonoff/support.ino +++ b/sonoff/support.ino @@ -504,7 +504,29 @@ String ModuleName() void ModuleGpios(myio *gp) { - memcpy_P(gp, &kModules[Settings.module].gp, 18); + uint8_t *dest = (uint8_t *)gp; + memset(dest, GPIO_NONE, sizeof(myio)); + + uint8_t src[sizeof(mycfgio)]; + memcpy_P(&src, &kModules[Settings.module].gp, sizeof(mycfgio)); + // 11 85 00 85 85 00 00 00 15 38 85 00 00 81 + +// AddLogSerial(LOG_LEVEL_DEBUG, (uint8_t *)&src, sizeof(mycfgio)); + + for (uint8_t i = 0; i < sizeof(mycfgio); i++) { + if (i < 6) { + dest[i] = src[i]; // GPIO00 - GPIO05 + } + else if (i < 8) { + dest[i +3] = src[i]; // GPIO09 - GPIO10 + } + else { + dest[i +4] = src[i]; // GPIO12 - GPIO16 and ADC0 + } + } + // 11 85 00 85 85 00 00 00 00 00 00 00 15 38 85 00 00 81 + +// AddLogSerial(LOG_LEVEL_DEBUG, (uint8_t *)gp, sizeof(myio)); } void SetGlobalValues(float temperature, float humidity) diff --git a/sonoff/xdrv_01_webserver.ino b/sonoff/xdrv_01_webserver.ino index 16201c2a1..a62e8ea47 100644 --- a/sonoff/xdrv_01_webserver.ino +++ b/sonoff/xdrv_01_webserver.ino @@ -826,7 +826,7 @@ void HandleModuleConfiguration(void) page.replace(F("{v}"), FPSTR(S_CONFIGURE_MODULE)); page += FPSTR(HTTP_SCRIPT_MODULE1); page.replace(F("}4"), String(Settings.module)); - for (byte i = 0; i < MAX_GPIO_PIN; i++) { + for (byte i = 0; i < sizeof(cmodule); i++) { if (GPIO_USER == ValidGPIO(i, cmodule.io[i])) { snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("sk(%d,%d);"), my_module.io[i], i); // g0 - g16 page += mqtt_data; @@ -838,7 +838,7 @@ void HandleModuleConfiguration(void) page += FPSTR(HTTP_FORM_MODULE); page.replace(F("{mt"), AnyModuleName(MODULE)); page += F("
"); - for (byte i = 0; i < MAX_GPIO_PIN; i++) { + for (byte i = 0; i < sizeof(cmodule); i++) { if (GPIO_USER == ValidGPIO(i, cmodule.io[i])) { snprintf_P(stemp, 3, PINS_WEMOS +i*2); snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR(""), @@ -864,7 +864,7 @@ void ModuleSaveSettings(void) myio cmodule; ModuleGpios(&cmodule); String gpios = ""; - for (byte i = 0; i < MAX_GPIO_PIN; i++) { + for (byte i = 0; i < sizeof(cmodule); i++) { if (Settings.last_module != new_module) { Settings.my_gp.io[i] = 0; } else { diff --git a/sonoff/xdrv_16_tuyadimmer.ino b/sonoff/xdrv_16_tuyadimmer.ino index eb564a8e8..d0ab215a5 100644 --- a/sonoff/xdrv_16_tuyadimmer.ino +++ b/sonoff/xdrv_16_tuyadimmer.ino @@ -248,7 +248,7 @@ void TuyaPacketProcess(void) uint8_t key1_gpio = tuya_buffer[7]; boolean key1_set = false; boolean led1_set = false; - for (byte i = 0; i < MAX_GPIO_PIN; i++) { + for (byte i = 0; i < sizeof(Settings.my_gp); i++) { if (Settings.my_gp.io[i] == GPIO_LED1) led1_set = true; else if (Settings.my_gp.io[i] == GPIO_KEY1) key1_set = true; }
%s " D_GPIO "%d %s