Closed nikvostro closed 3 years ago
i checked your script with an older version and it worked. i then tried with most recent dev version and it fails like yours. however the bug is not in moving average but the print function somehow fails. if you spilt the print into 2 lines it works. print %rand% print movav = %ave%
since nothing was changed in the scripter printing function it must be a side effect of other changes in Tasmota. i am currently extremely busy with other things and have no time to check what causes this bug in the printing function. will check this if i have more time again.
Hello @gemu2015 !
I can't agree with you regarding supposed issue with printing function, because:
Nothing changed for me if I splitting print into two rows:
Declared length 12:
ESP32CAM with added HTML rows like in examle (docs/Scripting - ESP32 Webcam support):
ok, recently memory allocation was changed from calloc to malloc. this caused an issue with moving average vars not set to zero before start. this should be fixed now. please test by replacing scripter source file.
(I've replaced LOG_LEVEL with DEBUG to hide extra info intersecting with my "print") Now looks much better. I've tried to change legth -> result seems to adequeate now in all cases. I consider issue as resolved now :) Thanks a lot!
By the way - abs() function is under USE_ANGLE_FUNC def as well as geometric functions. I think it's more logical to move it out OR modify the Docs by adding notice in brackets:
this was actually a mistake. will move abs() to standard functions.
PROBLEM DESCRIPTION
Moving average (M:vname) for Scripting gives inadequate results. This actual at least for 2 independand builds (env): TTGO and EPS32CAM. Tested on master 9.5.0 and development on 01 Jul 2021 branches.
REQUESTED INFORMATION
Backlog Template; Module; GPIO 255
:Backlog Rule1; Rule2; Rule3
:Status 0
:weblog
to 4 and then, when you experience your issue, provide the output of the Console log: Nothin appears in log for that caseTO REPRODUCE
M:ave=0 4
orM:ave=0 6
orM:ave=0 1
EXPECTED BEHAVIOUR
Moving average should be calculated properly
SCREENSHOTS
ADDITIONAL CONTEXT
I'm not a proffessional coder but it looks like an error with some pointer variables that are referencing to the moving average data array.
user_config_override.h:
(Please, remember to close the issue when the problem has been addressed)