Catching the IDE "stop" in uPython

Discussion related to "under the hood" OpenMV topics.
User avatar
petri
Posts: 15
Joined: Tue Jul 05, 2016 11:52 am
Location: Finland

Catching the IDE "stop" in uPython

Postby petri » Tue Aug 23, 2016 1:39 am

How does the IDE stop the running uPython program on the camera? Does it send some sort of signal for which a handler could be registered? Or does it reset the camera in a way that is outside of uPython control or what?

It would be useful to be able to catch the stop.

UPDATE: I noticed the serial terminal echoing something like "Exception: IDE interrupt" ... ?
User avatar
kwagyeman
Posts: 1407
Joined: Sun May 24, 2015 2:10 pm

Re: Catching the IDE "stop" in uPython

Postby kwagyeman » Tue Aug 23, 2016 9:35 am

It resets the scripts outside of uPython control. Anyway, we are about to do a release. Maybe Ibrahim can add something you need. Can you describe it?
Nyamekye,
User avatar
iabdalkader
Posts: 403
Joined: Sun May 24, 2015 3:53 pm

Re: Catching the IDE "stop" in uPython

Postby iabdalkader » Tue Aug 23, 2016 10:35 am

petri wrote:How does the IDE stop the running uPython program on the camera? Does it send some sort of signal for which a handler could be registered? Or does it reset the camera in a way that is outside of uPython control or what?

It would be useful to be able to catch the stop.

UPDATE: I noticed the serial terminal echoing something like "Exception: IDE interrupt" ... ?
The IDE sends a packet over USB/CDC to pend/raise an exception which interrupts uPython, and yes you can catch this exception and handle it, however the IDE won't be able to stop the script if you do, additionally, the handler disables the USB FS interrupt before raising this exception, and it's re-enabled before executing another script or REPL.

Return to “Technical Discussion”

Who is online

Users browsing this forum: No registered users and 2 guests