I just coding micropython useing Timer function
Try to Stop/Restart backend (Ctrl+F2) then Interrupt execution (Ctrl+C)
but its look like Timer function not stop running
device can't save or do anything
IDE warning
"Device is Busy - can't perform this action now. Please wait or cancel current work and try again!
Thanks
can't stop Timer in Thonny
Re: can't stop Timer in Thonny
Which board are you using?
There's a problem with MicroPython 1.17 on Raspberry Pi Pico/RP2040 that makes MicroPython scripts hard to stop sometimes.
There's a problem with MicroPython 1.17 on Raspberry Pi Pico/RP2040 that makes MicroPython scripts hard to stop sometimes.
Re: can't stop Timer in Thonny
I used esp32, micropython 1.17, thonny 3.3.13
- aivarannamaa
- Posts: 171
- Joined: Fri Sep 22, 2017 3:19 pm
- Location: Estonia
- Contact:
Re: can't stop Timer in Thonny
I thought Ctrl+C is only supposed to interrupt the main thread, not timers nor disable the irq-s. Can someone confirm the opposite?
Aivar Annamaa
https://thonny.org
https://thonny.org
Re: can't stop Timer in Thonny
That‘s indeed the case. CTRL-C raises a Keyboard interrupt exception, unless that is disabled. CTRL-D causes a reboot, which should stop timers and other activities, like PWM.
- aivarannamaa
- Posts: 171
- Joined: Fri Sep 22, 2017 3:19 pm
- Location: Estonia
- Contact:
Re: can't stop Timer in Thonny
If you want to stop your timers with Ctrl+C, then wrap your code into a try and explicitly stop the timers (and disable irq-s) in the finally block.
Also, if you use threads, I would suggest joining them before returning to REPL, so that Thonny can execute its management commands without being confused by unexpected output. With some ports, a background thread interferes with using REPL even if it doesn't print anything (https://github.com/micropython/micropython/issues/6899).
Also, if you use threads, I would suggest joining them before returning to REPL, so that Thonny can execute its management commands without being confused by unexpected output. With some ports, a background thread interferes with using REPL even if it doesn't print anything (https://github.com/micropython/micropython/issues/6899).
Aivar Annamaa
https://thonny.org
https://thonny.org
-
- Posts: 144
- Joined: Mon Jul 25, 2022 9:45 pm
Re: can't stop Timer in Thonny
Example of how to disable irq-s?