mirror of
https://github.com/arendst/Tasmota.git
synced 2025-07-29 05:36:39 +00:00
Revert "Moved command SetSensorXX"
This reverts commit 830319bc6e19cbeb4d5eeb813bbcf38850dcd125.
This commit is contained in:
parent
830319bc6e
commit
3ef78e8095
@ -4,7 +4,6 @@
|
|||||||
* Change command WebSend Host header field from IP address to hostname (#4331)
|
* Change command WebSend Host header field from IP address to hostname (#4331)
|
||||||
* Add to command WebSend option to send a direct path when command starts with a slash (#4329)
|
* Add to command WebSend option to send a direct path when command starts with a slash (#4329)
|
||||||
* Consolidate LTrim into Trim
|
* Consolidate LTrim into Trim
|
||||||
* Moved command SetSensorXX to debugging
|
|
||||||
*
|
*
|
||||||
* 6.3.0.6 20181110
|
* 6.3.0.6 20181110
|
||||||
* Change GUI Configure Module by using AJAX for data fetch to cut page size (and memory use) by 40%
|
* Change GUI Configure Module by using AJAX for data fetch to cut page size (and memory use) by 40%
|
||||||
|
@ -184,6 +184,7 @@
|
|||||||
#define D_CMND_DRIVER "Driver"
|
#define D_CMND_DRIVER "Driver"
|
||||||
#define D_CMND_SAVEDATA "SaveData"
|
#define D_CMND_SAVEDATA "SaveData"
|
||||||
#define D_CMND_SETOPTION "SetOption"
|
#define D_CMND_SETOPTION "SetOption"
|
||||||
|
#define D_CMND_SETSENSOR "SetSensor"
|
||||||
#define D_CMND_TEMPERATURE_RESOLUTION "TempRes"
|
#define D_CMND_TEMPERATURE_RESOLUTION "TempRes"
|
||||||
#define D_CMND_HUMIDITY_RESOLUTION "HumRes"
|
#define D_CMND_HUMIDITY_RESOLUTION "HumRes"
|
||||||
#define D_CMND_PRESSURE_RESOLUTION "PressRes"
|
#define D_CMND_PRESSURE_RESOLUTION "PressRes"
|
||||||
|
@ -81,7 +81,7 @@ enum TasmotaCommands {
|
|||||||
CMND_MODULE, CMND_MODULES, CMND_GPIO, CMND_GPIOS, CMND_PWM, CMND_PWMFREQUENCY, CMND_PWMRANGE, CMND_COUNTER, CMND_COUNTERTYPE,
|
CMND_MODULE, CMND_MODULES, CMND_GPIO, CMND_GPIOS, CMND_PWM, CMND_PWMFREQUENCY, CMND_PWMRANGE, CMND_COUNTER, CMND_COUNTERTYPE,
|
||||||
CMND_COUNTERDEBOUNCE, CMND_BUTTONDEBOUNCE, CMND_SWITCHDEBOUNCE, CMND_SLEEP, CMND_UPGRADE, CMND_UPLOAD, CMND_OTAURL, CMND_SERIALLOG, CMND_SYSLOG,
|
CMND_COUNTERDEBOUNCE, CMND_BUTTONDEBOUNCE, CMND_SWITCHDEBOUNCE, CMND_SLEEP, CMND_UPGRADE, CMND_UPLOAD, CMND_OTAURL, CMND_SERIALLOG, CMND_SYSLOG,
|
||||||
CMND_LOGHOST, CMND_LOGPORT, CMND_IPADDRESS, CMND_NTPSERVER, CMND_AP, CMND_SSID, CMND_PASSWORD, CMND_HOSTNAME,
|
CMND_LOGHOST, CMND_LOGPORT, CMND_IPADDRESS, CMND_NTPSERVER, CMND_AP, CMND_SSID, CMND_PASSWORD, CMND_HOSTNAME,
|
||||||
CMND_WIFICONFIG, CMND_FRIENDLYNAME, CMND_SWITCHMODE,
|
CMND_WIFICONFIG, CMND_FRIENDLYNAME, CMND_SWITCHMODE, CMND_SETSENSOR,
|
||||||
CMND_TELEPERIOD, CMND_RESTART, CMND_RESET, CMND_TIMEZONE, CMND_TIMESTD, CMND_TIMEDST, CMND_ALTITUDE, CMND_LEDPOWER, CMND_LEDSTATE,
|
CMND_TELEPERIOD, CMND_RESTART, CMND_RESET, CMND_TIMEZONE, CMND_TIMESTD, CMND_TIMEDST, CMND_ALTITUDE, CMND_LEDPOWER, CMND_LEDSTATE,
|
||||||
CMND_I2CSCAN, CMND_SERIALSEND, CMND_BAUDRATE, CMND_SERIALDELIMITER, CMND_DRIVER };
|
CMND_I2CSCAN, CMND_SERIALSEND, CMND_BAUDRATE, CMND_SERIALDELIMITER, CMND_DRIVER };
|
||||||
const char kTasmotaCommands[] PROGMEM =
|
const char kTasmotaCommands[] PROGMEM =
|
||||||
@ -91,7 +91,7 @@ const char kTasmotaCommands[] PROGMEM =
|
|||||||
D_CMND_MODULE "|" D_CMND_MODULES "|" D_CMND_GPIO "|" D_CMND_GPIOS "|" D_CMND_PWM "|" D_CMND_PWMFREQUENCY "|" D_CMND_PWMRANGE "|" D_CMND_COUNTER "|" D_CMND_COUNTERTYPE "|"
|
D_CMND_MODULE "|" D_CMND_MODULES "|" D_CMND_GPIO "|" D_CMND_GPIOS "|" D_CMND_PWM "|" D_CMND_PWMFREQUENCY "|" D_CMND_PWMRANGE "|" D_CMND_COUNTER "|" D_CMND_COUNTERTYPE "|"
|
||||||
D_CMND_COUNTERDEBOUNCE "|" D_CMND_BUTTONDEBOUNCE "|" D_CMND_SWITCHDEBOUNCE "|" D_CMND_SLEEP "|" D_CMND_UPGRADE "|" D_CMND_UPLOAD "|" D_CMND_OTAURL "|" D_CMND_SERIALLOG "|" D_CMND_SYSLOG "|"
|
D_CMND_COUNTERDEBOUNCE "|" D_CMND_BUTTONDEBOUNCE "|" D_CMND_SWITCHDEBOUNCE "|" D_CMND_SLEEP "|" D_CMND_UPGRADE "|" D_CMND_UPLOAD "|" D_CMND_OTAURL "|" D_CMND_SERIALLOG "|" D_CMND_SYSLOG "|"
|
||||||
D_CMND_LOGHOST "|" D_CMND_LOGPORT "|" D_CMND_IPADDRESS "|" D_CMND_NTPSERVER "|" D_CMND_AP "|" D_CMND_SSID "|" D_CMND_PASSWORD "|" D_CMND_HOSTNAME "|"
|
D_CMND_LOGHOST "|" D_CMND_LOGPORT "|" D_CMND_IPADDRESS "|" D_CMND_NTPSERVER "|" D_CMND_AP "|" D_CMND_SSID "|" D_CMND_PASSWORD "|" D_CMND_HOSTNAME "|"
|
||||||
D_CMND_WIFICONFIG "|" D_CMND_FRIENDLYNAME "|" D_CMND_SWITCHMODE "|"
|
D_CMND_WIFICONFIG "|" D_CMND_FRIENDLYNAME "|" D_CMND_SWITCHMODE "|" D_CMND_SETSENSOR "|"
|
||||||
D_CMND_TELEPERIOD "|" D_CMND_RESTART "|" D_CMND_RESET "|" D_CMND_TIMEZONE "|" D_CMND_TIMESTD "|" D_CMND_TIMEDST "|" D_CMND_ALTITUDE "|" D_CMND_LEDPOWER "|" D_CMND_LEDSTATE "|"
|
D_CMND_TELEPERIOD "|" D_CMND_RESTART "|" D_CMND_RESET "|" D_CMND_TIMEZONE "|" D_CMND_TIMESTD "|" D_CMND_TIMEDST "|" D_CMND_ALTITUDE "|" D_CMND_LEDPOWER "|" D_CMND_LEDSTATE "|"
|
||||||
D_CMND_I2CSCAN "|" D_CMND_SERIALSEND "|" D_CMND_BAUDRATE "|" D_CMND_SERIALDELIMITER "|" D_CMND_DRIVER;
|
D_CMND_I2CSCAN "|" D_CMND_SERIALSEND "|" D_CMND_BAUDRATE "|" D_CMND_SERIALDELIMITER "|" D_CMND_DRIVER;
|
||||||
|
|
||||||
@ -777,6 +777,13 @@ void MqttDataHandler(char* topic, byte* data, unsigned int data_len)
|
|||||||
snprintf_P(mqtt_data, sizeof(mqtt_data), S_JSON_COMMAND_INDEX_SVALUE, command, index, (2 == ptype) ? stemp1 : (1 == ptype) ? GetStateText(bitRead(Settings.flag3.data, pindex)) : GetStateText(bitRead(Settings.flag.data, pindex)));
|
snprintf_P(mqtt_data, sizeof(mqtt_data), S_JSON_COMMAND_INDEX_SVALUE, command, index, (2 == ptype) ? stemp1 : (1 == ptype) ? GetStateText(bitRead(Settings.flag3.data, pindex)) : GetStateText(bitRead(Settings.flag.data, pindex)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if ((CMND_SETSENSOR == command_code) && (index < MAX_XSNS_DRIVERS)) {
|
||||||
|
if ((payload >= 0) && XsnsPresent(index)) {
|
||||||
|
bitWrite(Settings.sensors[index / 32], index % 32, payload &1);
|
||||||
|
if (1 == payload) { restart_flag = 2; } // To safely re-enable a sensor currently most sensor need to follow complete restart init cycle
|
||||||
|
}
|
||||||
|
snprintf_P(mqtt_data, sizeof(mqtt_data), S_JSON_COMMAND_XVALUE, command, XsnsGetSensors().c_str());
|
||||||
|
}
|
||||||
else if (CMND_TEMPERATURE_RESOLUTION == command_code) {
|
else if (CMND_TEMPERATURE_RESOLUTION == command_code) {
|
||||||
if ((payload >= 0) && (payload <= 3)) {
|
if ((payload >= 0) && (payload <= 3)) {
|
||||||
Settings.flag2.temperature_resolution = payload;
|
Settings.flag2.temperature_resolution = payload;
|
||||||
@ -1217,9 +1224,9 @@ void MqttDataHandler(char* topic, byte* data, unsigned int data_len)
|
|||||||
if (5 == tpos) { Settings.tflag[ts].hour = (value < 0) ? 0 : (value > 23) ? 23 : value; }
|
if (5 == tpos) { Settings.tflag[ts].hour = (value < 0) ? 0 : (value > 23) ? 23 : value; }
|
||||||
if (6 == tpos) { Settings.toffset[ts] = (value < -900) ? -900 : (value > 900) ? 900 : value; }
|
if (6 == tpos) { Settings.toffset[ts] = (value < -900) ? -900 : (value > 900) ? 900 : value; }
|
||||||
}
|
}
|
||||||
p = Trim(p); // Skip spaces
|
p = Trim(p); // Skip spaces
|
||||||
if (tpos && (*p == ',')) { p++; } // Skip separator
|
if (tpos && (*p == ',')) { p++; } // Skip separator
|
||||||
p = Trim(p); // Skip spaces
|
p = Trim(p); // Skip spaces
|
||||||
q = p; // Reset any value entered flag
|
q = p; // Reset any value entered flag
|
||||||
value = strtol(p, &p, 10);
|
value = strtol(p, &p, 10);
|
||||||
tpos++; // Next parameter
|
tpos++; // Next parameter
|
||||||
|
@ -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
|
Copyright (C) 2018 Theo Arends
|
||||||
|
|
||||||
@ -27,12 +27,10 @@
|
|||||||
|
|
||||||
#ifdef USE_DEBUG_DRIVER
|
#ifdef USE_DEBUG_DRIVER
|
||||||
/*********************************************************************************************\
|
/*********************************************************************************************\
|
||||||
* Virtual debugging support - Part1
|
* Virtual debugging support
|
||||||
*
|
|
||||||
* Needs file zzzz_debug.ino due to DEFINE processing
|
|
||||||
\*********************************************************************************************/
|
\*********************************************************************************************/
|
||||||
|
|
||||||
#define XDRV_99 99
|
#define XDRV_95 95
|
||||||
|
|
||||||
#ifndef CPU_LOAD_CHECK
|
#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
|
||||||
@ -52,14 +50,9 @@
|
|||||||
#define D_CMND_FREEMEM "FreeMem"
|
#define D_CMND_FREEMEM "FreeMem"
|
||||||
#define D_CMND_RTCDUMP "RtcDump"
|
#define D_CMND_RTCDUMP "RtcDump"
|
||||||
#define D_CMND_HELP "Help"
|
#define D_CMND_HELP "Help"
|
||||||
#define D_CMND_SETSENSOR "SetSensor"
|
|
||||||
|
|
||||||
enum DebugCommands {
|
enum DebugCommands { CMND_CFGDUMP, CMND_CFGPEEK, CMND_CFGPOKE, CMND_CFGSHOW, CMND_CFGXOR, CMND_CPUCHECK, CMND_EXCEPTION, CMND_FREEMEM, CMND_RTCDUMP, CMND_HELP };
|
||||||
CMND_CFGDUMP, CMND_CFGPEEK, CMND_CFGPOKE, CMND_CFGSHOW, CMND_CFGXOR,
|
const char kDebugCommands[] PROGMEM = D_CMND_CFGDUMP "|" D_CMND_CFGPEEK "|" D_CMND_CFGPOKE "|" D_CMND_CFGSHOW "|" D_CMND_CFGXOR "|" D_CMND_CPUCHECK "|" D_CMND_EXCEPTION "|" D_CMND_FREEMEM "|" D_CMND_RTCDUMP "|" D_CMND_HELP;
|
||||||
CMND_CPUCHECK, CMND_EXCEPTION, CMND_FREEMEM, CMND_RTCDUMP, CMND_SETSENSOR, CMND_HELP };
|
|
||||||
const char kDebugCommands[] PROGMEM =
|
|
||||||
D_CMND_CFGDUMP "|" D_CMND_CFGPEEK "|" D_CMND_CFGPOKE "|" D_CMND_CFGSHOW "|" D_CMND_CFGXOR "|"
|
|
||||||
D_CMND_CPUCHECK "|" D_CMND_EXCEPTION "|" D_CMND_FREEMEM "|" D_CMND_RTCDUMP "|" D_CMND_SETSENSOR "|" D_CMND_HELP;
|
|
||||||
|
|
||||||
uint32_t CPU_loops = 0;
|
uint32_t CPU_loops = 0;
|
||||||
uint32_t CPU_last_millis = 0;
|
uint32_t CPU_last_millis = 0;
|
||||||
@ -476,13 +469,6 @@ boolean DebugCommand()
|
|||||||
}
|
}
|
||||||
snprintf_P(mqtt_data, sizeof(mqtt_data), S_JSON_COMMAND_NVALUE, command, CPU_show_freemem);
|
snprintf_P(mqtt_data, sizeof(mqtt_data), S_JSON_COMMAND_NVALUE, command, CPU_show_freemem);
|
||||||
}
|
}
|
||||||
else if ((CMND_SETSENSOR == command_code) && (XdrvMailbox.index < MAX_XSNS_DRIVERS)) {
|
|
||||||
if ((XdrvMailbox.payload >= 0) && XsnsPresent(XdrvMailbox.index)) {
|
|
||||||
bitWrite(Settings.sensors[XdrvMailbox.index / 32], XdrvMailbox.index % 32, XdrvMailbox.payload &1);
|
|
||||||
if (1 == XdrvMailbox.payload) { restart_flag = 2; } // To safely re-enable a sensor currently most sensor need to follow complete restart init cycle
|
|
||||||
}
|
|
||||||
snprintf_P(mqtt_data, sizeof(mqtt_data), S_JSON_COMMAND_XVALUE, command, XsnsGetSensors().c_str());
|
|
||||||
}
|
|
||||||
else serviced = false; // Unknown command
|
else serviced = false; // Unknown command
|
||||||
|
|
||||||
return serviced;
|
return serviced;
|
||||||
@ -492,7 +478,7 @@ boolean DebugCommand()
|
|||||||
* Interface
|
* Interface
|
||||||
\*********************************************************************************************/
|
\*********************************************************************************************/
|
||||||
|
|
||||||
boolean Xdrv99(byte function)
|
boolean Xdrv95(byte function)
|
||||||
{
|
{
|
||||||
boolean result = false;
|
boolean result = false;
|
||||||
|
|
@ -265,20 +265,309 @@ boolean (* const xsns_func_ptr[])(byte) = { // Sensor Function Pointers for sim
|
|||||||
const uint8_t xsns_present = sizeof(xsns_func_ptr) / sizeof(xsns_func_ptr[0]); // Number of External Sensors found
|
const uint8_t xsns_present = sizeof(xsns_func_ptr) / sizeof(xsns_func_ptr[0]); // Number of External Sensors found
|
||||||
uint8_t xsns_index = 0;
|
uint8_t xsns_index = 0;
|
||||||
|
|
||||||
|
#ifdef XFUNC_PTR_IN_ROM
|
||||||
|
const uint8_t kXsnsList[] PROGMEM = {
|
||||||
|
#else
|
||||||
|
const uint8_t kXsnsList[] = {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef XSNS_01
|
||||||
|
XSNS_01,
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef XSNS_02
|
||||||
|
XSNS_02,
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef XSNS_03
|
||||||
|
XSNS_03,
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef XSNS_04
|
||||||
|
XSNS_04,
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef XSNS_05
|
||||||
|
XSNS_05,
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef XSNS_06
|
||||||
|
XSNS_06,
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef XSNS_07
|
||||||
|
XSNS_07,
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef XSNS_08
|
||||||
|
XSNS_08,
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef XSNS_09
|
||||||
|
XSNS_09,
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef XSNS_10
|
||||||
|
XSNS_10,
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef XSNS_11
|
||||||
|
XSNS_11,
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef XSNS_12
|
||||||
|
XSNS_12,
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef XSNS_13
|
||||||
|
XSNS_13,
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef XSNS_14
|
||||||
|
XSNS_14,
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef XSNS_15
|
||||||
|
XSNS_15,
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef XSNS_16
|
||||||
|
XSNS_16,
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef XSNS_17
|
||||||
|
XSNS_17,
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef XSNS_18
|
||||||
|
XSNS_18,
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef XSNS_19
|
||||||
|
XSNS_19,
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef XSNS_20
|
||||||
|
XSNS_20,
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef XSNS_21
|
||||||
|
XSNS_21,
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef XSNS_22
|
||||||
|
XSNS_22,
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef XSNS_23
|
||||||
|
XSNS_23,
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef XSNS_24
|
||||||
|
XSNS_24,
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef XSNS_25
|
||||||
|
XSNS_25,
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef XSNS_26
|
||||||
|
XSNS_26,
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef XSNS_27
|
||||||
|
XSNS_27,
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef XSNS_28
|
||||||
|
XSNS_28,
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef XSNS_29
|
||||||
|
XSNS_29,
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef XSNS_30
|
||||||
|
XSNS_30,
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef XSNS_31
|
||||||
|
XSNS_31,
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef XSNS_32
|
||||||
|
XSNS_32,
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef XSNS_33
|
||||||
|
XSNS_33,
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef XSNS_34
|
||||||
|
XSNS_34,
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef XSNS_35
|
||||||
|
XSNS_35,
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef XSNS_36
|
||||||
|
XSNS_36,
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef XSNS_37
|
||||||
|
XSNS_37,
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef XSNS_38
|
||||||
|
XSNS_38,
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef XSNS_39
|
||||||
|
XSNS_39,
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef XSNS_40
|
||||||
|
XSNS_40,
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef XSNS_41
|
||||||
|
XSNS_41,
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef XSNS_42
|
||||||
|
XSNS_42,
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef XSNS_43
|
||||||
|
XSNS_43,
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef XSNS_44
|
||||||
|
XSNS_44,
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef XSNS_45
|
||||||
|
XSNS_45,
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef XSNS_46
|
||||||
|
XSNS_46,
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef XSNS_47
|
||||||
|
XSNS_47,
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef XSNS_48
|
||||||
|
XSNS_48,
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef XSNS_49
|
||||||
|
XSNS_49,
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef XSNS_50
|
||||||
|
XSNS_50,
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// Optional user defined sensors in range 91 - 99
|
||||||
|
|
||||||
|
#ifdef XSNS_91
|
||||||
|
XSNS_91,
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef XSNS_92
|
||||||
|
XSNS_92,
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef XSNS_93
|
||||||
|
XSNS_93,
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef XSNS_94
|
||||||
|
XSNS_94,
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef XSNS_95
|
||||||
|
XSNS_95,
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef XSNS_96
|
||||||
|
XSNS_96,
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef XSNS_97
|
||||||
|
XSNS_97,
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef XSNS_98
|
||||||
|
XSNS_98,
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef XSNS_99
|
||||||
|
XSNS_99
|
||||||
|
#endif
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
/*********************************************************************************************\
|
/*********************************************************************************************\
|
||||||
* Function call to all xsns
|
* Function call to all xsns
|
||||||
\*********************************************************************************************/
|
\*********************************************************************************************/
|
||||||
|
|
||||||
|
boolean XsnsEnabled(byte sns_index)
|
||||||
|
{
|
||||||
|
if (sns_index < sizeof(kXsnsList)) {
|
||||||
|
#ifdef XFUNC_PTR_IN_ROM
|
||||||
|
uint8_t index = pgm_read_byte(kXsnsList + sns_index);
|
||||||
|
#else
|
||||||
|
uint8_t index = kXsnsList[sns_index];
|
||||||
|
#endif
|
||||||
|
return bitRead(Settings.sensors[index / 32], index % 32);
|
||||||
|
}
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
boolean XsnsPresent(byte sns_index)
|
||||||
|
{
|
||||||
|
uint8_t index = 0;
|
||||||
|
for (byte i = 0; i < sizeof(kXsnsList); i++) {
|
||||||
|
#ifdef XFUNC_PTR_IN_ROM
|
||||||
|
index = pgm_read_byte(kXsnsList + i);
|
||||||
|
#else
|
||||||
|
index = kXsnsList[i];
|
||||||
|
#endif
|
||||||
|
if (index == sns_index) { return true; }
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
String XsnsGetSensors()
|
||||||
|
{
|
||||||
|
char state[2] = { 0 };
|
||||||
|
|
||||||
|
String data = F("[");
|
||||||
|
for (byte i = 0; i < MAX_XSNS_DRIVERS; i++) {
|
||||||
|
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) % 16))) { data += F("\""); }
|
||||||
|
}
|
||||||
|
data += F("]");
|
||||||
|
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
boolean XsnsNextCall(byte Function)
|
boolean XsnsNextCall(byte Function)
|
||||||
{
|
{
|
||||||
xsns_index++;
|
xsns_index++;
|
||||||
if (xsns_index == xsns_present) { xsns_index = 0; }
|
if (xsns_index == xsns_present) { xsns_index = 0; }
|
||||||
#ifdef USE_DEBUG_DRIVER
|
|
||||||
while (!XsnsEnabled(xsns_index) && !xsns_index) { // Perform at least first sensor (counter)
|
while (!XsnsEnabled(xsns_index) && !xsns_index) { // Perform at least first sensor (counter)
|
||||||
xsns_index++;
|
xsns_index++;
|
||||||
if (xsns_index == xsns_present) { xsns_index = 0; }
|
if (xsns_index == xsns_present) { xsns_index = 0; }
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
AppDelay();
|
AppDelay();
|
||||||
return xsns_func_ptr[xsns_index](Function);
|
return xsns_func_ptr[xsns_index](Function);
|
||||||
}
|
}
|
||||||
@ -292,9 +581,7 @@ boolean XsnsCall(byte Function)
|
|||||||
#endif // PROFILE_XSNS_EVERY_SECOND
|
#endif // PROFILE_XSNS_EVERY_SECOND
|
||||||
|
|
||||||
for (byte x = 0; x < xsns_present; x++) {
|
for (byte x = 0; x < xsns_present; x++) {
|
||||||
#ifdef USE_DEBUG_DRIVER
|
|
||||||
if (XsnsEnabled(x)) {
|
if (XsnsEnabled(x)) {
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef PROFILE_XSNS_SENSOR_EVERY_SECOND
|
#ifdef PROFILE_XSNS_SENSOR_EVERY_SECOND
|
||||||
uint32_t profile_start_millis = millis();
|
uint32_t profile_start_millis = millis();
|
||||||
@ -313,9 +600,7 @@ boolean XsnsCall(byte Function)
|
|||||||
#endif // PROFILE_XSNS_SENSOR_EVERY_SECOND
|
#endif // PROFILE_XSNS_SENSOR_EVERY_SECOND
|
||||||
|
|
||||||
if (result) break;
|
if (result) break;
|
||||||
#ifdef USE_DEBUG_DRIVER
|
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef PROFILE_XSNS_EVERY_SECOND
|
#ifdef PROFILE_XSNS_EVERY_SECOND
|
||||||
|
@ -1,309 +0,0 @@
|
|||||||
/*
|
|
||||||
zzzz_debug.ino - debug support for Sonoff-Tasmota
|
|
||||||
|
|
||||||
Copyright (C) 2018 Theo Arends
|
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU General Public License as published by
|
|
||||||
the Free Software Foundation, either version 3 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifdef USE_DEBUG_DRIVER
|
|
||||||
/*********************************************************************************************\
|
|
||||||
* Virtual debugging support - Part 2
|
|
||||||
*
|
|
||||||
* Needs to be the last alphabetical file due to DEFINE compile order
|
|
||||||
\*********************************************************************************************/
|
|
||||||
|
|
||||||
/*********************************************************************************************\
|
|
||||||
* Xsns available list
|
|
||||||
\*********************************************************************************************/
|
|
||||||
|
|
||||||
#ifdef XFUNC_PTR_IN_ROM
|
|
||||||
const uint8_t kXsnsList[] PROGMEM = {
|
|
||||||
#else
|
|
||||||
const uint8_t kXsnsList[] = {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef XSNS_01
|
|
||||||
XSNS_01,
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef XSNS_02
|
|
||||||
XSNS_02,
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef XSNS_03
|
|
||||||
XSNS_03,
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef XSNS_04
|
|
||||||
XSNS_04,
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef XSNS_05
|
|
||||||
XSNS_05,
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef XSNS_06
|
|
||||||
XSNS_06,
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef XSNS_07
|
|
||||||
XSNS_07,
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef XSNS_08
|
|
||||||
XSNS_08,
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef XSNS_09
|
|
||||||
XSNS_09,
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef XSNS_10
|
|
||||||
XSNS_10,
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef XSNS_11
|
|
||||||
XSNS_11,
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef XSNS_12
|
|
||||||
XSNS_12,
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef XSNS_13
|
|
||||||
XSNS_13,
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef XSNS_14
|
|
||||||
XSNS_14,
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef XSNS_15
|
|
||||||
XSNS_15,
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef XSNS_16
|
|
||||||
XSNS_16,
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef XSNS_17
|
|
||||||
XSNS_17,
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef XSNS_18
|
|
||||||
XSNS_18,
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef XSNS_19
|
|
||||||
XSNS_19,
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef XSNS_20
|
|
||||||
XSNS_20,
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef XSNS_21
|
|
||||||
XSNS_21,
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef XSNS_22
|
|
||||||
XSNS_22,
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef XSNS_23
|
|
||||||
XSNS_23,
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef XSNS_24
|
|
||||||
XSNS_24,
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef XSNS_25
|
|
||||||
XSNS_25,
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef XSNS_26
|
|
||||||
XSNS_26,
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef XSNS_27
|
|
||||||
XSNS_27,
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef XSNS_28
|
|
||||||
XSNS_28,
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef XSNS_29
|
|
||||||
XSNS_29,
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef XSNS_30
|
|
||||||
XSNS_30,
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef XSNS_31
|
|
||||||
XSNS_31,
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef XSNS_32
|
|
||||||
XSNS_32,
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef XSNS_33
|
|
||||||
XSNS_33,
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef XSNS_34
|
|
||||||
XSNS_34,
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef XSNS_35
|
|
||||||
XSNS_35,
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef XSNS_36
|
|
||||||
XSNS_36,
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef XSNS_37
|
|
||||||
XSNS_37,
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef XSNS_38
|
|
||||||
XSNS_38,
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef XSNS_39
|
|
||||||
XSNS_39,
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef XSNS_40
|
|
||||||
XSNS_40,
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef XSNS_41
|
|
||||||
XSNS_41,
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef XSNS_42
|
|
||||||
XSNS_42,
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef XSNS_43
|
|
||||||
XSNS_43,
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef XSNS_44
|
|
||||||
XSNS_44,
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef XSNS_45
|
|
||||||
XSNS_45,
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef XSNS_46
|
|
||||||
XSNS_46,
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef XSNS_47
|
|
||||||
XSNS_47,
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef XSNS_48
|
|
||||||
XSNS_48,
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef XSNS_49
|
|
||||||
XSNS_49,
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef XSNS_50
|
|
||||||
XSNS_50,
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Optional user defined sensors in range 91 - 99
|
|
||||||
|
|
||||||
#ifdef XSNS_91
|
|
||||||
XSNS_91,
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef XSNS_92
|
|
||||||
XSNS_92,
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef XSNS_93
|
|
||||||
XSNS_93,
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef XSNS_94
|
|
||||||
XSNS_94,
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef XSNS_95
|
|
||||||
XSNS_95
|
|
||||||
#endif
|
|
||||||
};
|
|
||||||
|
|
||||||
/*********************************************************************************************\
|
|
||||||
* Xsns sensor control
|
|
||||||
\*********************************************************************************************/
|
|
||||||
|
|
||||||
boolean XsnsEnabled(byte sns_index)
|
|
||||||
{
|
|
||||||
if (sns_index < sizeof(kXsnsList)) {
|
|
||||||
#ifdef XFUNC_PTR_IN_ROM
|
|
||||||
uint8_t index = pgm_read_byte(kXsnsList + sns_index);
|
|
||||||
#else
|
|
||||||
uint8_t index = kXsnsList[sns_index];
|
|
||||||
#endif
|
|
||||||
return bitRead(Settings.sensors[index / 32], index % 32);
|
|
||||||
}
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
boolean XsnsPresent(byte sns_index)
|
|
||||||
{
|
|
||||||
uint8_t index = 0;
|
|
||||||
for (byte i = 0; i < sizeof(kXsnsList); i++) {
|
|
||||||
#ifdef XFUNC_PTR_IN_ROM
|
|
||||||
index = pgm_read_byte(kXsnsList + i);
|
|
||||||
#else
|
|
||||||
index = kXsnsList[i];
|
|
||||||
#endif
|
|
||||||
if (index == sns_index) { return true; }
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
String XsnsGetSensors()
|
|
||||||
{
|
|
||||||
char state[2] = { 0 };
|
|
||||||
|
|
||||||
String data = F("[");
|
|
||||||
for (byte i = 0; i < MAX_XSNS_DRIVERS; i++) {
|
|
||||||
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) % 16))) { data += F("\""); }
|
|
||||||
}
|
|
||||||
data += F("]");
|
|
||||||
|
|
||||||
return data;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif // USE_DEBUG_DRIVER
|
|
Loading…
x
Reference in New Issue
Block a user