Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wait for Ctrl-D to finish to prevent filesystem reformat upon following Ctrl-C #49

Merged
merged 1 commit into from
Mar 2, 2023

Conversation

connorcl
Copy link

@connorcl connorcl commented Mar 1, 2023

This PR contains a small change to ensure that when rebooting a Pico board with Ctrl-D before running a Python file, the extension waits until the board has rebooted before issuing a subsequent Ctrl-C. This prevents the filesystem on the Pico board being erased in response to its boot process being interrupted, as per this issue and this PR (both in the MicroPython project).

This addresses this issue in the Pico-W-Go extension.

Currently, this change has been tested on Ubuntu 22.04 and VS code 1.75.1.

@DavidEGrayson
Copy link

DavidEGrayson commented Mar 1, 2023

Hi, I'm not a user of this project, but I'd just like to chime in that in my experience with MicroPython on the Pico, it is not necessary to send Ctrl+C at all after doing a soft reboot, as there will not be any Python code executing at that time. (main.py does not run after doing a soft reboot sequence of Ctrl+C Ctrl+A Ctrl+D.)

@paulober
Copy link
Owner

paulober commented Mar 2, 2023

Thanks for taking the time to fix this issue. Should also fix #50, am I wrong?

@connorcl
Copy link
Author

connorcl commented Mar 2, 2023

Thanks for taking the time to fix this issue. Should also fix #50, am I wrong?

Yes I think you're right, it does look like that issue refers to the same problem

@paulober
Copy link
Owner

paulober commented Mar 2, 2023

@DavidEGrayson main.py and boot.py get indeed executed after a soft-reset. See documentation/forum...

Copy link
Owner

@paulober paulober left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixes #46, #50

@paulober paulober merged commit d84537b into paulober:main Mar 2, 2023
@DavidEGrayson
Copy link

DavidEGrayson commented Mar 2, 2023

I was just testing it today, and the soft reboot runs main.py if you do it from the interactive/friendly REPL with the >>> prompt, but not if you do it from the raw REPL with the > prompt. In the sequence I gave (Ctrl+C Ctrl+A Ctrl+D), the Ctrl+A puts you into raw REPL mode.

Looks like this is by design:

https://github.com/micropython/micropython/blob/2bcd88d/ports/rp2/main.c#L189

@paulober
Copy link
Owner

paulober commented Mar 2, 2023

@DavidEGrayson Sorry missed that one. But the extension does not go into raw REPL mode before making a soft-reboot. But good to know so maybe putting it in raw REPL before whould remove some komplexety

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants