Commit Graph

17 Commits

Author SHA1 Message Date
Yaya-Cout
a0583aa2a9 [python] Prevent waiting for 2^32 ms if user entered a negative delay
This is due to a missing check in the interruptible sleep function which was not
checking if the delay was negative, then was passed to the
Ion::Timing::usleep function, who only takes signed values
2023-09-28 20:38:40 +02:00
Gabriel Ozouf
7dcf1662b0 [python/helpers] Change interrupt check delay
Keyboard interruption used to be checked once every 20000 calls to
micropython_port_vm_hook_loop. However, if costly functions were
executed in between calls to this method, the delay for activating
interruptions would increase.
Now, keyboard interruption is checked after a fixed amount of time has
passed. This way, if the process waits a long time between two calls
to micropython_port_vm_hook_loop, it is still interrupted in a timely
manner.

Change-Id: I37ca3bd4a996fa086078f504340dd857526e356a
2020-08-31 15:32:02 +02:00
Léa Saviot
3dcb40b5d4 [apps/code] Do not call interrupt in printText 2020-02-12 15:13:22 +01:00
Léa Saviot
f47f1f0543 [apps/code] Refresh view in printText 2020-02-12 15:13:22 +01:00
Émilie Feral
59b6dbd74e [python] micropython_port_interruptible_msleep should always call micropython_port_interrupt_if_needed even if the delay is small 2019-12-04 11:27:32 +01:00
Léa Saviot
577e7db8dd [python/port] Use msleep (not millis) in micropython_port_interruptible_msleep 2019-10-15 16:06:34 +02:00
Léa Saviot
03bb81215e [python/urandom] Use Ion::random to seed urandom 2019-04-17 11:46:01 +02:00
Léa Saviot
1e78f20ac1 [python] Return after interruption in possibly long turtle methods
forward(100) with speed = 3 can now be interrupted.
2018-12-06 11:48:42 +01:00
Léa Saviot
49e8a501e7 [python] Fix micropython_port_interruptible_msleep
It now gets interrupted. Turtle drawing can now be interrupted too.
2018-12-05 17:41:16 +01:00
Romain Goyet
253c183963 [python] Clean the time module
- Export micropython_port_should_interrupt and
micropython_port_interruptible_msleep in Emscripten
- Make micropython_port_interruptible_msleep available in a helper
2018-11-16 09:40:53 +01:00
Romain Goyet
e73033b19c Merge branch 'master' into utime_module 2018-11-15 14:37:11 +01:00
Romain Goyet
d7a13ba8fd Revert to micropython_port_should_interrupt 2018-11-14 16:57:16 +01:00
Léa Saviot
f052bd9088 [python/port] Clean some code 2018-11-13 10:06:23 +01:00
Romain Goyet
5dfefb477a [python] Rename micropython_port_should_interrupt to micropython_port_vm_hook_loop 2018-11-13 10:06:23 +01:00
Damien Nicolet
f93bf97182 [ion] Sharing millis & micros for blackbox and simulator 2018-11-09 01:30:22 +01:00
Damien Nicolet
79bfc7f112 [code] time module 2018-11-09 01:30:22 +01:00
Romain Goyet
8aef4d996c [python] Restore the should_interrupt routine 2018-04-11 10:27:18 +02:00