Commit Graph

51 Commits

Author SHA1 Message Date
Émilie Feral
5a32006dcd [python] Revert: collectRoots does not need to look for unaligned
pointers as they should not exist
2020-05-18 14:39:46 +02:00
Émilie Feral
3f5487ca90 [python] Forbid inlining on gc_collect to avoid missing some roots 2020-05-18 14:39:46 +02:00
Émilie Feral
4bca330f0d [python] Coding style 2020-04-30 14:12:32 +02:00
Émilie Feral
0811221943 [python] Clean port ColorParser 2020-04-30 14:12:32 +02:00
Émilie Feral
7c24f2fc28 [python] Coding style 2020-04-30 14:12:32 +02:00
Émilie Feral
1b0b9e48f5 [python] ColorParser: add a TODO 2020-04-30 14:12:32 +02:00
Émilie Feral
8f5fa50f22 [python] Color: avoid magic number 255, clean code of ColorParser and
Turtle::colormode
2020-04-30 14:12:32 +02:00
Émilie Feral
c920df1f76 [python] Change enum class name: ColorModes --> ColorMode 2020-04-30 14:12:32 +02:00
Émilie Feral
995cc04533 [python] Use of mp_obj_is_str instead of MP_OBJ_IS_STR for more
consistency
2020-04-30 14:12:32 +02:00
Émilie Feral
a564efcaa5 [python] Fix bug in ParseColor 2020-04-30 14:12:32 +02:00
Émilie Feral
f5e8d4d9bb [python] Avoid modifying micropython external source, use parsenum.h methods directly 2020-04-30 14:12:32 +02:00
Joachim LF
e76abcf67e [Python] universal colors 2020-04-30 14:12:32 +02:00
Émilie Feral
7df8c2935a [python] upgrade to micropython 1.12 2020-04-07 11:28:32 +02:00
Émilie Feral
2738d30684 [python] test: check wether script execution lead to a Python error 2020-04-01 16:39:59 +02:00
Émilie Feral
574eacb69c [python] matplotlib: flush heap memory when any error is raised 2020-04-01 10:18:09 +02:00
Émilie Feral
61e7ec52e6 [python] matplotlib: make pyplot a submodule of matplotlib 2020-04-01 10:18:09 +02:00
Émilie Feral
fb3f6ab6f3 [apps/code][python] ConsoleController doesn't keep any pointer/boolean to know
if the sandbox/matplotlib view controller is displayed. Its state won't be
always right; instead, use the StackViewController depth.

This fixes the following bug: when popping the sandbox/matplotlib view
controller, the first responder token was not given to the console
controller!
2020-04-01 10:18:09 +02:00
Émilie Feral
659da1dff8 [apps][python] ExecutionEnvironment handles hide sand display of sandbox
and plot controller the same way
2020-04-01 10:18:08 +02:00
Romain Goyet
6a796f5f7c [python] Add an "axis" function to the matplotlib module 2020-04-01 10:18:08 +02:00
Léa Saviot
0d8cb0123b [python/port] Fix user interruption char set up
print can be user interrupted, so the interruption char needs to be
set for the whole runCode method
2020-02-20 11:43:31 +01:00
Émilie Feral
18b4514412 [python] port: add a comment abouth how we use setjmp 2020-02-12 15:13:24 +01:00
Émilie Feral
de74aa7e59 [python] Enable PYSTACK for emscripten platform: this "fixes" bug
probably due to gc_collect (we suspect that transpiled C does not have
access to javascript variables preventing it from collecting all
required roots and leading to deleting objects prematuraly). Enabling
PyStack reduces the use of the heap and fixes the bug.
2020-02-12 15:13:24 +01:00
Émilie Feral
58acedfd34 [python] Test: inline code to avoid changing runCode behaviour 2020-02-12 15:13:24 +01:00
Léa Saviot
86bd4be03e [python/port] Fix gc_collect_root on emscripten
Any data access should be aligned.
2020-02-12 15:13:22 +01:00
Émilie Feral
37061b9cb5 [python] Fix gc_collect to be sure to get unaligned pointers 2020-02-12 15:13:16 +01:00
Émilie Feral
4b58efbc0a [python] Fix stack boundary on the device 2020-02-12 15:13:16 +01:00
Émilie Feral
d1e93a2918 [python] Python stack: fix limit 2020-02-12 15:13:16 +01:00
Léa Saviot
a450ce3855 Merge branch 'master' into f7 2019-08-06 17:40:14 +02:00
Léa Saviot
95403c8a91 [python/port] Increase stack limit on emscripten, simulator...
The value is quite arbitrary, we just do not want to outperfom the
device but still provide more recursion depth.
2019-06-25 08:37:47 -04:00
Émilie Feral
d07b3382e9 Merge branch 'master' into f7 2019-06-14 13:38:02 -04:00
Émilie Feral
b485319e76 [python] Clean gc_collect and comment to explain potential address
sanitize error
2019-06-14 13:37:11 -04:00
Émilie Feral
694fa34315 [ion] Keyboard: change keys name to more explicit ones 2019-04-12 16:56:57 +02:00
Léa Saviot
fdc02ee5e1 [python/port] Fix size of gc collection 2019-01-21 14:23:38 +01:00
Léa Saviot
835c112f2f [python/port] Clean gc_collect 2019-01-21 14:23:38 +01:00
Léa Saviot
4b306791c0 [python/turtle] Turtle::m_drawn is false if sandbox not displayed
This way, Turtle::draw() and erase() are more symetrical and no not
perform themselves if the turtle is already drawn / erased.
2018-12-18 12:05:46 +01:00
Romain Goyet
5748521876 [python/turtle] Try to play well with uPy's GC 2018-11-16 18:33:41 +01:00
Romain Goyet
a9091c933b [python/turtle] Use a Turtle class 2018-11-16 15:31:31 +01:00
Romain Goyet
22a39a2fd6 [python/turtle] Use a dedicated folder 2018-11-16 10:31:16 +01:00
Jean-Baptiste Boric
464c1a5c95 [python] Initial turtle module 2018-10-27 14:24:36 +02:00
Émilie Feral
317e1f0389 [code] Enable interrupting an infinite input() loop when clicking on home 2018-06-12 16:52:12 +02:00
Léa Saviot
1d21b4ed9e [python] Remove un-necessary dependencies.
Change-Id: Ib3542c364ae8f670372cc848f6b59d7c7364817d
2018-04-09 10:50:51 +02:00
Romain Goyet
fd7516f8ac [python] "input" now displays the provided prompt 2018-02-01 14:10:26 +01:00
Romain Goyet
651d5715e4 [python] Adding mp_hal_input 2018-02-01 14:10:26 +01:00
Léa Saviot
1ce6f36651 [code] Fixed the wait for user input after drawing using Python.
A SandboxController is now pushed on the StackViewController and sets the
KDIonContext::sharedContext before drawing, sets a white background and handles
user input after the Python computation to dismiss the drawing screen.

Change-Id: I51b0474365a85e845227379a16d090541fa8ded7
2017-12-01 13:19:28 +01:00
Léa Saviot
9a9ccc7a8c [python] Fixed MicroPython emscripten bug.
Micropython did not work because of two problems:
 - the stack in ascending order on emscripten
 - if optimized, some variables may be stored in local JavaScript
variables, which breaks garbage collection.

Change-Id: Ib454e0c4d995e9f5f85370eea758526119b35773
2017-12-01 12:06:05 +01:00
Léa Saviot
805bdd1381 [python] Fixed infinite recursion bug.
When running a script with infinite recursion, micropython now throws an
error instead of aborting and rebooting the device.

Change-Id: Icd409e56de58a48b25b6bdb30eea1e70b344cc14
2017-12-01 12:06:05 +01:00
Léa Saviot
9d82804ff3 [code/emscripten] On emscripten, fixed waiting after a Python drawing.
The user can now push OK or Back to remove a Python drawing.

Change-Id: I293064a9458f8c0c6d0da5351500600fd9e82706
2017-12-01 12:06:05 +01:00
Léa Saviot
6ccd0c1c55 [python] Fixed the Python stack length computation.
On the device, the stack is stored in reverse order, but it might not be
the case on other platforms, which changes stack length computation.

Change-Id: I0218224a77465b9672f137771c00f734fdfaea64
2017-11-22 09:53:34 +01:00
Léa Saviot
a9f4da92c0 [code/python] Fixed the Kandinsky module in Python.
User can draw on the 320*220 drawing screen.

Change-Id: I25034b05f21aacc35608358fdb7a4d9924dd22e8
2017-11-21 17:12:38 +01:00
Léa Saviot
b73170b77b [code] Print errors in the Python console.
Change-Id: If3a096ee46105229b6c4c77906826e78666cdc11
2017-11-17 14:05:23 +01:00