micropython/tools/mpremote/mpremote
Damien George d92694c3e8 tools: Only issue a single Ctrl-C when entering raw REPL.
A long time ago when there was only the `stm` port, Ctrl-C would trigger a
preemptive NLR jump to break out of running code.  Then in commit
124df6f8d0 a more general approach to
asynchronous `KeyboardInterrupt` exceptions was implemented, and `stmhal`
supported both approaches, with the general (soft) interrupt taking
priority.

Then in commit bc1488a05f `pyboard.py` was
updated with a corresponding change to make it issue a double Ctrl-C to
break out of any existing code when entering the raw REPL (two Ctrl-C
characters were sent in order to more reliably trigger the preemptive NLR
jump).

No other port has preemptive NLR jumps and so a double Ctrl-C doesn't
really behave any differently to a single Ctrl-C: with USB CDC the double
Ctrl-C would most likely be in the same USB packet and so processed in the
same low-level USB callback, so it's just setting the keyboard interrupt
flag twice in a row.  The VM/runtime then just sees one keyboard interrupt
and acts as though only one Ctrl-C was sent.

This commit changes the double Ctrl-C to a single Ctrl-C in `pyboard.py`
and `mpremote`.  That keeps things as simple as they need to be.

Signed-off-by: Damien George <damien@micropython.org>
2024-10-15 11:40:08 +11:00
..
__init__.py tools/mpremote: Use hatch to build mpremote package. 2023-02-24 11:40:22 +11:00
__main__.py tools/mpremote: Allow running mpremote with python -m. 2022-03-30 15:29:26 +11:00
commands.py tools/mpremote: Add option to force copy. 2024-10-09 16:39:06 +11:00
console.py all: Fix cases of Python variable assigned but never used. 2023-05-02 16:36:05 +10:00
main.py tools/mpremote: Add option to force copy. 2024-10-09 16:39:06 +11:00
mip.py tools/mpremote: Make filesystem commands use transport API. 2024-10-09 16:12:30 +11:00
repl.py tools/mpremote: Detach mpremote from pyboard.py. 2023-06-02 17:42:13 +10:00
transport_serial.py tools: Only issue a single Ctrl-C when entering raw REPL. 2024-10-15 11:40:08 +11:00
transport.py tools/mpremote: Improve error output. 2024-10-09 16:38:08 +11:00