mirror of
https://github.com/arendst/Tasmota.git
synced 2025-07-23 18:56:38 +00:00
Fix define USE_DT_VARS
This commit is contained in:
parent
c378d70fef
commit
f6f13fe249
@ -974,15 +974,14 @@ void RulesEvery50ms(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t rules_xsns_index = 0;
|
void RulesEvery100ms(void) {
|
||||||
|
static uint8_t xsns_index = 0;
|
||||||
|
|
||||||
void RulesEvery100ms(void)
|
|
||||||
{
|
|
||||||
if (Settings.rule_enabled && !Rules.busy && (TasmotaGlobal.uptime > 4)) { // Any rule enabled and allow 4 seconds start-up time for sensors (#3811)
|
if (Settings.rule_enabled && !Rules.busy && (TasmotaGlobal.uptime > 4)) { // Any rule enabled and allow 4 seconds start-up time for sensors (#3811)
|
||||||
ResponseClear();
|
ResponseClear();
|
||||||
int tele_period_save = TasmotaGlobal.tele_period;
|
int tele_period_save = TasmotaGlobal.tele_period;
|
||||||
TasmotaGlobal.tele_period = 2; // Do not allow HA updates during next function call
|
TasmotaGlobal.tele_period = 2; // Do not allow HA updates during next function call
|
||||||
XsnsNextCall(FUNC_JSON_APPEND, rules_xsns_index); // ,"INA219":{"Voltage":4.494,"Current":0.020,"Power":0.089}
|
XsnsNextCall(FUNC_JSON_APPEND, xsns_index); // ,"INA219":{"Voltage":4.494,"Current":0.020,"Power":0.089}
|
||||||
TasmotaGlobal.tele_period = tele_period_save;
|
TasmotaGlobal.tele_period = tele_period_save;
|
||||||
if (strlen(TasmotaGlobal.mqtt_data)) {
|
if (strlen(TasmotaGlobal.mqtt_data)) {
|
||||||
TasmotaGlobal.mqtt_data[0] = '{'; // {"INA219":{"Voltage":4.494,"Current":0.020,"Power":0.089}
|
TasmotaGlobal.mqtt_data[0] = '{'; // {"INA219":{"Voltage":4.494,"Current":0.020,"Power":0.089}
|
||||||
|
@ -4844,15 +4844,15 @@ int16_t Run_script_sub(const char *type, int8_t tlen, struct GVARS *gv) {
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t script_xsns_index = 0;
|
|
||||||
|
|
||||||
void ScripterEvery100ms(void) {
|
void ScripterEvery100ms(void) {
|
||||||
|
static uint8_t xsns_index = 0;
|
||||||
|
|
||||||
if (bitRead(Settings.rule_enabled, 0) && (TasmotaGlobal.uptime > 4)) {
|
if (bitRead(Settings.rule_enabled, 0) && (TasmotaGlobal.uptime > 4)) {
|
||||||
ResponseClear();
|
ResponseClear();
|
||||||
uint16_t script_tele_period_save = TasmotaGlobal.tele_period;
|
uint16_t script_tele_period_save = TasmotaGlobal.tele_period;
|
||||||
TasmotaGlobal.tele_period = 2;
|
TasmotaGlobal.tele_period = 2;
|
||||||
XsnsNextCall(FUNC_JSON_APPEND, script_xsns_index);
|
XsnsNextCall(FUNC_JSON_APPEND, xsns_index);
|
||||||
TasmotaGlobal.tele_period = script_tele_period_save;
|
TasmotaGlobal.tele_period = script_tele_period_save;
|
||||||
if (strlen(TasmotaGlobal.mqtt_data)) {
|
if (strlen(TasmotaGlobal.mqtt_data)) {
|
||||||
TasmotaGlobal.mqtt_data[0] = '{';
|
TasmotaGlobal.mqtt_data[0] = '{';
|
||||||
|
@ -1157,8 +1157,9 @@ void draw_dt_vars(void) {
|
|||||||
|
|
||||||
#define DTV_JSON_SIZE 1024
|
#define DTV_JSON_SIZE 1024
|
||||||
|
|
||||||
void DTVarsTeleperiod(void) {
|
void DisplayDTVarsTeleperiod(void) {
|
||||||
if (TasmotaGlobal.mqtt_data && TasmotaGlobal.mqtt_data[0]) {
|
ResponseClear();
|
||||||
|
MqttShowState();
|
||||||
uint32_t jlen = strlen(TasmotaGlobal.mqtt_data);
|
uint32_t jlen = strlen(TasmotaGlobal.mqtt_data);
|
||||||
|
|
||||||
if (jlen < DTV_JSON_SIZE) {
|
if (jlen < DTV_JSON_SIZE) {
|
||||||
@ -1170,13 +1171,14 @@ void DTVarsTeleperiod(void) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
void get_dt_mqtt(void) {
|
void get_dt_mqtt(void) {
|
||||||
|
static uint8_t xsns_index = 0;
|
||||||
|
|
||||||
ResponseClear();
|
ResponseClear();
|
||||||
uint16_t script_tele_period_save = TasmotaGlobal.tele_period;
|
uint16_t script_tele_period_save = TasmotaGlobal.tele_period;
|
||||||
TasmotaGlobal.tele_period = 2;
|
TasmotaGlobal.tele_period = 2;
|
||||||
XsnsNextCall(FUNC_JSON_APPEND, script_xsns_index);
|
XsnsNextCall(FUNC_JSON_APPEND, xsns_index);
|
||||||
TasmotaGlobal.tele_period = script_tele_period_save;
|
TasmotaGlobal.tele_period = script_tele_period_save;
|
||||||
if (strlen(TasmotaGlobal.mqtt_data)) {
|
if (strlen(TasmotaGlobal.mqtt_data)) {
|
||||||
TasmotaGlobal.mqtt_data[0] = '{';
|
TasmotaGlobal.mqtt_data[0] = '{';
|
||||||
@ -2788,7 +2790,11 @@ bool Xdrv13(uint8_t function)
|
|||||||
if (Settings.display_model && Settings.display_mode) { XdspCall(FUNC_DISPLAY_EVERY_SECOND); }
|
if (Settings.display_model && Settings.display_mode) { XdspCall(FUNC_DISPLAY_EVERY_SECOND); }
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
|
case FUNC_AFTER_TELEPERIOD:
|
||||||
|
#ifdef USE_DT_VARS
|
||||||
|
DisplayDTVarsTeleperiod();
|
||||||
|
#endif // USE_DT_VARS
|
||||||
|
break;
|
||||||
#ifdef USE_DISPLAY_MODES1TO5
|
#ifdef USE_DISPLAY_MODES1TO5
|
||||||
case FUNC_MQTT_SUBSCRIBE:
|
case FUNC_MQTT_SUBSCRIBE:
|
||||||
DisplayMqttSubscribe();
|
DisplayMqttSubscribe();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user