Yes, I think those changes would be ok. I think the idea with the emulator was that actually onConsoleOutput would just get replaced as needed, but I think adding consoleOutputCallback to the options is good.
the debugger will basically never work as-is. I'm not sure we even build it in (we shouldn't anyway). The issue is the emulator is single-threaded - it just executes and returns each time. But because the debugger has to stop execution in the middle the jsiIdle function doesn't return during debugger execution.
To make it work you'd have to swap to using the emulator in a web worker/similar which seems like a much larger task.
Right now we just feed the characters in one at a time and ask the emulator to go around it's idle loop once per character, and then hopefully during the call where \n is sent it executes and sends characters back
There seems to be a race condition somewhere that causes the result of the call (=undefined) and what is printed by the call to switch position.
I'm not sure I understand here... Do you think you could give an example of what's on the console when it happens?
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
Yes, I think those changes would be ok. I think the idea with the emulator was that actually
onConsoleOutput
would just get replaced as needed, but I think addingconsoleOutputCallback
to the options is good.the debugger will basically never work as-is. I'm not sure we even build it in (we shouldn't anyway). The issue is the emulator is single-threaded - it just executes and returns each time. But because the debugger has to stop execution in the middle the
jsiIdle
function doesn't return during debugger execution.To make it work you'd have to swap to using the emulator in a web worker/similar which seems like a much larger task.
Right now we just feed the characters in one at a time and ask the emulator to go around it's idle loop once per character, and then hopefully during the call where
\n
is sent it executes and sends characters backI'm not sure I understand here... Do you think you could give an example of what's on the console when it happens?