scripter math functions

This commit is contained in:
gemu2015 2019-11-27 17:15:41 +01:00
parent 33e9d867c8
commit 4ea287eb5b
1 changed files with 33 additions and 2 deletions

31
tasmota/xdrv_10_scripter.ino Normal file → Executable file
View File

@ -1059,6 +1059,19 @@ char *isvar(char *lp, uint8_t *vtype,struct T_INDEX *tind,float *fp,char *sp,Jso
chknext:
switch (vname[0]) {
case 'a':
#ifdef USE_ANGLE_FUNC
if (!strncmp(vname,"acos(",5)) {
lp+=5;
lp=GetNumericResult(lp,OPER_EQU,&fvar,0);
fvar=acosf(fvar);
lp++;
len=0;
goto exit;
}
#endif
break;
case 'b':
if (!strncmp(vname,"boot",4)) {
if (rules_flag.system_boot) {
@ -1678,6 +1691,24 @@ chknext:
len+=1;
goto exit;
}
#endif
#ifdef USE_ANGLE_FUNC
if (!strncmp(vname,"sin(",4)) {
lp+=4;
lp=GetNumericResult(lp,OPER_EQU,&fvar,0);
fvar=sinf(fvar);
lp++;
len=0;
goto exit;
}
if (!strncmp(vname,"sqrt(",5)) {
lp+=5;
lp=GetNumericResult(lp,OPER_EQU,&fvar,0);
fvar=sqrtf(fvar);
lp++;
len=0;
goto exit;
}
#endif
break;
case 't':