mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-03-18 21:30:38 +01:00
[apps/code] Do not call interrupt in printText
This commit is contained in:
@@ -386,7 +386,6 @@ void ConsoleController::refreshPrintOutput() {
|
|||||||
/* printText is called by the Python machine.
|
/* printText is called by the Python machine.
|
||||||
* The text argument is not always null-terminated. */
|
* The text argument is not always null-terminated. */
|
||||||
void ConsoleController::printText(const char * text, size_t length) {
|
void ConsoleController::printText(const char * text, size_t length) {
|
||||||
micropython_port_vm_hook_loop_content();
|
|
||||||
size_t textCutIndex = firstNewLineCharIndex(text, length);
|
size_t textCutIndex = firstNewLineCharIndex(text, length);
|
||||||
if (textCutIndex >= length) {
|
if (textCutIndex >= length) {
|
||||||
/* If there is no new line in text, just append it to the output
|
/* If there is no new line in text, just append it to the output
|
||||||
@@ -406,6 +405,7 @@ void ConsoleController::printText(const char * text, size_t length) {
|
|||||||
assert(textCutIndex == length - 1);
|
assert(textCutIndex == length - 1);
|
||||||
appendTextToOutputAccumulationBuffer(text, length-1);
|
appendTextToOutputAccumulationBuffer(text, length-1);
|
||||||
flushOutputAccumulationBufferToStore();
|
flushOutputAccumulationBufferToStore();
|
||||||
|
micropython_port_vm_hook_refresh_print();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ConsoleController::autoImportScript(Script script, bool force) {
|
void ConsoleController::autoImportScript(Script script, bool force) {
|
||||||
|
|||||||
@@ -19,16 +19,16 @@ bool micropython_port_vm_hook_loop() {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return micropython_port_vm_hook_loop_content();
|
micropython_port_vm_hook_refresh_print();
|
||||||
}
|
|
||||||
|
|
||||||
bool micropython_port_vm_hook_loop_content() {
|
|
||||||
assert(MicroPython::ExecutionEnvironment::currentExecutionEnvironment() != nullptr);
|
|
||||||
MicroPython::ExecutionEnvironment::currentExecutionEnvironment()->refreshPrintOutput();
|
|
||||||
// Check if the user asked for an interruption from the keyboard
|
// Check if the user asked for an interruption from the keyboard
|
||||||
return micropython_port_interrupt_if_needed();
|
return micropython_port_interrupt_if_needed();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void micropython_port_vm_hook_refresh_print() {
|
||||||
|
assert(MicroPython::ExecutionEnvironment::currentExecutionEnvironment() != nullptr);
|
||||||
|
MicroPython::ExecutionEnvironment::currentExecutionEnvironment()->refreshPrintOutput();
|
||||||
|
}
|
||||||
|
|
||||||
bool micropython_port_interruptible_msleep(int32_t delay) {
|
bool micropython_port_interruptible_msleep(int32_t delay) {
|
||||||
assert(delay >= 0);
|
assert(delay >= 0);
|
||||||
/* We don't use millis because the systick drifts when changing the HCLK
|
/* We don't use millis because the systick drifts when changing the HCLK
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ extern "C" {
|
|||||||
|
|
||||||
// These methods return true if they have been interrupted
|
// These methods return true if they have been interrupted
|
||||||
bool micropython_port_vm_hook_loop();
|
bool micropython_port_vm_hook_loop();
|
||||||
bool micropython_port_vm_hook_loop_content();
|
void micropython_port_vm_hook_refresh_print();
|
||||||
bool micropython_port_interruptible_msleep(int32_t delay);
|
bool micropython_port_interruptible_msleep(int32_t delay);
|
||||||
bool micropython_port_interrupt_if_needed();
|
bool micropython_port_interrupt_if_needed();
|
||||||
int micropython_port_random();
|
int micropython_port_random();
|
||||||
|
|||||||
Reference in New Issue
Block a user