Repository navigation
Conversation
On USE_DUMMY_TFT builds the loop() that sets interpreter_state=2 is compiled out, so interpreterHandler blocks forever at 'while (interpreter_state != 2)' and no script ever runs. Promote the task to the running state directly on headless, where there is no foreground/ background display loop to do it. Fixes BruceDevices#3105
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
On USE_DUMMY_TFT builds the loop() that sets interpreter_state=2 is compiled out, so interpreterHandler blocks forever at 'while (interpreter_state != 2)' and no script ever runs. Promote the task to the running state directly on headless, where there is no foreground/background display loop to do it.
Fixes #3105
Proposed Changes
On headless (
USE_DUMMY_TFT) builds, the JS interpreter never executes a script.interpreterHandler()(src/modules/bjs_interpreter/interpreter.cpp) waits onwhile (interpreter_state != 2), but the only code that setsinterpreter_state = 2lives in the non-headlessloop()in src/main.cpp, which is compiled out underUSE_DUMMY_TFT. The headlessloop()never services it, so the task printsinit interpreterand then blocks forever — scripts never run, whether launched via the serialjscommand or the WebUI.This affects every headless env (
seeedstudio-xiao-esp32s3,esp32-s3-devkitc-1,esp32-s3-devkitc-1-psram), where JS is one of the few ways to drive the device.The fix marks the task as running directly on headless builds, since there is no foreground/background display loop to promote it. The task already allocates the engine, evals the script, and cleans up (
stopInterpreterTask()) independently ofloop(), so no other change is needed. Non-headless builds are untouched.Types of Changes
Bugfix. No API or behavior change on screen-based builds (guarded by
#if defined(USE_DUMMY_TFT)).Verification
On an ESP32-S3 (N16R8) headless build (
esp32-s3-devkitc-1-psram,USE_DUMMY_TFT=1):Before:
js /test.jsprintsinit interpreterthen hangs; the script body never runs and no files are written.After: a script runs to completion — serial shows
init interpreter→context created→deinit interpreter,storage.write(...)creates files on LittleFS, and a sub-GHz capture script sweeps frequencies and saves a.sub.Minimal repro script:
Further Comments
Root cause is a single missing state transition on headless. interpreter_state = 2 is assigned in exactly one place (the #if !defined(USE_DUMMY_TFT) loop()); the WebInterface does not touch it. Happy to adjust the approach if you'd prefer the headless loop() service interpreter_state instead of the task self-promoting.