Skip to content

Commit

Permalink
[apps/code] Remove interruption check
Browse files Browse the repository at this point in the history
A check for interruption in ConsoleController::printText caused script
to immediately stop when launched after an interrupted script.
This check was used to break out of infinite print loop, but now
becomes redundant with how micropython_port_vm_hook_loop was changed.

Change-Id: Ifa8d415e1b2c2406ad67300eb14ce46889af296f
  • Loading branch information
GabrielNumworks authored and LeaNumworks committed Aug 31, 2020
1 parent 7dcf166 commit b7c7695
Showing 1 changed file with 0 additions and 20 deletions.
20 changes: 0 additions & 20 deletions apps/code/console_controller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -450,26 +450,6 @@ void ConsoleController::printText(const char * text, size_t length) {
flushOutputAccumulationBufferToStore();
micropython_port_vm_hook_refresh_print();
}
#if __EMSCRIPTEN__
/* If we called micropython_port_interrupt_if_needed here, we would need to
* put in the WHITELIST all the methods that call
* ConsoleController::printText, which means all the MicroPython methods that
* call print... This is a lot of work + might reduce the performance as
* emterpreted code is slower.
*
* We thus do not allow print interruption on the web simulator. It would be
* better to allow it, but the biggest problem was on the device anyways
* -> It is much quicker to interrupt Python on the web simulator than on the
* device.
*
* TODO: Allow print interrpution on emscripten -> maybe by using WASM=1 ? */
#else
/* micropython_port_vm_hook_loop is not enough to detect user interruptions,
* because it calls micropython_port_interrupt_if_needed every 20000
* operations, and a print operation is quite long. We thus explicitely call
* micropython_port_interrupt_if_needed here. */
micropython_port_interrupt_if_needed();
#endif
}

void ConsoleController::autoImportScript(Script script, bool force) {
Expand Down

0 comments on commit b7c7695

Please sign in to comment.