diff --git a/sonoff/settings.h b/sonoff/settings.h
index c1f568ca1..f185004c4 100644
--- a/sonoff/settings.h
+++ b/sonoff/settings.h
@@ -67,7 +67,7 @@ typedef union { // Restricted by MISRA-C Rule 18.4 bu
uint32_t user_esp8285_enable : 1; // bit 1 (v6.1.1.14)
uint32_t time_append_timezone : 1; // bit 2 (v6.2.1.2)
uint32_t gui_hostname_ip : 1; // bit 3 (v6.2.1.20)
- uint32_t tuya_apply_o20 : 1;
+ uint32_t tuya_apply_o20 : 1; // bit 4 (v6.3.0.4)
uint32_t spare05 : 1;
uint32_t spare06 : 1;
uint32_t spare07 : 1;
@@ -320,12 +320,12 @@ struct SYSCFG {
uint16_t mcp230xx_int_timer; // 718
uint8_t rgbwwTable[5]; // 71A
- byte free_71F[109]; // 71F
+ byte free_71F[117]; // 71F
- uint32_t monitors; // 78C
- uint32_t displays; // 790
- uint32_t drivers[4]; // 794
- uint32_t sensors[4]; // 7A4
+ uint32_t drivers[3]; // 794
+ uint32_t monitors; // 7A0
+ uint32_t sensors[3]; // 7A4
+ uint32_t displays; // 7B0
uint32_t energy_kWhtotal_time; // 7B4
unsigned long weight_item; // 7B8 Weight of one item in gram * 10
diff --git a/sonoff/settings.ino b/sonoff/settings.ino
index 88c6838a3..a38e2113e 100644
--- a/sonoff/settings.ino
+++ b/sonoff/settings.ino
@@ -636,7 +636,7 @@ void SettingsDefaultSet2()
Settings.rgbwwTable[j] = 255;
}
- memset(&Settings.monitors, 0xFF, 40); // Enable all possible monitors, displays, drivers and sensors
+ memset(&Settings.drivers, 0xFF, 32); // Enable all possible monitors, displays, drivers and sensors
}
/********************************************************************************************/
@@ -849,7 +849,7 @@ void SettingsDelta()
Settings.timezone_minutes = 0;
}
if (Settings.version < 0x06030004) {
- memset(&Settings.monitors, 0xFF, 40); // Enable all possible monitors, displays, drivers and sensors
+ memset(&Settings.drivers, 0xFF, 32); // Enable all possible monitors, displays, drivers and sensors
}
Settings.version = VERSION;
diff --git a/sonoff/sonoff.h b/sonoff/sonoff.h
index a0ad03c13..4c6abee0d 100644
--- a/sonoff/sonoff.h
+++ b/sonoff/sonoff.h
@@ -52,8 +52,8 @@ typedef unsigned long power_t; // Power (Relay) type
#define MAX_KNX_CB 10 // Max number of KNX Group Addresses to write that can be set
#define MAX_XNRG_DRIVERS 32 // Max number of allowed energy drivers
#define MAX_XDSP_DRIVERS 32 // Max number of allowed display drivers
-#define MAX_XDRV_DRIVERS 100 // Max number of allowed driver drivers
-#define MAX_XSNS_DRIVERS 100 // Max number of allowed sensor drivers
+#define MAX_XDRV_DRIVERS 96 // Max number of allowed driver drivers
+#define MAX_XSNS_DRIVERS 96 // Max number of allowed sensor drivers
#define MAX_RULE_MEMS 5 // Max number of saved vars
#define MAX_RULE_SETS 3 // Max number of rule sets of size 512 characters
#define MAX_RULE_SIZE 512 // Max number of characters in rules
diff --git a/sonoff/xdrv_01_webserver.ino b/sonoff/xdrv_01_webserver.ino
index e7327b769..8352e9820 100644
--- a/sonoff/xdrv_01_webserver.ino
+++ b/sonoff/xdrv_01_webserver.ino
@@ -25,6 +25,8 @@
* Based on source by AlexT (https://github.com/tzapu)
\*********************************************************************************************/
+#define XDRV_01 1
+
#define HTTP_REFRESH_TIME 2345 // milliseconds
#ifdef USE_RF_FLASH
@@ -2009,8 +2011,6 @@ bool WebCommand()
* Interface
\*********************************************************************************************/
-#define XDRV_01
-
boolean Xdrv01(byte function)
{
boolean result = false;
diff --git a/sonoff/xdrv_02_mqtt.ino b/sonoff/xdrv_02_mqtt.ino
index ed24d31ed..40f69d93a 100644
--- a/sonoff/xdrv_02_mqtt.ino
+++ b/sonoff/xdrv_02_mqtt.ino
@@ -17,6 +17,8 @@
along with this program. If not, see .
*/
+#define XDRV_02 2
+
/*********************************************************************************************\
* Select ONE of possible MQTT library types below
\*********************************************************************************************/
@@ -909,8 +911,6 @@ void MqttSaveSettings()
* Interface
\*********************************************************************************************/
-#define XDRV_02
-
boolean Xdrv02(byte function)
{
boolean result = false;
diff --git a/sonoff/xdrv_04_light.ino b/sonoff/xdrv_04_light.ino
index c5ba2acc7..9bd88e2cb 100644
--- a/sonoff/xdrv_04_light.ino
+++ b/sonoff/xdrv_04_light.ino
@@ -51,6 +51,8 @@
*
\*********************************************************************************************/
+#define XDRV_04 4
+
#define WS2812_SCHEMES 7 // Number of additional WS2812 schemes supported by xdrv_ws2812.ino
enum LightCommands {
@@ -1369,8 +1371,6 @@ boolean LightCommand()
* Interface
\*********************************************************************************************/
-#define XDRV_04
-
boolean Xdrv04(byte function)
{
boolean result = false;
diff --git a/sonoff/xdrv_05_irremote.ino b/sonoff/xdrv_05_irremote.ino
index 83cde7419..8ab611ead 100644
--- a/sonoff/xdrv_05_irremote.ino
+++ b/sonoff/xdrv_05_irremote.ino
@@ -22,6 +22,8 @@
* IR Remote send and receive using IRremoteESP8266 library
\*********************************************************************************************/
+#define XDRV_05 5
+
#include
// Based on IRremoteESP8266.h enum decode_type_t
@@ -401,8 +403,6 @@ boolean IrSendCommand()
* Interface
\*********************************************************************************************/
-#define XDRV_05
-
boolean Xdrv05(byte function)
{
boolean result = false;
diff --git a/sonoff/xdrv_06_snfbridge.ino b/sonoff/xdrv_06_snfbridge.ino
index 8e9201b43..3afdf6066 100644
--- a/sonoff/xdrv_06_snfbridge.ino
+++ b/sonoff/xdrv_06_snfbridge.ino
@@ -21,6 +21,8 @@
Sonoff RF Bridge 433
\*********************************************************************************************/
+#define XDRV_06 6
+
#define SFB_TIME_AVOID_DUPLICATE 2000 // Milliseconds
enum SonoffBridgeCommands {
@@ -564,8 +566,6 @@ void SonoffBridgeInit()
* Interface
\*********************************************************************************************/
-#define XDRV_06
-
boolean Xdrv06(byte function)
{
boolean result = false;
diff --git a/sonoff/xdrv_07_domoticz.ino b/sonoff/xdrv_07_domoticz.ino
index 060301323..527053832 100644
--- a/sonoff/xdrv_07_domoticz.ino
+++ b/sonoff/xdrv_07_domoticz.ino
@@ -19,6 +19,8 @@
#ifdef USE_DOMOTICZ
+#define XDRV_07 7
+
const char DOMOTICZ_MESSAGE[] PROGMEM = "{\"idx\":%d,\"nvalue\":%d,\"svalue\":\"%s\",\"Battery\":%d,\"RSSI\":%d}";
enum DomoticzCommands { CMND_IDX, CMND_KEYIDX, CMND_SWITCHIDX, CMND_SENSORIDX, CMND_UPDATETIMER };
@@ -475,8 +477,6 @@ void DomoticzSaveSettings()
* Interface
\*********************************************************************************************/
-#define XDRV_07
-
boolean Xdrv07(byte function)
{
boolean result = false;
diff --git a/sonoff/xdrv_08_serial_bridge.ino b/sonoff/xdrv_08_serial_bridge.ino
index 5d04c8059..f1ac48fe7 100644
--- a/sonoff/xdrv_08_serial_bridge.ino
+++ b/sonoff/xdrv_08_serial_bridge.ino
@@ -21,6 +21,9 @@
/*********************************************************************************************\
* Serial Bridge using Software Serial library (TasmotaSerial)
\*********************************************************************************************/
+
+#define XDRV_08 8
+
#define SERIAL_BRIDGE_BUFFER_SIZE 130
#include
@@ -127,8 +130,6 @@ boolean SerialBridgeCommand()
* Interface
\*********************************************************************************************/
-#define XDRV_08
-
boolean Xdrv08(byte function)
{
boolean result = false;
diff --git a/sonoff/xdrv_09_timers.ino b/sonoff/xdrv_09_timers.ino
index 73c143ae9..5907943f6 100644
--- a/sonoff/xdrv_09_timers.ino
+++ b/sonoff/xdrv_09_timers.ino
@@ -35,6 +35,8 @@
*
\*********************************************************************************************/
+#define XDRV_09 9
+
enum TimerCommands { CMND_TIMER, CMND_TIMERS
#ifdef USE_SUNRISE
, CMND_LATITUDE, CMND_LONGITUDE
@@ -743,8 +745,6 @@ void TimerSaveSettings()
* Interface
\*********************************************************************************************/
-#define XDRV_09
-
boolean Xdrv09(byte function)
{
boolean result = false;
diff --git a/sonoff/xdrv_10_rules.ino b/sonoff/xdrv_10_rules.ino
index 54fcb3f08..4da4937d7 100644
--- a/sonoff/xdrv_10_rules.ino
+++ b/sonoff/xdrv_10_rules.ino
@@ -63,6 +63,8 @@
* RuleTimer2 100
\*********************************************************************************************/
+#define XDRV_10 10
+
#define D_CMND_RULE "Rule"
#define D_CMND_RULETIMER "RuleTimer"
#define D_CMND_EVENT "Event"
@@ -640,8 +642,6 @@ double map_double(double x, double in_min, double in_max, double out_min, double
* Interface
\*********************************************************************************************/
-#define XDRV_10
-
boolean Xdrv10(byte function)
{
boolean result = false;
diff --git a/sonoff/xdrv_11_knx.ino b/sonoff/xdrv_11_knx.ino
index 944f1ba90..86a8a7fca 100644
--- a/sonoff/xdrv_11_knx.ino
+++ b/sonoff/xdrv_11_knx.ino
@@ -48,6 +48,8 @@ byte Settings.knx_CB_param[MAX_KNX_CB] Type of Output (set relay, t
\*********************************************************************************************/
+#define XDRV_11 11
+
#include // KNX Library
address_t KNX_physs_addr; // Physical KNX address of this device
@@ -1278,8 +1280,6 @@ boolean KnxCommand()
* Interface
\*********************************************************************************************/
-#define XDRV_11
-
boolean Xdrv11(byte function)
{
boolean result = false;
diff --git a/sonoff/xdrv_12_home_assistant.ino b/sonoff/xdrv_12_home_assistant.ino
index 3c38cbc46..46a5c0521 100644
--- a/sonoff/xdrv_12_home_assistant.ino
+++ b/sonoff/xdrv_12_home_assistant.ino
@@ -19,6 +19,8 @@
#ifdef USE_HOME_ASSISTANT
+#define XDRV_12 12
+
const char HASS_DISCOVER_RELAY[] PROGMEM =
"{\"name\":\"%s\"," // dualr2 1
"\"command_topic\":\"%s\"," // cmnd/dualr2/POWER2
@@ -255,8 +257,6 @@ boolean HassCommand()
* Interface
\*********************************************************************************************/
-#define XDRV_12
-
boolean Xdrv12(byte function)
{
boolean result = false;
diff --git a/sonoff/xdrv_13_display.ino b/sonoff/xdrv_13_display.ino
index fcb9a33f8..9656c14ec 100644
--- a/sonoff/xdrv_13_display.ino
+++ b/sonoff/xdrv_13_display.ino
@@ -20,6 +20,8 @@
#if defined(USE_I2C) || defined(USE_SPI)
#ifdef USE_DISPLAY
+#define XDRV_13 13
+
#define DISPLAY_MAX_DRIVERS 16 // Max number of display drivers/models supported by xdsp_interface.ino
#define DISPLAY_MAX_COLS 40 // Max number of columns allowed with command DisplayCols
#define DISPLAY_MAX_ROWS 32 // Max number of lines allowed with command DisplayRows
@@ -1060,8 +1062,6 @@ boolean DisplayCommand()
* Interface
\*********************************************************************************************/
-#define XDRV_13
-
boolean Xdrv13(byte function)
{
boolean result = false;
diff --git a/sonoff/xdrv_14_mp3.ino b/sonoff/xdrv_14_mp3.ino
index ae0c69fd0..0a72b68ab 100644
--- a/sonoff/xdrv_14_mp3.ino
+++ b/sonoff/xdrv_14_mp3.ino
@@ -67,6 +67,8 @@
* https://www.dfrobot.com/wiki/index.php/DFPlayer_Mini_SKU:DFR0299
\*********************************************************************************************/
+#define XDRV_14 14
+
#include
TasmotaSerial *MP3Player;
@@ -224,8 +226,6 @@ boolean MP3PlayerCmd(void) {
* Interface
\*********************************************************************************************/
-#define XDRV_14
-
boolean Xdrv14(byte function)
{
boolean result = false;
diff --git a/sonoff/xdrv_16_tuyadimmer.ino b/sonoff/xdrv_16_tuyadimmer.ino
index 06926acba..c8bf04961 100644
--- a/sonoff/xdrv_16_tuyadimmer.ino
+++ b/sonoff/xdrv_16_tuyadimmer.ino
@@ -19,6 +19,8 @@
#ifdef USE_TUYA_DIMMER
+#define XDRV_16 16
+
#ifndef TUYA_DIMMER_ID
#define TUYA_DIMMER_ID 0
#endif
@@ -137,7 +139,7 @@ void LightSerialDuty(uint8_t duty)
if (duty < 25) {
duty = 25; // dimming acts odd below 25(10%) - this mirrors the threshold set on the faceplate itself
}
-
+
TuyaSendValue(Settings.param[P_TUYA_DIMMER_ID], duty);
snprintf_P(log_data, sizeof(log_data), PSTR( "TYA: Send Serial Packet Dim Value=%d (id=%d)"), duty, Settings.param[P_TUYA_DIMMER_ID]);
@@ -177,7 +179,7 @@ void TuyaPacketProcess()
switch(tuya_buffer[3]) {
- case TUYA_CMD_HEARTBEAT:
+ case TUYA_CMD_HEARTBEAT:
AddLog_P(LOG_LEVEL_DEBUG, PSTR("TYA: Heartbeat"));
if(tuya_buffer[6] == 0){
AddLog_P(LOG_LEVEL_DEBUG, PSTR("TYA: Detected MCU restart"));
@@ -386,8 +388,6 @@ void TuyaSetWifiLed(){
* Interface
\*********************************************************************************************/
-#define XDRV_16
-
boolean Xdrv16(byte function)
{
boolean result = false;
diff --git a/sonoff/xdrv_17_rcswitch.ino b/sonoff/xdrv_17_rcswitch.ino
index 137bd82b1..701b8c119 100644
--- a/sonoff/xdrv_17_rcswitch.ino
+++ b/sonoff/xdrv_17_rcswitch.ino
@@ -22,6 +22,8 @@
* RF send and receive using RCSwitch library https://github.com/sui77/rc-switch/
\*********************************************************************************************/
+#define XDRV_17 17
+
#define D_JSON_RF_PROTOCOL "Protocol"
#define D_JSON_RF_BITS "Bits"
#define D_JSON_RF_DATA "Data"
@@ -164,8 +166,6 @@ boolean RfSendCommand()
* Interface
\*********************************************************************************************/
-#define XDRV_17
-
boolean Xdrv17(byte function)
{
boolean result = false;
diff --git a/sonoff/xdrv_99_debug.ino b/sonoff/xdrv_95_debug.ino
similarity index 98%
rename from sonoff/xdrv_99_debug.ino
rename to sonoff/xdrv_95_debug.ino
index abd209b82..18f9ad76f 100644
--- a/sonoff/xdrv_99_debug.ino
+++ b/sonoff/xdrv_95_debug.ino
@@ -1,5 +1,5 @@
/*
- xdrv_99_debug.ino - debug support for Sonoff-Tasmota
+ xdrv_95_debug.ino - debug support for Sonoff-Tasmota
Copyright (C) 2018 Theo Arends
@@ -26,9 +26,14 @@
#endif // DEBUG_THEO
#ifdef USE_DEBUG_DRIVER
+/*********************************************************************************************\
+ * Virtual debugging support
+\*********************************************************************************************/
+
+#define XDRV_95 95
#ifndef CPU_LOAD_CHECK
-#define CPU_LOAD_CHECK 1 // Seconds between each CPU_LOAD log
+#define CPU_LOAD_CHECK 1 // Seconds between each CPU_LOAD log
#endif
/*********************************************************************************************\
@@ -473,9 +478,7 @@ boolean DebugCommand()
* Interface
\*********************************************************************************************/
-#define XDRV_99
-
-boolean Xdrv99(byte function)
+boolean Xdrv95(byte function)
{
boolean result = false;
diff --git a/sonoff/xsns_interface.ino b/sonoff/xsns_interface.ino
index 522ef7665..e858ec43e 100644
--- a/sonoff/xsns_interface.ino
+++ b/sonoff/xsns_interface.ino
@@ -530,12 +530,12 @@ String XsnsGetSensors()
String data = F("[");
for (byte i = 0; i < MAX_XSNS_DRIVERS; i++) {
- if (i && (!(i % 10))) { data += F(","); }
- if (!(i % 10)) { data += F("\""); }
+ if (i && (!(i % 16))) { data += F(","); }
+ if (!(i % 16)) { data += F("\""); }
state[0] = '-';
if (XsnsPresent(i)) { state[0] = bitRead(Settings.sensors[i / 32], i % 32) ? '1' : '0'; }
data += String(state);
- if (i && (!((i +1) % 10))) { data += F("\""); }
+ if (i && (!((i +1) % 16))) { data += F("\""); }
}
data += F("]");