Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

some fixes #12541

Merged
merged 1 commit into from
Jul 2, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 23 additions & 1 deletion tasmota/xdrv_10_scripter.ino
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down Expand Up @@ -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;

Expand Down Expand Up @@ -1749,14 +1755,15 @@ chknext:
len = 0;
goto exit;
}
#endif
if (!strncmp(vname, "abs(", 4)) {
lp=GetNumericArgument(lp + 4, OPER_EQU, &fvar, gv);
fvar = fabs(fvar);
lp++;
len = 0;
goto exit;
}
#endif

if (!strncmp(vname, "asc(", 4)) {
char str[SCRIPT_MAXSSIZE];
lp = GetStringArgument(lp + 4, OPER_EQU, str, gv);
Expand Down Expand Up @@ -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':
Expand Down