diff --git a/sonoff/_changelog.ino b/sonoff/_changelog.ino index 3d802f705..65d731706 100644 --- a/sonoff/_changelog.ino +++ b/sonoff/_changelog.ino @@ -1,4 +1,8 @@ -/* 6.4.1.7 20190106 +/* 6.4.1.8 20190107 + * Change sonoff_template.h layout regarding optional module flags like ADC0 + * Add command SetOption62 1 to force no Button/Switch pullup on dedicated modules. Currently only supported on Shelly2 (#4841) + * + * 6.4.1.7 20190106 * Fix HLW8012, HJL01 and BL0937 based energy sensors low Power (below 10W) measurement regression from 6.4.1.6 * Add relay status functionality to LED2 when configured leaving LED1 for (wifi/mqtt) status indication * Add no pull-up control to Shelly 2 module (default is pull-up, change GPIO2 to Switch3n for no pull-up) (#4841) diff --git a/sonoff/language/bg-BG.h b/sonoff/language/bg-BG.h index d6ba96985..d7d812385 100644 --- a/sonoff/language/bg-BG.h +++ b/sonoff/language/bg-BG.h @@ -253,6 +253,7 @@ #define D_MODULE_PARAMETERS "Параметри на модула" #define D_MODULE_TYPE "Тип на модула" +#define D_PULLUP_ENABLE "No Button/Switch pull-up" #define D_GPIO "GPIO" #define D_SERIAL_IN "Сериен вход" #define D_SERIAL_OUT "Сериен изход" diff --git a/sonoff/language/cs-CZ.h b/sonoff/language/cs-CZ.h index b30f94520..e10ec2c4f 100644 --- a/sonoff/language/cs-CZ.h +++ b/sonoff/language/cs-CZ.h @@ -253,6 +253,7 @@ #define D_MODULE_PARAMETERS "Nastavení modulu" #define D_MODULE_TYPE "Typ modulu" +#define D_PULLUP_ENABLE "No Button/Switch pull-up" #define D_GPIO "GPIO" #define D_SERIAL_IN "Serial In" #define D_SERIAL_OUT "Serial Out" diff --git a/sonoff/language/de-DE.h b/sonoff/language/de-DE.h index d3650b2d3..6fead9321 100644 --- a/sonoff/language/de-DE.h +++ b/sonoff/language/de-DE.h @@ -253,6 +253,7 @@ #define D_MODULE_PARAMETERS "Geräte-Einstellungen" #define D_MODULE_TYPE "Gerätetyp" +#define D_PULLUP_ENABLE "No Button/Switch pull-up" #define D_GPIO "GPIO" #define D_SERIAL_IN "serieller Eingang [serial in]" #define D_SERIAL_OUT "serieller Ausgang [serial out]" diff --git a/sonoff/language/el-GR.h b/sonoff/language/el-GR.h index 268513060..8a4402538 100644 --- a/sonoff/language/el-GR.h +++ b/sonoff/language/el-GR.h @@ -253,6 +253,7 @@ #define D_MODULE_PARAMETERS "Παράμετροι μονάδας" #define D_MODULE_TYPE "Τύπος μονάδας" +#define D_PULLUP_ENABLE "No Button/Switch pull-up" #define D_GPIO "GPIO" #define D_SERIAL_IN "Serial In" #define D_SERIAL_OUT "Serial Out" diff --git a/sonoff/language/en-GB.h b/sonoff/language/en-GB.h index f250e2d24..4ac9186e5 100644 --- a/sonoff/language/en-GB.h +++ b/sonoff/language/en-GB.h @@ -253,6 +253,7 @@ #define D_MODULE_PARAMETERS "Module parameters" #define D_MODULE_TYPE "Module type" +#define D_PULLUP_ENABLE "No Button/Switch pull-up" #define D_GPIO "GPIO" #define D_SERIAL_IN "Serial In" #define D_SERIAL_OUT "Serial Out" diff --git a/sonoff/language/es-AR.h b/sonoff/language/es-AR.h index 00bbc10a8..105b69895 100644 --- a/sonoff/language/es-AR.h +++ b/sonoff/language/es-AR.h @@ -253,6 +253,7 @@ #define D_MODULE_PARAMETERS "Parámetros del módulo" #define D_MODULE_TYPE "Tipo de módulo" +#define D_PULLUP_ENABLE "No Button/Switch pull-up" #define D_GPIO "GPIO" #define D_SERIAL_IN "Serial In" #define D_SERIAL_OUT "Serial Out" diff --git a/sonoff/language/fr-FR.h b/sonoff/language/fr-FR.h index 1bea80a9a..aca69fac6 100644 --- a/sonoff/language/fr-FR.h +++ b/sonoff/language/fr-FR.h @@ -253,6 +253,7 @@ #define D_MODULE_PARAMETERS "Paramètres module" #define D_MODULE_TYPE "Type de module" +#define D_PULLUP_ENABLE "No Button/Switch pull-up" #define D_GPIO "GPIO" #define D_SERIAL_IN "Entrée série" #define D_SERIAL_OUT "Sortie série" diff --git a/sonoff/language/he-HE.h b/sonoff/language/he-HE.h index eb2e42152..d4b41f0b5 100644 --- a/sonoff/language/he-HE.h +++ b/sonoff/language/he-HE.h @@ -253,6 +253,7 @@ #define D_MODULE_PARAMETERS "מודול פרמטרים" #define D_MODULE_TYPE "סוג מודול" +#define D_PULLUP_ENABLE "No Button/Switch pull-up" #define D_GPIO " רגל " #define D_SERIAL_IN "כניסת סריאל" #define D_SERIAL_OUT "יציאת סריאל" diff --git a/sonoff/language/hu-HU.h b/sonoff/language/hu-HU.h index d6c880603..e3668ce1d 100644 --- a/sonoff/language/hu-HU.h +++ b/sonoff/language/hu-HU.h @@ -253,6 +253,7 @@ #define D_MODULE_PARAMETERS "Modul paraméterek" #define D_MODULE_TYPE "Modul típus" +#define D_PULLUP_ENABLE "No Button/Switch pull-up" #define D_GPIO "GPIO" #define D_SERIAL_IN "Serial In" #define D_SERIAL_OUT "Serial Out" diff --git a/sonoff/language/it-IT.h b/sonoff/language/it-IT.h index 58130173f..5ebef743d 100644 --- a/sonoff/language/it-IT.h +++ b/sonoff/language/it-IT.h @@ -253,6 +253,7 @@ #define D_MODULE_PARAMETERS "Parametri del modulo" #define D_MODULE_TYPE "Tipo modulo" +#define D_PULLUP_ENABLE "No Button/Switch pull-up" #define D_GPIO "GPIO" #define D_SERIAL_IN "Serial In" #define D_SERIAL_OUT "Serial Out" diff --git a/sonoff/language/nl-NL.h b/sonoff/language/nl-NL.h index 62b40fa9c..1235ab26d 100644 --- a/sonoff/language/nl-NL.h +++ b/sonoff/language/nl-NL.h @@ -253,6 +253,7 @@ #define D_MODULE_PARAMETERS "Module parameters" #define D_MODULE_TYPE "Module soort" +#define D_PULLUP_ENABLE "Geen schakelaar pull-up" #define D_GPIO "GPIO" #define D_SERIAL_IN "Serieel In" #define D_SERIAL_OUT "Serieel Uit" diff --git a/sonoff/language/pl-PL.h b/sonoff/language/pl-PL.h index 2fd04d93a..6327f87d0 100644 --- a/sonoff/language/pl-PL.h +++ b/sonoff/language/pl-PL.h @@ -253,6 +253,7 @@ #define D_MODULE_PARAMETERS "Parametery modułu" #define D_MODULE_TYPE "Typ modułu" +#define D_PULLUP_ENABLE "No Button/Switch pull-up" #define D_GPIO "GPIO" #define D_SERIAL_IN "Serial In" #define D_SERIAL_OUT "Serial Out" diff --git a/sonoff/language/pt-BR.h b/sonoff/language/pt-BR.h index 9daa847d3..8f1364771 100644 --- a/sonoff/language/pt-BR.h +++ b/sonoff/language/pt-BR.h @@ -253,6 +253,7 @@ #define D_MODULE_PARAMETERS "Parâmetros do módulo" #define D_MODULE_TYPE "Tipo de módulo" +#define D_PULLUP_ENABLE "No Button/Switch pull-up" #define D_GPIO "GPIO" #define D_SERIAL_IN "Entrada serial" #define D_SERIAL_OUT "Saída serial" diff --git a/sonoff/language/pt-PT.h b/sonoff/language/pt-PT.h index 73d148c7c..f863a2148 100644 --- a/sonoff/language/pt-PT.h +++ b/sonoff/language/pt-PT.h @@ -253,6 +253,7 @@ #define D_MODULE_PARAMETERS "Parametros do Módulo" #define D_MODULE_TYPE "Tipo de Módulo" +#define D_PULLUP_ENABLE "No Button/Switch pull-up" #define D_GPIO "GPIO" #define D_SERIAL_IN "Serial Entrada" #define D_SERIAL_OUT "Serial Saída" diff --git a/sonoff/language/ru-RU.h b/sonoff/language/ru-RU.h index fa698eddd..20f9a2d9f 100644 --- a/sonoff/language/ru-RU.h +++ b/sonoff/language/ru-RU.h @@ -253,6 +253,7 @@ #define D_MODULE_PARAMETERS "Параметры модуля" #define D_MODULE_TYPE "Тип модуля" +#define D_PULLUP_ENABLE "No Button/Switch pull-up" #define D_GPIO "GPIO" #define D_SERIAL_IN "Serial вход" #define D_SERIAL_OUT "Serial выход" diff --git a/sonoff/language/sk-SK.h b/sonoff/language/sk-SK.h index 492fc7d5a..0edd9bea0 100644 --- a/sonoff/language/sk-SK.h +++ b/sonoff/language/sk-SK.h @@ -253,6 +253,7 @@ #define D_MODULE_PARAMETERS "Nastavenia modulu" #define D_MODULE_TYPE "Typ modulu" +#define D_PULLUP_ENABLE "No Button/Switch pull-up" #define D_GPIO "GPIO" #define D_SERIAL_IN "Serial In" #define D_SERIAL_OUT "Serial Out" diff --git a/sonoff/language/sv-SE.h b/sonoff/language/sv-SE.h index 6f5f82b0e..c36440ac7 100644 --- a/sonoff/language/sv-SE.h +++ b/sonoff/language/sv-SE.h @@ -253,6 +253,7 @@ #define D_MODULE_PARAMETERS "Modulparameterar" #define D_MODULE_TYPE "Modultyp" +#define D_PULLUP_ENABLE "No Button/Switch pull-up" #define D_GPIO "GPIO" #define D_SERIAL_IN "Seriell in" #define D_SERIAL_OUT "Seriell ut" diff --git a/sonoff/language/tr-TR.h b/sonoff/language/tr-TR.h index 9d66169a9..3ef7dd3f5 100755 --- a/sonoff/language/tr-TR.h +++ b/sonoff/language/tr-TR.h @@ -253,6 +253,7 @@ #define D_MODULE_PARAMETERS "Modül parametreleri" #define D_MODULE_TYPE "Modul türü" +#define D_PULLUP_ENABLE "No Button/Switch pull-up" #define D_GPIO "GPIO" #define D_SERIAL_IN "Serial In" #define D_SERIAL_OUT "Serial Out" diff --git a/sonoff/language/uk-UK.h b/sonoff/language/uk-UK.h index b6e870e8f..59d9ab8b4 100644 --- a/sonoff/language/uk-UK.h +++ b/sonoff/language/uk-UK.h @@ -253,6 +253,7 @@ #define D_MODULE_PARAMETERS "Параметри модулю" #define D_MODULE_TYPE "Тип модулю" +#define D_PULLUP_ENABLE "No Button/Switch pull-up" #define D_GPIO "GPIO" #define D_SERIAL_IN "Serial вхід" #define D_SERIAL_OUT "Serial вихід" diff --git a/sonoff/language/zh-CN.h b/sonoff/language/zh-CN.h index c02722897..c64c1b5c3 100644 --- a/sonoff/language/zh-CN.h +++ b/sonoff/language/zh-CN.h @@ -253,6 +253,7 @@ #define D_MODULE_PARAMETERS "模块设置" #define D_MODULE_TYPE "模块类型" +#define D_PULLUP_ENABLE "No Button/Switch pull-up" #define D_GPIO "GPIO" #define D_SERIAL_IN "串口输入(RX)" #define D_SERIAL_OUT "串口输出(TX)" diff --git a/sonoff/language/zh-TW.h b/sonoff/language/zh-TW.h index d2524da4f..3560ddf34 100644 --- a/sonoff/language/zh-TW.h +++ b/sonoff/language/zh-TW.h @@ -253,6 +253,7 @@ #define D_MODULE_PARAMETERS "模塊設置" #define D_MODULE_TYPE "模塊類型" +#define D_PULLUP_ENABLE "No Button/Switch pull-up" #define D_GPIO "GPIO" #define D_SERIAL_IN "串口輸入(RX)" #define D_SERIAL_OUT "串口輸出(TX)" diff --git a/sonoff/settings.h b/sonoff/settings.h index 66ab6645c..3c88725e0 100644 --- a/sonoff/settings.h +++ b/sonoff/settings.h @@ -75,7 +75,7 @@ typedef union { // Restricted by MISRA-C Rule 18.4 bu uint32_t hass_tele_on_power : 1; // bit 9 (v6.3.0.13) uint32_t sleep_normal : 1; // bit 10 (v6.3.0.15) - SetOption60 - Enable normal sleep instead of dynamic sleep uint32_t button_switch_force_local : 1;// bit 11 - uint32_t spare12 : 1; + uint32_t no_pullup : 1; // bit 12 (v6.4.1.7) - SetOption62 - Force no pull-up (0 = default pull-up, 1 = no pull-up) uint32_t spare13 : 1; uint32_t spare14 : 1; uint32_t spare15 : 1; @@ -271,6 +271,9 @@ struct SYSCFG { uint8_t ws_color[4][3]; // 475 uint8_t ws_width[3]; // 481 myio my_gp; // 484 + + byte free_495[1]; // 495 + uint16_t light_pixels; // 496 uint8_t light_color[5]; // 498 uint8_t light_correction; // 49D diff --git a/sonoff/sonoff.ino b/sonoff/sonoff.ino index c2ede5d03..6076fd796 100755 --- a/sonoff/sonoff.ino +++ b/sonoff/sonoff.ino @@ -168,7 +168,8 @@ byte syslog_level; // Current copy of Settings.syslog_l boolean latest_uptime_flag = true; // Signal latest uptime boolean pwm_present = false; // Any PWM channel configured with SetOption15 0 boolean mdns_begun = false; // mDNS active -myio my_module; // Active copy of Module GPIOs (18 x 8 bits) +myio my_module; // Active copy of Module GPIOs (17 x 8 bits) +gpio_flag my_module_flag; // Active copy of Module GPIO flags StateBitfield global_state; // Global states (currently Wifi and Mqtt) (8 bits) char my_version[33]; // Composed version string char my_image[33]; // Code image and/or commit @@ -181,7 +182,6 @@ char log_data[LOGSZ]; // Logging char web_log[WEB_LOG_SIZE] = {'\0'}; // Web log buffer String backlog[MAX_BACKLOG]; // Command backlog - /********************************************************************************************/ char* Format(char* output, const char* input, int size) @@ -771,6 +771,9 @@ void MqttDataHandler(char* topic, byte* data, unsigned int data_len) if (10 == pindex) { // SetOption60 enable or disable traditional sleep WiFiSetSleepMode(); // Update WiFi sleep mode accordingly } + if (12 == pindex) { // SetOption62 change input pull-up + restart_flag = 2; + } } } else { // SetOption32 .. 49 @@ -2169,8 +2172,6 @@ void GpioInit(void) myio def_gp; ModuleGpios(&def_gp); - - 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]; @@ -2179,6 +2180,7 @@ void GpioInit(void) my_module.io[i] = def_gp.io[i]; } } + my_module_flag = ModuleFlag(); for (byte i = 0; i < GPIO_MAX; i++) { pin[i] = 99; diff --git a/sonoff/sonoff_template.h b/sonoff/sonoff_template.h index b5e47d745..17131fdbb 100644 --- a/sonoff/sonoff_template.h +++ b/sonoff/sonoff_template.h @@ -160,7 +160,6 @@ enum ProgramSelectablePins { GPIO_NRG_CF1, // HLW8012/HLJ-01 CF1 voltage / current GPIO_HLW_CF, // HLW8012 CF power GPIO_HJL_CF, // HJL-01/BL0937 CF power - GPIO_ADC0, // ADC GPIO_DI, // my92x1 PWM input GPIO_DCKI, // my92x1 CLK input GPIO_ARIRFRCV, // AliLux RF Receive input @@ -278,7 +277,7 @@ enum SupportedModules { /********************************************************************************************/ -#define MAX_GPIO_PIN 18 // Number of supported GPIO +#define MAX_GPIO_PIN 17 // 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"; @@ -291,9 +290,33 @@ typedef struct MYCFGIO { uint8_t io[MAX_GPIO_PIN - MIN_FLASH_PINS]; } mycfgio; +#define GPIO_FLAG_ADC0 1 // Allow ADC0 when define USE_ADC_VCC is disabled +#define GPIO_FLAG_PULLUP 2 // Allow input pull-up control using SetOption62 +#define GPIO_FLAG_SPARE02 4 +#define GPIO_FLAG_SPARE03 8 +#define GPIO_FLAG_SPARE04 16 +#define GPIO_FLAG_SPARE05 32 +#define GPIO_FLAG_SPARE06 64 +#define GPIO_FLAG_SPARE07 128 + +typedef union { + uint8_t data; + struct { + uint8_t adc0 : 1; // Allow ADC0 when define USE_ADC_VCC is disabled + uint8_t pullup : 1; // Allow input pull-up control using SetOption62 + uint8_t spare02 : 1; + uint8_t spare03 : 1; + uint8_t spare04 : 1; + uint8_t spare05 : 1; + uint8_t spare06 : 1; + uint8_t spare07 : 1; + }; +} gpio_flag; + typedef struct MYTMPLT { char name[15]; mycfgio gp; + gpio_flag flag; } mytmplt; const uint8_t kGpioNiceList[] PROGMEM = { @@ -597,7 +620,7 @@ const mytmplt kModules[MAXMODULE] PROGMEM = { GPIO_LED1_INV, // GPIO13 Green Led (0 = On, 1 = Off) GPIO_USER, // GPIO14 Optional sensor 0, 0, - GPIO_ADC0 // ADC0 Analog input + GPIO_FLAG_ADC0 // ADC0 Analog input }, { "Sonoff TH", // Sonoff TH10/16 (ESP8266) GPIO_KEY1, // GPIO00 Button @@ -795,7 +818,7 @@ const mytmplt kModules[MAXMODULE] PROGMEM = { GPIO_USER, // GPIO14 Optional sensor GPIO_USER, // GPIO15 Optional sensor GPIO_LED1, // GPIO16 Green/Blue Led (1 = On, 0 = Off) - GPIO_ADC0 // ADC0 A0 Analog input + GPIO_FLAG_ADC0 // ADC0 A0 Analog input }, { "EXS Relay(s)", // ES-Store Latching relay(s) (ESP8266) // https://ex-store.de/ESP8266-WiFi-Relay-V31 @@ -856,7 +879,8 @@ const mytmplt kModules[MAXMODULE] PROGMEM = { GPIO_USER, // GPIO14 D5 GPIO_USER, // GPIO15 D8 GPIO_USER, // GPIO16 D0 Wemos Wake - GPIO_ADC0 // ADC0 A0 Analog input + GPIO_FLAG_ADC0 // ADC0 A0 Analog input +// + GPIO_FLAG_PULLUP // Allow input pull-up control }, { "Sonoff Dev", // Sonoff Dev (ESP8266) GPIO_KEY1, // GPIO00 E-FW Button @@ -876,7 +900,7 @@ const mytmplt kModules[MAXMODULE] PROGMEM = { GPIO_USER, // GPIO14 Optional sensor 0, // GPIO15 0, // GPIO16 - GPIO_ADC0 // ADC0 A0 Analog input + GPIO_FLAG_ADC0 // ADC0 A0 Analog input }, { "H801", // Lixada H801 Wifi (ESP8266) GPIO_USER, // GPIO00 E-FW Button @@ -1083,7 +1107,7 @@ const mytmplt kModules[MAXMODULE] PROGMEM = { GPIO_USER, // GPIO14 Optional sensor 0, GPIO_LED1, // GPIO16 Led (1 = On, 0 = Off) - GPIO_ADC0 // ADC0 A0 Analog input + GPIO_FLAG_ADC0 // ADC0 A0 Analog input }, { "Witty Cloud", // Witty Cloud Dev Board (ESP8266) // https://www.aliexpress.com/item/ESP8266-serial-WIFI-Witty-cloud-Development-Board-ESP-12F-module-MINI-nodemcu/32643464555.html @@ -1104,7 +1128,7 @@ const mytmplt kModules[MAXMODULE] PROGMEM = { GPIO_USER, // GPIO14 D5 optional sensor GPIO_PWM1, // GPIO15 D8 RGB LED Red GPIO_USER, // GPIO16 D0 optional sensor - GPIO_ADC0 // ADC0 A0 Light sensor / Requires USE_ADC_VCC in user_config.h to be disabled + GPIO_FLAG_ADC0 // ADC0 A0 Light sensor / Requires USE_ADC_VCC in user_config.h to be disabled }, { "Yunshan Relay", // Yunshan Wifi Relay (ESP8266) // https://www.ebay.com/p/Esp8266-220v-10a-Network-Relay-WiFi-Module/1369583381 @@ -1162,7 +1186,7 @@ const mytmplt kModules[MAXMODULE] PROGMEM = { GPIO_USER, // GPIO14 Optional sensor / I2C SCL pad GPIO_LED1, // GPIO15 Led (1 = On, 0 = Off) 0, - GPIO_ADC0 // ADC0 A0 Analog input + GPIO_FLAG_ADC0 // ADC0 A0 Analog input }, { "KMC 70011", // KMC 70011 // https://www.amazon.com/KMC-Timing-Monitoring-Network-125V-240V/dp/B06XRX2GTQ @@ -1367,7 +1391,7 @@ const mytmplt kModules[MAXMODULE] PROGMEM = { { "Shelly 2", // Shelly2 (ESP8266 - 2MB) - https://shelly.cloud/shelly2/ 0, GPIO_TXD, // GPIO01 MCP39F501 Serial input - GPIO_USER, // GPIO02 Decide if we use (no) pull-up + 0, GPIO_RXD, // GPIO03 MCP39F501 Serial output GPIO_REL1, // GPIO04 GPIO_REL2, // GPIO05 @@ -1378,10 +1402,11 @@ const mytmplt kModules[MAXMODULE] PROGMEM = { 0, // GPIO10 (SD_DATA3 Flash QIO or ESP8285) // GPIO11 (SD_CMD Flash) GPIO_SWT1, // GPIO12 - 0, // GPIO13 + 0, GPIO_SWT2, // GPIO14 0, // GPIO15 MCP39F501 Reset - 0, 0 + 0, + GPIO_FLAG_PULLUP // Allow input pull-up control }, { "Xiaomi Philips", // Xiaomi Philips bulb (ESP8266) 0, 0, 0, 0, 0, 0, @@ -1449,7 +1474,7 @@ const mytmplt kModules[MAXMODULE] PROGMEM = { GPIO_KEY1, // GPIO14 Button 0, GPIO_USER, // GPIO16 - GPIO_ADC0 // ADC0 A0 Analog input + GPIO_FLAG_ADC0 // ADC0 A0 Analog input }, { "Teckin", // https://www.amazon.de/gp/product/B07D5V139R 0, diff --git a/sonoff/sonoff_version.h b/sonoff/sonoff_version.h index 56193708d..f371936aa 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 0x06040107 +#define VERSION 0x06040108 #define D_PROGRAMNAME "Sonoff-Tasmota" #define D_AUTHOR "Theo Arends" diff --git a/sonoff/support.ino b/sonoff/support.ino index 43f36565e..55be05df7 100644 --- a/sonoff/support.ino +++ b/sonoff/support.ino @@ -529,6 +529,14 @@ void ModuleGpios(myio *gp) // AddLogSerial(LOG_LEVEL_DEBUG, (uint8_t *)gp, sizeof(myio)); } +gpio_flag ModuleFlag() +{ + gpio_flag flag; + + memcpy_P(&flag, &kModules[Settings.module].flag, sizeof(gpio_flag)); + return flag; +} + void SetGlobalValues(float temperature, float humidity) { global_update = uptime; diff --git a/sonoff/support_button.ino b/sonoff/support_button.ino index aebbf30be..880f354d1 100644 --- a/sonoff/support_button.ino +++ b/sonoff/support_button.ino @@ -44,6 +44,12 @@ void ButtonPullupFlag(uint8 button_bit) void ButtonInit(void) { + if (my_module_flag.pullup) { + if (Settings.flag3.no_pullup) { + key_no_pullup = 0xff; + } + } + buttons_found = 0; for (byte i = 0; i < MAX_KEYS; i++) { if (pin[GPIO_KEY1 +i] < 99) { diff --git a/sonoff/support_switch.ino b/sonoff/support_switch.ino index 60d48d0e4..7a085347e 100644 --- a/sonoff/support_switch.ino +++ b/sonoff/support_switch.ino @@ -110,8 +110,10 @@ void SwitchProbe(void) void SwitchInit(void) { - if (SHELLY2 == Settings.module) { - if (switch_no_pullup > 0) { switch_no_pullup = 0xffff; } // If any switch is no pull-up make them all no pull-up + if (my_module_flag.pullup) { + if (Settings.flag3.no_pullup) { + switch_no_pullup = 0xffff; + } } switches_found = 0; diff --git a/sonoff/xdrv_01_webserver.ino b/sonoff/xdrv_01_webserver.ino index d4d950b77..6072f20fd 100644 --- a/sonoff/xdrv_01_webserver.ino +++ b/sonoff/xdrv_01_webserver.ino @@ -255,6 +255,10 @@ const char HTTP_BTN_CONF[] PROGMEM = const char HTTP_FORM_MODULE[] PROGMEM = "