Add posibility to run multiple JS scripts, background scripts, run script on start, task manager #1093
+1,611
−1,538
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Because of recent changes in loopOptions, which now include an infinite loop and no longer return to the main menu on every render, running JS scripts via serial commands doesn't work while idling in the main menu.
You now need to manually select any option in the menu to run a script.
To fix this, I'm planning to introduce a task manager to handle multiple tasks. Scripts are already running as RTOS tasks so it should be possible.
I'll provide API to run JS scripts from any core or task, so launching scripts from the serial interface or WebUI will work again.
Before we do this we need to remove any state from js functions, so we need to remove sprites and gifs vectors, and store them as pointers in duktape context, so there can be multiple duktape context(scripts).
Proposed Changes
runtime.toBackground()
,runtime.toForeground()
andruntime.isForeground()
to make possible to run scripts in background.Types of Changes
Bugfix, New Feature
User-Facing Change