Open RobertGary1 opened 8 years ago
Yeah, the polling is incredibly naive and not right. I tossed it in just to get the data from Stratux and exercise the UI. It needs a much better method. I'm open to suggestions on how to do it better.
It also needs to be able to detect when it can't get valid data so it can set the 'inop' flags on the appropriate widgets.
Its worth mentioning that www/js/test/.js is a bunch of duct tape functions.
https://github.com/Bagarre/Pi2D2/commit/a3216883f23db83d48723f052a8fc5c933ddcdb1
Should help. Delay is 100 microseconds since the last ajax call so they dont stack up. On success, a timestamp is set (lastPoll) and every second we check that lastPoll is no more than 3 seconds old. If it's older (meaning we can't poll and the data we have is 3 seconds old) the UI sets the widgets to INOP. On next successful poll, the screen will update and INOPs taken away.
What code is responsible for polling now? I don't see a poll now in test.js other than the INOP check. So now I just see it come up as INOP.
-Robert
I need to take a few hours to clean and organize things better. https://github.com/Bagarre/Pi2D2/blob/master/www/js/test.js#L22-L58 I comment that out when running on my local system. forgot to uncomment it.
Sometimes the polls pile up such that some are canceled. Perhaps we could call the poll only on response of the previous request?
-Robert