diff --git a/sonoff/xdrv_10_scripter.ino b/sonoff/xdrv_10_scripter.ino index ccf98a592..3a87aec44 100644 --- a/sonoff/xdrv_10_scripter.ino +++ b/sonoff/xdrv_10_scripter.ino @@ -2031,6 +2031,7 @@ void Replace_Cmd_Vars(char *srcbuf,char *dstbuf,uint16_t dstsize) { char *cp; uint16_t count; uint8_t vtype; + uint8_t dprec=glob_script_mem.script_dprec; float fvar; cp=srcbuf; struct T_INDEX ind; @@ -2041,13 +2042,16 @@ void Replace_Cmd_Vars(char *srcbuf,char *dstbuf,uint16_t dstsize) { if (*cp=='%') { dstbuf[count]=*cp++; } else { - //char *scp=cp; + if (isdigit(*cp)) { + dprec=*cp&0xf; + cp++; + } cp=isvar(cp,&vtype,&ind,&fvar,string,0); if (vtype!=VAR_NV) { // found variable as result if (vtype==NUM_RES || (vtype&STYPE)==0) { // numeric result - dtostrfd(fvar,glob_script_mem.script_dprec,string); + dtostrfd(fvar,dprec,string); } else { // string result } @@ -2650,7 +2654,7 @@ int16_t Run_Scripter(const char *type, int8_t tlen, char *js) { switch (lastop) { case OPER_EQU: if (glob_script_mem.var_not_found) { - if (!js) toLog("var not found\n"); + if (!js) toLogEOL("var not found: ",lp); goto next_line; } *dfvar=fvar; @@ -3587,23 +3591,21 @@ void ScriptWebShow(void) { if (!*lp || *lp=='#' || *lp=='>') { break; } - - // send this line to web - memcpy(line,lp,sizeof(line)); - line[sizeof(line)-1]=0; - char *cp=line; - for (uint32_t i=0; i') { break; } - - // send this line to mqtt - memcpy(line,lp,sizeof(line)); - line[sizeof(line)-1]=0; - char *cp=line; - for (uint32_t i=0; i