mirror of https://github.com/arendst/Tasmota.git
Add support for MCP230xx
Add support for MCP230xx for general purpose input expansion and command Sensor29 (#3188)
This commit is contained in:
parent
9af188ac74
commit
f10b92a995
|
@ -1,4 +1,5 @@
|
|||
/* 6.1.1b
|
||||
* Add support for MCP230xx for general purpose input expansion and command Sensor29 (#3188)
|
||||
* Fix command Scale buffer overflow (#3236)
|
||||
* Fix rules once regression from v6.1.0 (#3198, #3226)
|
||||
* Add default Wifi Configuration tool as define WIFI_CONFIG_NO_SSID in user_config.h if no SSID is configured (#3224)
|
||||
|
|
|
@ -227,6 +227,7 @@
|
|||
#define D_CONFIRM_RESTART "Подтвърдете рестартирането"
|
||||
|
||||
#define D_CONFIGURE_MODULE "Конфигурация на модула"
|
||||
#define D_CONFIGURE_MCP230XX "Конфигурация на MCP230xx"
|
||||
#define D_CONFIGURE_WIFI "Конфигурация на WiFi"
|
||||
#define D_CONFIGURE_MQTT "Конфигурация на MQTT"
|
||||
#define D_CONFIGURE_DOMOTICZ "Конфигурация на Domoticz"
|
||||
|
|
|
@ -227,6 +227,7 @@
|
|||
#define D_CONFIRM_RESTART "Potvrzení restartu"
|
||||
|
||||
#define D_CONFIGURE_MODULE "Nastavení modulu"
|
||||
#define D_CONFIGURE_MCP230XX "Nastavení MCP230xx"
|
||||
#define D_CONFIGURE_WIFI "Nastavení WiFi"
|
||||
#define D_CONFIGURE_MQTT "Nastavení MQTT"
|
||||
#define D_CONFIGURE_DOMOTICZ "Nastavení Domoticz"
|
||||
|
|
|
@ -227,6 +227,7 @@
|
|||
#define D_CONFIRM_RESTART "Wirklich neustarten?"
|
||||
|
||||
#define D_CONFIGURE_MODULE "Gerät konfigurieren"
|
||||
#define D_CONFIGURE_MCP230XX "MCP230xx konfigurieren"
|
||||
#define D_CONFIGURE_WIFI "WLAN konfigurieren"
|
||||
#define D_CONFIGURE_MQTT "MQTT konfigurieren"
|
||||
#define D_CONFIGURE_DOMOTICZ "Domoticz konfigurieren"
|
||||
|
|
|
@ -227,6 +227,7 @@
|
|||
#define D_CONFIRM_RESTART "Επιβεβαίωση Επανεκκίνησης"
|
||||
|
||||
#define D_CONFIGURE_MODULE "Ρύθμιση Module"
|
||||
#define D_CONFIGURE_MCP230XX "Ρύθμιση MCP230xx"
|
||||
#define D_CONFIGURE_WIFI "Ρύθμιση WiFi"
|
||||
#define D_CONFIGURE_MQTT "Ρύθμιση MQTT"
|
||||
#define D_CONFIGURE_DOMOTICZ "Ρύθμιση Domoticz"
|
||||
|
|
|
@ -166,7 +166,6 @@
|
|||
#define D_VOLTAGE "Voltage"
|
||||
#define D_WARMLIGHT "Warm"
|
||||
#define D_WEB_SERVER "Web Server"
|
||||
#define D_CONFIGURE_MCP230XX "Configure MCP230xx"
|
||||
|
||||
// sonoff.ino
|
||||
#define D_WARNING_MINIMAL_VERSION "WARNING This version does not support persistent settings"
|
||||
|
@ -228,6 +227,7 @@
|
|||
#define D_CONFIRM_RESTART "Confirm Restart"
|
||||
|
||||
#define D_CONFIGURE_MODULE "Configure Module"
|
||||
#define D_CONFIGURE_MCP230XX "Configure MCP230xx"
|
||||
#define D_CONFIGURE_WIFI "Configure WiFi"
|
||||
#define D_CONFIGURE_MQTT "Configure MQTT"
|
||||
#define D_CONFIGURE_DOMOTICZ "Configure Domoticz"
|
||||
|
|
|
@ -227,6 +227,7 @@
|
|||
#define D_CONFIRM_RESTART "Confirmar Reinicio"
|
||||
|
||||
#define D_CONFIGURE_MODULE "Configuración del Módulo"
|
||||
#define D_CONFIGURE_MCP230XX "Configuración MCP230xx"
|
||||
#define D_CONFIGURE_WIFI "Configuración WiFi"
|
||||
#define D_CONFIGURE_MQTT "Configuración MQTT"
|
||||
#define D_CONFIGURE_DOMOTICZ "Configuración Domoticz"
|
||||
|
|
|
@ -227,6 +227,7 @@
|
|||
#define D_CONFIRM_RESTART "Confirmer redémarrage"
|
||||
|
||||
#define D_CONFIGURE_MODULE "Configuration du Module"
|
||||
#define D_CONFIGURE_MCP230XX "Configuration MCP230xx"
|
||||
#define D_CONFIGURE_WIFI "Configuration WiFi"
|
||||
#define D_CONFIGURE_MQTT "Configuration MQTT"
|
||||
#define D_CONFIGURE_DOMOTICZ "Configuration Domoticz"
|
||||
|
|
|
@ -227,6 +227,7 @@
|
|||
#define D_CONFIRM_RESTART "Újraindítás megerősítése"
|
||||
|
||||
#define D_CONFIGURE_MODULE "Eszköz konfiguráció"
|
||||
#define D_CONFIGURE_MCP230XX "MCP230xx konfiguráció"
|
||||
#define D_CONFIGURE_WIFI "WiFi konfiguráció"
|
||||
#define D_CONFIGURE_MQTT "MQTT konfiguráció"
|
||||
#define D_CONFIGURE_DOMOTICZ "Domoticz konfiguráció"
|
||||
|
|
|
@ -227,6 +227,7 @@
|
|||
#define D_CONFIRM_RESTART "Conferma Riavvio"
|
||||
|
||||
#define D_CONFIGURE_MODULE "Configurazione Modulo"
|
||||
#define D_CONFIGURE_MCP230XX "Configurazione MCP230xx"
|
||||
#define D_CONFIGURE_WIFI "Configurazione WiFi"
|
||||
#define D_CONFIGURE_MQTT "Configurazione MQTT"
|
||||
#define D_CONFIGURE_DOMOTICZ "Configurazione Domoticz"
|
||||
|
|
|
@ -227,6 +227,7 @@
|
|||
#define D_CONFIRM_RESTART "Bevestig herstart"
|
||||
|
||||
#define D_CONFIGURE_MODULE "Configureer Module"
|
||||
#define D_CONFIGURE_MCP230XX "Configureer MCP230xx"
|
||||
#define D_CONFIGURE_WIFI "Configureer WiFi"
|
||||
#define D_CONFIGURE_MQTT "Configureer MQTT"
|
||||
#define D_CONFIGURE_DOMOTICZ "Configureer Domoticz"
|
||||
|
|
|
@ -227,6 +227,7 @@
|
|||
#define D_CONFIRM_RESTART "Potwierdź restart"
|
||||
|
||||
#define D_CONFIGURE_MODULE "Konfiguruj moduł"
|
||||
#define D_CONFIGURE_MCP230XX "Konfiguruj MCP230xx"
|
||||
#define D_CONFIGURE_WIFI "Konfiguruj WiFi"
|
||||
#define D_CONFIGURE_MQTT "Konfiguruj MQTT"
|
||||
#define D_CONFIGURE_DOMOTICZ "Konfiguruj Domoticz"
|
||||
|
|
|
@ -227,6 +227,7 @@
|
|||
#define D_CONFIRM_RESTART "Confirmar o reinicio"
|
||||
|
||||
#define D_CONFIGURE_MODULE "Configurar Módulo"
|
||||
#define D_CONFIGURE_MCP230XX "Configurar MCP230xx"
|
||||
#define D_CONFIGURE_WIFI "Configurar WiFi"
|
||||
#define D_CONFIGURE_MQTT "Configurar MQTT"
|
||||
#define D_CONFIGURE_DOMOTICZ "Configurar Domoticz"
|
||||
|
|
|
@ -227,6 +227,7 @@
|
|||
#define D_CONFIRM_RESTART "Confirmar o reinicio"
|
||||
|
||||
#define D_CONFIGURE_MODULE "Configurar Módulo"
|
||||
#define D_CONFIGURE_MCP230XX "Configurar MCP230xx"
|
||||
#define D_CONFIGURE_WIFI "Configurar WiFi"
|
||||
#define D_CONFIGURE_MQTT "Configurar MQTT"
|
||||
#define D_CONFIGURE_DOMOTICZ "Configurar Domoticz"
|
||||
|
|
|
@ -227,6 +227,7 @@
|
|||
#define D_CONFIRM_RESTART "Подтвердить перезагрузку"
|
||||
|
||||
#define D_CONFIGURE_MODULE "Конфигурация Модуля"
|
||||
#define D_CONFIGURE_MCP230XX "Конфигурация MCP230xx"
|
||||
#define D_CONFIGURE_WIFI "Конфигурация WiFi"
|
||||
#define D_CONFIGURE_MQTT "Конфигурация MQTT"
|
||||
#define D_CONFIGURE_DOMOTICZ "Конфигурация Domoticz"
|
||||
|
|
|
@ -227,6 +227,7 @@
|
|||
#define D_CONFIRM_RESTART "Підтвердити перезавантаження"
|
||||
|
||||
#define D_CONFIGURE_MODULE "Конфігурація модуля"
|
||||
#define D_CONFIGURE_MCP230XX "Конфігурація MCP230xx"
|
||||
#define D_CONFIGURE_WIFI "Конфігурація WiFi"
|
||||
#define D_CONFIGURE_MQTT "Конфігурація MQTT"
|
||||
#define D_CONFIGURE_DOMOTICZ "Конфігурація Domoticz"
|
||||
|
|
|
@ -227,6 +227,7 @@
|
|||
#define D_CONFIRM_RESTART "确认重启"
|
||||
|
||||
#define D_CONFIGURE_MODULE "模块设置"
|
||||
#define D_CONFIGURE_MCP230XX "MCP230xx设置"
|
||||
#define D_CONFIGURE_WIFI "WiFi设置"
|
||||
#define D_CONFIGURE_MQTT "MQTT设置"
|
||||
#define D_CONFIGURE_DOMOTICZ "Domoticz设置"
|
||||
|
|
|
@ -227,6 +227,7 @@
|
|||
#define D_CONFIRM_RESTART "確認重啟"
|
||||
|
||||
#define D_CONFIGURE_MODULE "模塊設置"
|
||||
#define D_CONFIGURE_MCP230XX "MCP230xx設置"
|
||||
#define D_CONFIGURE_WIFI "WiFi設置"
|
||||
#define D_CONFIGURE_MQTT "MQTT設置"
|
||||
#define D_CONFIGURE_DOMOTICZ "Domoticz設置"
|
||||
|
|
|
@ -287,12 +287,9 @@
|
|||
// #define USE_MGS // Add I2C code for Xadow and Grove Mutichannel Gas sensor using library Multichannel_Gas_Sensor (+10k code)
|
||||
#define MGS_SENSOR_ADDR 0x04 // Default Mutichannel Gas sensor i2c address
|
||||
// #define USE_APDS9960 // Add I2C code for APDS9960 Proximity Sensor. Disables SHT and VEML6070 (+4k7 code)
|
||||
|
||||
// If only USE_MCP230xx then device can be configured using sensor29 command
|
||||
// #define USE_MCP230xx // Add I2C code for MCP23008/MCP23017 for GP INPUT ONLY (+2260 bytes)
|
||||
// #define USE_MCP230xx_displaymain // Display pin status on Tasmota main page (+188 bytes)
|
||||
// #define USE_MCP230xx_webconfig // Enable web config button and form to Tasmota web interface (+2444)
|
||||
|
||||
// #define USE_MCP230xx // Add I2C code for MCP23008/MCP23017 for GP INPUT ONLY providing command Sensor29 for configuration (+2k2 code)
|
||||
// #define USE_MCP230xx_displaymain // Display pin status on Tasmota main page (+0k2 code)
|
||||
// #define USE_MCP230xx_webconfig // Enable web config button and form to Tasmota web interface (+2k1 code)
|
||||
#endif // USE_I2C
|
||||
|
||||
// -- SPI sensors ---------------------------------
|
||||
|
|
|
@ -190,6 +190,10 @@ const char HTTP_BTN_RSTRT[] PROGMEM =
|
|||
"<br/><form action='rb' method='get' onsubmit='return confirm(\"" D_CONFIRM_RESTART "\");'><button class='button bred'>" D_RESTART "</button></form>";
|
||||
const char HTTP_BTN_MENU_MODULE[] PROGMEM =
|
||||
"<br/><form action='md' method='get'><button>" D_CONFIGURE_MODULE "</button></form>";
|
||||
#if defined(USE_I2C) && defined(USE_MCP230xx) && defined(USE_MCP230xx_webconfig)
|
||||
const char HTTP_BTN_MCP230XX[] PROGMEM =
|
||||
"<br/><form action='mc' method='get'><button>" D_CONFIGURE_MCP230XX "</button></form>";
|
||||
#endif // USE_I2C and USE_MCP230xx and USE_MCP230xx_webconfig
|
||||
#if defined(USE_TIMERS) && defined(USE_TIMERS_WEB)
|
||||
const char HTTP_BTN_MENU_TIMER[] PROGMEM =
|
||||
"<br/><form action='tm' method='get'><button>" D_CONFIGURE_TIMER "</button></form>";
|
||||
|
@ -202,14 +206,6 @@ const char HTTP_BTN_MENU_MQTT[] PROGMEM =
|
|||
"<br/><form action='dm' method='get'><button>" D_CONFIGURE_DOMOTICZ "</button></form>"
|
||||
#endif // USE_DOMOTICZ
|
||||
"";
|
||||
#ifdef USE_I2C
|
||||
#ifdef USE_MCP230xx
|
||||
#ifdef USE_MCP230xx_webconfig
|
||||
const char HTTP_BTN_MCP230XX[] PROGMEM =
|
||||
"<br/><form action='mcp230xx' method='get'><button>" D_CONFIGURE_MCP230XX "</button></form>";
|
||||
#endif // USE_MCP230xx_webconfig
|
||||
#endif // USE_MCP230xx
|
||||
#endif // USE_I2C
|
||||
const char HTTP_BTN_MENU4[] PROGMEM =
|
||||
#ifdef USE_KNX
|
||||
"<br/><form action='kn' method='get'><button>" D_CONFIGURE_KNX "</button></form>"
|
||||
|
@ -384,16 +380,12 @@ void StartWebserver(int type, IPAddress ipweb)
|
|||
WebServer->on("/u2", HTTP_OPTIONS, HandlePreflightRequest);
|
||||
WebServer->on("/cm", HandleHttpCommand);
|
||||
WebServer->on("/rb", HandleRestart);
|
||||
#ifdef USE_I2C
|
||||
#ifdef USE_MCP230xx
|
||||
#ifdef USE_MCP230xx_webconfig
|
||||
WebServer->on("/mcp230xx", handleMCP230xx);
|
||||
#endif // USE_MCP230xx_webconfig
|
||||
#endif // USE_MCP230xx
|
||||
#endif // USE_I2C
|
||||
#ifndef BE_MINIMAL
|
||||
WebServer->on("/cn", HandleConfiguration);
|
||||
WebServer->on("/md", HandleModuleConfiguration);
|
||||
#if defined(USE_I2C) && defined(USE_MCP230xx) && defined(USE_MCP230xx_webconfig)
|
||||
WebServer->on("/mc", HandleMCP230xxConfiguration);
|
||||
#endif // USE_I2C and USE_MCP230xx and USE_MCP230xx_webconfig
|
||||
#if defined(USE_TIMERS) && defined(USE_TIMERS_WEB)
|
||||
WebServer->on("/tm", HandleTimerConfiguration);
|
||||
#endif // USE_TIMERS and USE_TIMERS_WEB
|
||||
|
@ -701,6 +693,11 @@ void HandleConfiguration()
|
|||
page.replace(F("{v}"), FPSTR(S_CONFIGURATION));
|
||||
page += FPSTR(HTTP_HEAD_STYLE);
|
||||
page += FPSTR(HTTP_BTN_MENU_MODULE);
|
||||
#if defined(USE_I2C) && defined(USE_MCP230xx) && defined(USE_MCP230xx_webconfig)
|
||||
if (MCP230xx_Type()) { // Configuration button will only show if MCP23008/MCP23017 was detected on I2C
|
||||
page += FPSTR(HTTP_BTN_MCP230XX);
|
||||
}
|
||||
#endif // USE_I2C and USE_MCP230xx and USE_MCP230xx_webconfig
|
||||
#if defined(USE_TIMERS) && defined(USE_TIMERS_WEB)
|
||||
#ifdef USE_RULES
|
||||
page += FPSTR(HTTP_BTN_MENU_TIMER);
|
||||
|
@ -710,15 +707,6 @@ void HandleConfiguration()
|
|||
#endif // USE_TIMERS and USE_TIMERS_WEB
|
||||
page += FPSTR(HTTP_BTN_MENU_WIFI);
|
||||
if (Settings.flag.mqtt_enabled) { page += FPSTR(HTTP_BTN_MENU_MQTT); }
|
||||
#ifdef USE_I2C
|
||||
#ifdef USE_MCP230xx
|
||||
#ifdef USE_MCP230xx_webconfig
|
||||
if (MCP230xx_Type()) { // Configuration button will only show if MCP23008/MCP23017 was detected on I2C
|
||||
page += FPSTR(HTTP_BTN_MCP230XX);
|
||||
}
|
||||
#endif // USE_MCP230xx_webconfig
|
||||
#endif // USE_MCP230xx
|
||||
#endif // USE_I2C
|
||||
page += FPSTR(HTTP_BTN_MENU4);
|
||||
page += FPSTR(HTTP_BTN_MAIN);
|
||||
ShowPage(page);
|
||||
|
@ -1148,15 +1136,11 @@ void HandleSaveSettings()
|
|||
}
|
||||
AddLog(LOG_LEVEL_INFO);
|
||||
break;
|
||||
#ifdef USE_I2C
|
||||
#ifdef USE_MCP230xx
|
||||
#ifdef USE_MCP230xx_webconfig
|
||||
case 8: // MCP230xx_SaveSettings
|
||||
#if defined(USE_I2C) && defined(USE_MCP230xx) && defined(USE_MCP230xx_webconfig)
|
||||
case 8:
|
||||
MCP230xx_SaveSettings();
|
||||
break;
|
||||
#endif // USE_MCP230xx_webconfig
|
||||
#endif // USE_MCP230xx
|
||||
#endif // USE_I2C
|
||||
#endif // USE_I2C and USE_MCP230xx and USE_MCP230xx_webconfig
|
||||
case 6:
|
||||
WebGetArg("g99", tmp, sizeof(tmp));
|
||||
byte new_module = (!strlen(tmp)) ? MODULE : atoi(tmp);
|
||||
|
|
|
@ -85,7 +85,7 @@ const char HTTP_FORM_I2C_MCP230XX[] PROGMEM =
|
|||
"<td nowrap><input type=checkbox name=epu{b1 value=1{b2></input></td>"
|
||||
"</tr>";
|
||||
|
||||
void handleMCP230xx()
|
||||
void HandleMCP230xxConfiguration()
|
||||
{
|
||||
if (HttpUser()) {
|
||||
return;
|
||||
|
|
Loading…
Reference in New Issue