Open roohif opened 2 months ago
No, that lot of code online and in our own documentation does what we recommend for such cases. Add a core.wait(0.1)
or so to give it time to catch up, i.e., allow one frame drawing cycle, else you are updating the location without actually computing anything. If there was an alternative, it would have been documented.
Would it be possible to emit some kind of signal like frameStarted
for the JS code to connect to?
You mean, adding core.wait(SignalName)
instead of just waiting a short time? Maybe. This might be helpful to minimize the waiting delay. Such signal could be emitted after all computations are done and drawing begins. However, some computations are done during drawing, so maybe rather add and connect to a signal 'nextFrameComplete' (hard to foresee intermixed frame counters?) or use a counter initialized with 2 and counting down, to compute&draw 2 frames before returning the numbers. The core.wait(smallDelay)
is a solution that at least works now and has worked since 2012 or so. Feel free to optimize! I think some command to be given manually to yield processing to the main loop is unavoidable.
Hello @roohif!
Thank you for suggesting this enhancement.
I am using Stellarium to extract data in a "batch" fashion, if you know what I mean. So I am changing location, and then grabbinhg some attributes for the Sun/Moon, and then changing location again.
For example:
What I'm seeing a lot is thisMoonAlt == thatMoonAlt. It's like Stellarium hasn't yet processed the move of the observer, and is giving me the old value. I've seen a lot of code online that says I need to add core.wait() to give it time to catch up, but I guess I was hoping that there was some way to force it to block until the location has been processed .. ?