mirror of https://github.com/arendst/Tasmota.git
6.4.1.8 Add template flags
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)
This commit is contained in:
parent
95f39be2ef
commit
a23f01080b
|
@ -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)
|
||||
|
|
|
@ -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 "Сериен изход"
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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]"
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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 "יציאת סריאל"
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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 выход"
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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 вихід"
|
||||
|
|
|
@ -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)"
|
||||
|
|
|
@ -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)"
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -255,6 +255,10 @@ const char HTTP_BTN_CONF[] PROGMEM =
|
|||
const char HTTP_FORM_MODULE[] PROGMEM =
|
||||
"<fieldset><legend><b> " D_MODULE_PARAMETERS " </b></legend><form method='get' action='md'>"
|
||||
"<br/><b>" D_MODULE_TYPE "</b> ({mt)<br/><select id='g99' name='g99'></select><br/>";
|
||||
|
||||
const char HTTP_FORM_MODULE_PULLUP[] PROGMEM =
|
||||
"<br/><input style='width:10%;' id='b1' name='b1' type='checkbox'{r1><b>" D_PULLUP_ENABLE "</b><br/>";
|
||||
|
||||
const char HTTP_LNK_ITEM[] PROGMEM =
|
||||
"<div><a href='#p' onclick='c(this)'>{v}</a> ({w}) <span class='q'>{i} {r}%</span></div>";
|
||||
const char HTTP_LNK_SCAN[] PROGMEM =
|
||||
|
@ -837,6 +841,12 @@ void HandleModuleConfiguration(void)
|
|||
page.replace(F("<body>"), F("<body onload='sl()'>"));
|
||||
page += FPSTR(HTTP_FORM_MODULE);
|
||||
page.replace(F("{mt"), AnyModuleName(MODULE));
|
||||
|
||||
if (my_module_flag.pullup) {
|
||||
page += FPSTR(HTTP_FORM_MODULE_PULLUP);
|
||||
page.replace(F("{r1"), (Settings.flag3.no_pullup) ? F(" checked") : F(""));
|
||||
}
|
||||
|
||||
page += F("<br/><table>");
|
||||
for (byte i = 0; i < sizeof(cmodule); i++) {
|
||||
if (GPIO_USER == ValidGPIO(i, cmodule.io[i])) {
|
||||
|
@ -861,6 +871,11 @@ void ModuleSaveSettings(void)
|
|||
byte new_module = (!strlen(tmp)) ? MODULE : atoi(tmp);
|
||||
Settings.last_module = Settings.module;
|
||||
Settings.module = new_module;
|
||||
if (Settings.last_module == new_module) {
|
||||
if (my_module_flag.pullup) {
|
||||
Settings.flag3.no_pullup = WebServer->hasArg("b1");
|
||||
}
|
||||
}
|
||||
myio cmodule;
|
||||
ModuleGpios(&cmodule);
|
||||
String gpios = "";
|
||||
|
@ -1123,6 +1138,7 @@ void HandleOtherConfiguration(void)
|
|||
page += FPSTR(HTTP_HEAD_STYLE);
|
||||
page += FPSTR(HTTP_FORM_OTHER);
|
||||
page.replace(F("{r1"), (Settings.flag.mqtt_enabled) ? F(" checked") : F(""));
|
||||
|
||||
uint8_t maxfn = (devices_present > MAX_FRIENDLYNAMES) ? MAX_FRIENDLYNAMES : (!devices_present) ? 1 : devices_present;
|
||||
if (SONOFF_IFAN02 == Settings.module) { maxfn = 1; }
|
||||
for (byte i = 0; i < maxfn; i++) {
|
||||
|
|
|
@ -71,7 +71,7 @@ boolean Xsns02(byte function)
|
|||
{
|
||||
boolean result = false;
|
||||
|
||||
if (pin[GPIO_ADC0] < 99) {
|
||||
if (my_module_flag.adc0) {
|
||||
switch (function) {
|
||||
#ifdef USE_RULES
|
||||
case FUNC_EVERY_250_MSECOND:
|
||||
|
|
Loading…
Reference in New Issue