diff --git a/tasmota/xdrv_10_scripter.ino b/tasmota/xdrv_10_scripter.ino index db82304706fc..4485ea6f7341 100755 --- a/tasmota/xdrv_10_scripter.ino +++ b/tasmota/xdrv_10_scripter.ino @@ -164,7 +164,10 @@ void Script_ticker4_end(void) { #endif #endif +#if defined(USE_SML_M) && defined (USE_SML_SCRIPT_CMD) extern uint8_t sml_json_enable; +extern uint8_t dvalid[SML_MAX_VARS]; +#endif #if defined(EEP_SCRIPT_SIZE) && !defined(ESP32) @@ -784,6 +787,9 @@ char *script; if (imemptr) free(imemptr); return -4; } + + memset(script_mem, 0, script_mem_size); + glob_script_mem.script_mem = script_mem; glob_script_mem.script_mem_size = script_mem_size; @@ -1749,6 +1755,7 @@ chknext: len = 0; goto exit; } +#endif if (!strncmp(vname, "abs(", 4)) { lp=GetNumericArgument(lp + 4, OPER_EQU, &fvar, gv); fvar = fabs(fvar); @@ -1756,7 +1763,7 @@ chknext: len = 0; goto exit; } -#endif + if (!strncmp(vname, "asc(", 4)) { char str[SCRIPT_MAXSSIZE]; lp = GetStringArgument(lp + 4, OPER_EQU, str, gv); @@ -3152,6 +3159,21 @@ chknext: len = 0; goto exit; } + if (!strncmp(vname, "smlv[", 5)) { + lp = GetNumericArgument(lp + 5, OPER_EQU, &fvar, gv); + if (!fvar) { + for (uint8_t cnt = 0; cnt < SML_MAX_VARS; cnt++) { + dvalid[cnt] = 0; + } + fvar = 0; + } else { + if (fvar < 1) fvar = 1; + fvar = dvalid[(uint32_t)fvar - 1]; + } + lp++; + len = 0; + goto exit; + } #endif //USE_SML_M break; case 't':