FrSkyRC / ETHOS-Feedback-Community

Feedback & suggestions are welcomed here for ETHOS by FrSky
187 stars 84 forks source link

Max instructions reached error while running lua script in Ethos 1.5.15 #4505

Open fdm225 opened 1 week ago

fdm225 commented 1 week ago

Hi Devs, I tried to update issue 4103 but didn't see any official response and would like to try and get this resolved. I am fixing a script that generates a QR code from the last logged GPS location and it does a lot of processing when started, enough to trigger the Max instructions count reached message. I am doing the processing in the wakeup function on version 1.5.15; do I need to do anything to use the preemption that is discussed in issue 4103 or am I misunderstanding how it works? I assumed that when the instruction count was reached it would preempt the current running script and when wakeup is called again it would pickup from where it left off, is that correct? I have attached the modified script in the case that it is of use.

local function wakeup(widget)
    doHeavyCalc(widget)

image Ethos-ModelFinder.zip

strgaltdel commented 1 week ago

just some additional info

this is a more condensed script, focussing on the max instructions issue just calculating the QR code (in wakeup handler) in case SF was switched

main.zip

regards

fdm225 commented 1 week ago

I fixed a couple of small issues but when I ran into the instruction limit. I attempted to move it into the wakeup function and am putting any additional fixes on hold until I see if there is a resolution. If the only fix is to rewrite the computation portion of the QR code I will probably let this go as I do not want to take the time to understand where to break the main computation code up.

dave

bsongis-frsky commented 2 days ago

You have attached several scripts, I see one source and one widget. Is it possible that you attach the minimum to reproduce the issue?

strgaltdel commented 2 days ago

... you can take my "main.zip"-widget "QR-Calc" from above (only one main.lua), it's a subset of fdm225's widget, my example does the QR calculation only as a "proof of concept" and triggers the failure in wakeup handler too

Calculation (and failure) is initiated by switching SF in Sim.

image

regards