Fix DS18x20 temperature updates (#

5.12.0k
 * Change Timer parameter name from Power to Action
 * Fix
update temperature on DS18x20 drivers (#2328)
This commit is contained in:
Theo Arends 2018-04-12 14:01:43 +02:00
parent 208f64fd8f
commit 2049730877
24 changed files with 86 additions and 56 deletions

View File

@ -1,6 +1,8 @@
/* 5.12.0k
* Prepare for simple rules by enlarging Settings area to now 2048 bytes
* Change Timer parameter name from Power to Action
* Fix freeing more code space when emulation is disabled (#1592)
* Fix update temperature on DS18x20 drivers (#2328)
* Fix compile error when not defined USE_TIMERS (#2400)
*
* 5.12.0j

View File

@ -361,7 +361,7 @@
#define D_JSON_TIMER_DAYS "Days"
#define D_JSON_TIMER_REPEAT "Repeat"
#define D_JSON_TIMER_OUTPUT "Output"
#define D_JSON_TIMER_POWER "Power"
#define D_JSON_TIMER_ACTION "Action"
#define D_JSON_TIMER_NO_DEVICE "No GPIO as output configured"
#define D_CMND_TIMERS "Timers"
#define D_CMND_LATITUDE "Latitude"

View File

@ -128,6 +128,7 @@
#define D_RESTART_REASON "Příčina restartu"
#define D_RESTORE "Obnovit"
#define D_RETAINED "Zachováno"
#define D_RULE "Rule"
#define D_SAVE "Ulož"
#define D_SENSOR "Sensor"
#define D_SSID "SSID"
@ -370,7 +371,7 @@
#define D_TIMER_DAYS "Dny"
#define D_TIMER_REPEAT "Opakovat"
#define D_TIMER_OUTPUT "Výstup"
#define D_TIMER_POWER "Napájení"
#define D_TIMER_ACTION "Napájení"
// xdrv_03_energy.ino
#define D_ENERGY_TODAY "Spotřeba Dnes"

View File

@ -128,6 +128,7 @@
#define D_RESTART_REASON "Grund für Neustart"
#define D_RESTORE "Wiederherstellung"
#define D_RETAINED "beibehalten"
#define D_RULE "Regel"
#define D_SAVE "Speichern"
#define D_SENSOR "Sensor"
#define D_SSID "SSID"
@ -370,7 +371,7 @@
#define D_TIMER_DAYS "Wochentage"
#define D_TIMER_REPEAT "Wiederholen"
#define D_TIMER_OUTPUT "Ausgang"
#define D_TIMER_POWER "Aktion"
#define D_TIMER_ACTION "Aktion"
// xdrv_03_energy.ino
#define D_ENERGY_TODAY "Energie heute"

View File

@ -128,6 +128,7 @@
#define D_RESTART_REASON "Restart Reason"
#define D_RESTORE "restore"
#define D_RETAINED "retained"
#define D_RULE "Rule"
#define D_SAVE "Save"
#define D_SENSOR "Sensor"
#define D_SSID "SSId"
@ -370,7 +371,7 @@
#define D_TIMER_DAYS "Days"
#define D_TIMER_REPEAT "Repeat"
#define D_TIMER_OUTPUT "Output"
#define D_TIMER_POWER "Power"
#define D_TIMER_ACTION "Action"
// xdrv_03_energy.ino
#define D_ENERGY_TODAY "Energy Today"

View File

@ -128,6 +128,7 @@
#define D_RESTART_REASON "Causa Reinicio"
#define D_RESTORE "Restauración"
#define D_RETAINED "Grabado"
#define D_RULE "Rule"
#define D_SAVE "Grabar"
#define D_SENSOR "Sensor"
#define D_SSID "SSId"
@ -370,7 +371,7 @@
#define D_TIMER_DAYS "Días"
#define D_TIMER_REPEAT "Repetir"
#define D_TIMER_OUTPUT "Salida"
#define D_TIMER_POWER "Estado"
#define D_TIMER_ACTION "Estado"
// xdrv_03_energy.ino
#define D_ENERGY_TODAY "Energía Hoy"

View File

@ -128,6 +128,7 @@
#define D_RESTART_REASON "Raison redémarrage"
#define D_RESTORE "restorer"
#define D_RETAINED "retenu"
#define D_RULE "Rule"
#define D_SAVE "Enregister"
#define D_SENSOR "Capteur"
#define D_SSID "SSID"
@ -370,7 +371,7 @@
#define D_TIMER_DAYS "Days"
#define D_TIMER_REPEAT "Repeat"
#define D_TIMER_OUTPUT "Output"
#define D_TIMER_POWER "Power"
#define D_TIMER_ACTION "Action"
// xsns_03_energy.ino
#define D_ENERGY_TODAY "Energie aujourd'hui"

View File

@ -128,6 +128,7 @@
#define D_RESTART_REASON "Újraindítás oka:"
#define D_RESTORE "Visszaállítás"
#define D_RETAINED "mentve"
#define D_RULE "Rule"
#define D_SAVE "Mentés"
#define D_SENSOR "Szenzor"
#define D_SSID "SSId"
@ -370,7 +371,7 @@
#define D_TIMER_DAYS "Days"
#define D_TIMER_REPEAT "Repeat"
#define D_TIMER_OUTPUT "Output"
#define D_TIMER_POWER "Power"
#define D_TIMER_ACTION "Action"
// xdrv_03_energy.ino
#define D_ENERGY_TODAY "Mai Energia"

View File

@ -128,6 +128,7 @@
#define D_RESTART_REASON "Causa Riavvio"
#define D_RESTORE "ripristino"
#define D_RETAINED "salvato"
#define D_RULE "Rule"
#define D_SAVE "Salva"
#define D_SENSOR "Sensore"
#define D_SSID "SSId"
@ -370,7 +371,7 @@
#define D_TIMER_DAYS "Days"
#define D_TIMER_REPEAT "Repeat"
#define D_TIMER_OUTPUT "Output"
#define D_TIMER_POWER "Power"
#define D_TIMER_ACTION "Action"
// xdrv_03_energy.ino
#define D_ENERGY_TODAY "Energia Oggi"

View File

@ -128,6 +128,7 @@
#define D_RESTART_REASON "Reden herstart"
#define D_RESTORE "herstellen"
#define D_RETAINED "retained"
#define D_RULE "Regel"
#define D_SAVE "Opslaan"
#define D_SENSOR "Sensor"
#define D_SSID "SSId"
@ -370,7 +371,7 @@
#define D_TIMER_DAYS "Dagen"
#define D_TIMER_REPEAT "Herhaal"
#define D_TIMER_OUTPUT "Uitgang"
#define D_TIMER_POWER "Actie"
#define D_TIMER_ACTION "Actie"
// xdrv_03_energy.ino
#define D_ENERGY_TODAY "Verbruik vandaag"

View File

@ -128,6 +128,7 @@
#define D_RESTART_REASON "Przyczyna restartu"
#define D_RESTORE "Przywracanie"
#define D_RETAINED "Zachowane"
#define D_RULE "Rule"
#define D_SAVE "Zapisz"
#define D_SENSOR "Czujnik"
#define D_SSID "SSID"
@ -370,7 +371,7 @@
#define D_TIMER_DAYS "Days"
#define D_TIMER_REPEAT "Repeat"
#define D_TIMER_OUTPUT "Output"
#define D_TIMER_POWER "Power"
#define D_TIMER_ACTION "Action"
// xdrv_03_energy.ino
#define D_ENERGY_TODAY "Energia Dzisiaj"

View File

@ -128,6 +128,7 @@
#define D_RESTART_REASON "Razão do reinicio"
#define D_RESTORE "Restauro"
#define D_RETAINED "Manter"
#define D_RULE "Rule"
#define D_SAVE "Salvar"
#define D_SENSOR "Sensor"
#define D_SSID "SSId"
@ -370,7 +371,7 @@
#define D_TIMER_DAYS "Days"
#define D_TIMER_REPEAT "Repeat"
#define D_TIMER_OUTPUT "Output"
#define D_TIMER_POWER "Power"
#define D_TIMER_ACTION "Action"
// xdrv_03_energy.ino
#define D_ENERGY_TODAY "Consumo energético de hoje"

View File

@ -128,6 +128,7 @@
#define D_RESTART_REASON "Причина перезагрузки"
#define D_RESTORE "восстановление"
#define D_RETAINED "нераспред."
#define D_RULE "Rule"
#define D_SAVE "Сохранить"
#define D_SENSOR "Датчик"
#define D_SSID "SSId"
@ -370,7 +371,7 @@
#define D_TIMER_DAYS "Days"
#define D_TIMER_REPEAT "Repeat"
#define D_TIMER_OUTPUT "Output"
#define D_TIMER_POWER "Power"
#define D_TIMER_ACTION "Action"
// xdrv_03_energy.ino
#define D_ENERGY_TODAY "Энергия Сегодня"

View File

@ -128,6 +128,7 @@
#define D_RESTART_REASON "重启原因"
#define D_RESTORE "恢复"
#define D_RETAINED "已保留"
#define D_RULE "Rule"
#define D_SAVE "保存"
#define D_SENSOR "传感器"
#define D_SSID "名称"
@ -370,7 +371,7 @@
#define D_TIMER_DAYS "Days"
#define D_TIMER_REPEAT "Repeat"
#define D_TIMER_OUTPUT "Output"
#define D_TIMER_POWER "Power"
#define D_TIMER_ACTION "Action"
// xdrv_03_energy.ino
#define D_ENERGY_TODAY "今日用电量"

View File

@ -128,6 +128,7 @@
#define D_RESTART_REASON "重啟原因"
#define D_RESTORE "恢覆"
#define D_RETAINED "已保留"
#define D_RULE "Rule"
#define D_SAVE "存檔"
#define D_SENSOR "感測器"
#define D_SSID "名稱"
@ -370,7 +371,7 @@
#define D_TIMER_DAYS "Days"
#define D_TIMER_REPEAT "Repeat"
#define D_TIMER_OUTPUT "Output"
#define D_TIMER_POWER "Power"
#define D_TIMER_ACTION "Action"
// xdrv_03_energy.ino
#define D_ENERGY_TODAY "今日用電量"

View File

@ -164,7 +164,7 @@ enum LichtSubtypes {LST_NONE, LST_SINGLE, LST_COLDWARM, LST_RGB, LST_RGBW, LST_R
enum LichtSchemes {LS_POWER, LS_WAKEUP, LS_CYCLEUP, LS_CYCLEDN, LS_RANDOM, LS_MAX};
enum XsnsFunctions {FUNC_INIT, FUNC_LOOP, FUNC_EVERY_50_MSECOND, FUNC_EVERY_SECOND, FUNC_PREP_BEFORE_TELEPERIOD, FUNC_JSON_APPEND, FUNC_WEB_APPEND, FUNC_SAVE_BEFORE_RESTART,
FUNC_COMMAND, FUNC_NTP_INIT, FUNC_NTP_SET,
FUNC_COMMAND, FUNC_NTP_INIT, FUNC_NTP_SET, FUNC_CLOCK_TIMER,
FUNC_MQTT_SUBSCRIBE, FUNC_MQTT_INIT, FUNC_MQTT_DATA, FUNC_MQTT_DISCONNECTED, FUNC_MQTT_CONNECTED,
FUNC_SET_POWER, FUNC_SHOW_SENSOR};

View File

@ -192,7 +192,7 @@ size_t strchrspn(const char *str1, int character)
return ret;
}
double AtoD(char *str)
double CharToDouble(char *str)
{
// simple ascii to double, because atof or strtod are too large
char strbuf[24];
@ -1377,8 +1377,8 @@ void RtcSecond()
GetTime(0).c_str(), GetTime(2).c_str(), GetTime(3).c_str());
AddLog(LOG_LEVEL_DEBUG);
if (local_time < 1451602800) {
XdrvCall(FUNC_NTP_SET);
if (local_time < 1451602800) { // 2016-01-01
XdrvCall(FUNC_NTP_INIT);
} else {
XdrvCall(FUNC_NTP_SET);
}

View File

@ -68,9 +68,9 @@
// -- Syslog --------------------------------------
#define SYS_LOG_HOST "" // [LogHost] (Linux) syslog host
#define SYS_LOG_PORT 514 // [LogPort] default syslog UDP port
#define SYS_LOG_LEVEL LOG_LEVEL_NONE // [SysLog] LOG_LEVEL_NONE, LOG_LEVEL_ERROR, LOG_LEVEL_INFO, LOG_LEVEL_DEBUG, LOG_LEVEL_DEBUG_MORE
#define SERIAL_LOG_LEVEL LOG_LEVEL_INFO // [SerialLog] LOG_LEVEL_NONE, LOG_LEVEL_ERROR, LOG_LEVEL_INFO, LOG_LEVEL_DEBUG, LOG_LEVEL_DEBUG_MORE
#define WEB_LOG_LEVEL LOG_LEVEL_INFO // [WebLog] LOG_LEVEL_NONE, LOG_LEVEL_ERROR, LOG_LEVEL_INFO, LOG_LEVEL_DEBUG, LOG_LEVEL_DEBUG_MORE
#define SYS_LOG_LEVEL LOG_LEVEL_NONE // [SysLog] (LOG_LEVEL_NONE, LOG_LEVEL_ERROR, LOG_LEVEL_INFO, LOG_LEVEL_DEBUG, LOG_LEVEL_DEBUG_MORE)
#define SERIAL_LOG_LEVEL LOG_LEVEL_INFO // [SerialLog] (LOG_LEVEL_NONE, LOG_LEVEL_ERROR, LOG_LEVEL_INFO, LOG_LEVEL_DEBUG, LOG_LEVEL_DEBUG_MORE)
#define WEB_LOG_LEVEL LOG_LEVEL_INFO // [WebLog] (LOG_LEVEL_NONE, LOG_LEVEL_ERROR, LOG_LEVEL_INFO, LOG_LEVEL_DEBUG, LOG_LEVEL_DEBUG_MORE)
// -- Ota -----------------------------------------
#define OTA_URL "http://sonoff.maddox.co.uk/tasmota/sonoff.ino.bin" // [OtaUrl]

View File

@ -22,15 +22,15 @@
* Timers
*
* Arm a timer using one or all of the following JSON values:
* {"Arm":1,"Mode":0,"Time":"09:23","Days":"--TW--S","Repeat":1,"Device":1,"Power":1}
* {"Arm":1,"Mode":0,"Time":"09:23","Days":"--TW--S","Repeat":1,"Output":1,"Action":1}
*
* Arm 0 = Off, 1 = On
* Mode 0 = Schedule, 1 = Sunrise, 2 = Sunset
* Time hours:minutes
* Days 7 day character mask starting with Sunday (SMTWTFS). 0 or - = Off, any other value = On
* Repeat 0 = Execute once, 1 = Execute again
* Device 1..16
* Power 0 = Off, 1 = On, 2 = Toggle, 3 = Blink
* Arm 0 = Off, 1 = On
* Mode 0 = Schedule, 1 = Sunrise, 2 = Sunset
* Time hours:minutes
* Days 7 day character mask starting with Sunday (SMTWTFS). 0 or - = Off, any other value = On
* Repeat 0 = Execute once, 1 = Execute again
* Output 1..16
* Action 0 = Off, 1 = On, 2 = Toggle, 3 = Blink or Rule if USE_RULES enabled
*
\*********************************************************************************************/
@ -45,7 +45,6 @@ const char kTimerCommands[] PROGMEM = D_CMND_TIMER "|" D_CMND_TIMERS
#endif
;
uint16_t timer_fired = 0;
uint16_t timer_last_minute = 60;
#ifdef USE_SUNRISE
@ -206,7 +205,7 @@ uint16_t GetSunMinutes(byte dawn)
void TimerEverySecond()
{
if (RtcTime.valid) {
if (RtcTime.minute != timer_last_minute) { // Execute every minute
if (RtcTime.minute != timer_last_minute) { // Execute every minute only once
timer_last_minute = RtcTime.minute;
uint16_t time = (RtcTime.hour *60) + RtcTime.minute;
uint8_t days = 1 << (RtcTime.day_of_week -1);
@ -221,13 +220,16 @@ void TimerEverySecond()
#endif
if (Settings.timer[i].arm) {
if (time == set_time) {
if (!bitRead(timer_fired, i) && (Settings.timer[i].days & days)) {
bitSet(timer_fired, i);
if (Settings.timer[i].days & days) {
Settings.timer[i].arm = Settings.timer[i].repeat;
ExecuteCommandPower(Settings.timer[i].device +1, Settings.timer[i].power);
#ifdef USE_RULES
if (3 == Settings.timer[i].power) { // Blink becomes Rule disregarding device and allowing use of Backlog commands
XdrvMailbox.index = i;
XdrvCall(FUNC_CLOCK_TIMER);
} else
#endif
ExecuteCommandPower(Settings.timer[i].device +1, Settings.timer[i].power);
}
} else {
bitClear(timer_fired, i);
}
}
}
@ -245,10 +247,10 @@ void PrepShowTimer(uint8_t index)
snprintf(days, sizeof(days), "%s%d", days, ((Settings.timer[index].days & mask) > 0));
}
#ifdef USE_SUNRISE
snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s\"" D_CMND_TIMER "%d\":{\"" D_JSON_TIMER_ARM "\":%d,\"" D_JSON_TIMER_MODE "\":%d,\"" D_JSON_TIMER_TIME "\":\"%02d:%02d\",\"" D_JSON_TIMER_DAYS "\":\"%s\",\"" D_JSON_TIMER_REPEAT "\":%d,\"" D_JSON_TIMER_OUTPUT "\":%d,\"" D_JSON_TIMER_POWER "\":%d}"),
snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s\"" D_CMND_TIMER "%d\":{\"" D_JSON_TIMER_ARM "\":%d,\"" D_JSON_TIMER_MODE "\":%d,\"" D_JSON_TIMER_TIME "\":\"%02d:%02d\",\"" D_JSON_TIMER_DAYS "\":\"%s\",\"" D_JSON_TIMER_REPEAT "\":%d,\"" D_JSON_TIMER_OUTPUT "\":%d,\"" D_JSON_TIMER_ACTION "\":%d}"),
mqtt_data, index +1, Settings.timer[index].arm, Settings.timer[index].mode, Settings.timer[index].time / 60, Settings.timer[index].time % 60, days, Settings.timer[index].repeat, Settings.timer[index].device +1, Settings.timer[index].power);
#else
snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s\"" D_CMND_TIMER "%d\":{\"" D_JSON_TIMER_ARM "\":%d,\"" D_JSON_TIMER_TIME "\":\"%02d:%02d\",\"" D_JSON_TIMER_DAYS "\":\"%s\",\"" D_JSON_TIMER_REPEAT "\":%d,\"" D_JSON_TIMER_OUTPUT "\":%d,\"" D_JSON_TIMER_POWER "\":%d}"),
snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s\"" D_CMND_TIMER "%d\":{\"" D_JSON_TIMER_ARM "\":%d,\"" D_JSON_TIMER_TIME "\":\"%02d:%02d\",\"" D_JSON_TIMER_DAYS "\":\"%s\",\"" D_JSON_TIMER_REPEAT "\":%d,\"" D_JSON_TIMER_OUTPUT "\":%d,\"" D_JSON_TIMER_ACTION "\":%d}"),
mqtt_data, index +1, Settings.timer[index].arm, Settings.timer[index].time / 60, Settings.timer[index].time % 60, days, Settings.timer[index].repeat, Settings.timer[index].device +1, Settings.timer[index].power);
#endif // USE_SUNRISE
}
@ -259,7 +261,7 @@ void PrepShowTimer(uint8_t index)
boolean TimerCommand()
{
char command [CMDSZ];
char command[CMDSZ];
char dataBufUc[XdrvMailbox.data_len];
boolean serviced = true;
uint8_t index = XdrvMailbox.index;
@ -335,10 +337,9 @@ boolean TimerCommand()
uint8_t device = ((uint8_t)root[parm_uc] -1) & 0x0F;
Settings.timer[index].device = (device < devices_present) ? device : devices_present -1;
}
if (root[UpperCase_P(parm_uc, PSTR(D_JSON_TIMER_POWER))].success()) {
if (root[UpperCase_P(parm_uc, PSTR(D_JSON_TIMER_ACTION))].success()) {
Settings.timer[index].power = (uint8_t)root[parm_uc] & 0x03;
}
if (Settings.timer[index].arm) bitClear(timer_fired, index);
index++;
}
@ -376,7 +377,7 @@ boolean TimerCommand()
#ifdef USE_SUNRISE
else if (CMND_LONGITUDE == command_code) {
if (XdrvMailbox.data_len) {
Settings.longitude = (int)(AtoD(XdrvMailbox.data) *1000000);
Settings.longitude = (int)(CharToDouble(XdrvMailbox.data) *1000000);
}
char lbuff[32];
dtostrfd(((double)Settings.longitude) /1000000, 6, lbuff);
@ -384,7 +385,7 @@ boolean TimerCommand()
}
else if (CMND_LATITUDE == command_code) {
if (XdrvMailbox.data_len) {
Settings.latitude = (int)(AtoD(XdrvMailbox.data) *1000000);
Settings.latitude = (int)(CharToDouble(XdrvMailbox.data) *1000000);
}
char lbuff[32];
dtostrfd(((double)Settings.latitude) /1000000, 6, lbuff);
@ -486,11 +487,15 @@ const char HTTP_FORM_TIMER1[] PROGMEM =
"' hidden><div id='bt' name='bt'></div><br/><br/><br/>"
"<div>"
"<b>" D_TIMER_OUTPUT "</b>&nbsp;<span><select style='width:60px;' id='d1' name='d1'></select></span>&emsp;"
"<b>" D_TIMER_POWER "</b>&nbsp;<select style='width:99px;' id='p1' name='p1'>"
"<b>" D_TIMER_ACTION "</b>&nbsp;<select style='width:99px;' id='p1' name='p1'>"
"<option value='0'>" D_OFF "</option>"
"<option value='1'>" D_ON "</option>"
"<option value='2'>" D_TOGGLE "</option>"
#ifdef USE_RULES
"<option value='3'>" D_RULE "</option>"
#else
"<option value='3'>" D_BLINK "</option>"
#endif
"</select>"
"</div><br/>"
"<div>"

View File

@ -182,12 +182,17 @@ boolean XdrvMqttData(char *topicBuf, uint16_t stopicBuf, char *dataBuf, uint16_t
* FUNC_LOOP
* FUNC_MQTT_SUBSCRIBE
* FUNC_MQTT_INIT
* FUNC_MQTT_DISCONNECTED
* FUNC_MQTT_CONNECTED
* return FUNC_MQTT_DATA
* return FUNC_COMMAND
* FUNC_SET_POWER
* FUNC_SHOW_SENSOR
* FUNC_EVERY_SECOND
* FUNC_EVERY_50_MSECOND
* FUNC_NTP_INIT
* FUNC_NTP_SET
* FUNC_CLOCK_TIMER
\*********************************************************************************************/
boolean XdrvCall(byte Function)

View File

@ -205,6 +205,7 @@ void Ds18b20Show(boolean json)
#endif // USE_WEBSERVER
}
}
Ds18x20Convert(); // Start conversion, takes up to one second
}
/*********************************************************************************************\
@ -231,7 +232,6 @@ boolean Xsns05(byte function)
#ifdef USE_WEBSERVER
case FUNC_WEB_APPEND:
Ds18b20Show(0);
Ds18x20Convert(); // Start conversion, takes up to one second
break;
#endif // USE_WEBSERVER
}

View File

@ -392,6 +392,7 @@ void Ds18x20Show(boolean json)
}
}
}
Ds18x20Convert(); // Start conversion, takes up to one second
}
/*********************************************************************************************\
@ -409,11 +410,6 @@ boolean Xsns05(byte function)
case FUNC_INIT:
Ds18x20Init();
break;
// case FUNC_EVERY_SECOND:
// if ((Settings.tele_period - tele_period) &3 == 3) {
// Ds18x20Convert(); // Start conversion every four seconds, takes up to one second
// }
// break;
case FUNC_PREP_BEFORE_TELEPERIOD:
Ds18x20Convert(); // Start conversion, takes up to one second
break;
@ -423,7 +419,6 @@ boolean Xsns05(byte function)
#ifdef USE_WEBSERVER
case FUNC_WEB_APPEND:
Ds18x20Show(0);
Ds18x20Convert(); // Start conversion, takes up to one second
break;
#endif // USE_WEBSERVER
}

View File

@ -204,12 +204,9 @@ void Ds18x20Show(boolean json)
if (dsxflg) {
snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s}"), mqtt_data);
}
#ifdef USE_WEBSERVER
} else {
Ds18x20Search(); // Check for changes in sensors number
Ds18x20Convert(); // Start Conversion, takes up to one second
#endif // USE_WEBSERVER
}
Ds18x20Search(); // Check for changes in sensors number
Ds18x20Convert(); // Start Conversion, takes up to one second
}
/*********************************************************************************************\

View File

@ -186,6 +186,7 @@ boolean (* const xsns_func_ptr[])(byte) PROGMEM = { // Sensor Function Pointers
};
const uint8_t xsns_present = sizeof(xsns_func_ptr) / sizeof(xsns_func_ptr[0]); // Number of External Sensors found
uint8_t xsns_index = 0;
/*********************************************************************************************\
* Function call to all xsns
@ -200,6 +201,18 @@ const uint8_t xsns_present = sizeof(xsns_func_ptr) / sizeof(xsns_func_ptr[0]);
* FUNC_EVERY_50_MSECOND
\*********************************************************************************************/
uint8_t XsnsPresent()
{
return xsns_present;
}
boolean XsnsNextCall(byte Function)
{
xsns_index++;
if (xsns_index == xsns_present) xsns_index = 0;
return xsns_func_ptr[xsns_index](Function);
}
boolean XsnsCall(byte Function)
{
boolean result = false;