Great Lesson, don't mess up with main.py

RP2040 based microcontroller boards running MicroPython.
Target audience: MicroPython users with an RP2040 boards.
This does not include conventional Linux-based Raspberry Pi boards.
Post Reply
fishjoe
Posts: 7
Joined: Wed Aug 24, 2022 9:25 am
Location: Chrischurch

Great Lesson, don't mess up with main.py

Post by fishjoe » Sat Oct 08, 2022 9:38 am

I'm trying to add function in main.py to do something.

Accidentally, I put machine.reset() right under if __name__ == "__main__":

instant brick...... its repaired, but all works on the pico w were lost. :twisted: :twisted: :twisted: :twisted:

great lesson.

1. be very careful on running main.py
2. backup files.

acute
Posts: 6
Joined: Sat Jan 23, 2021 10:59 pm

Re: Great Lesson, don't mess up with main.py

Post by acute » Sat Oct 08, 2022 11:03 am

Would totally recommend including a safety override — like a killswitch to stop execution, or an emergency inhibitor checked once every startup.
And yes, save all your work (preferably version it up) somewhere else every time.

User avatar
scruss
Posts: 360
Joined: Sat Aug 12, 2017 2:27 pm
Location: Toronto, Canada
Contact:

Re: Great Lesson, don't mess up with main.py

Post by scruss » Sat Oct 08, 2022 6:26 pm

Please use Github Discussions - this site is no longer read by people who know what they're doing.

There's no substitute for backups, but MicroPython_RenameMainDotPy.uf2 can often get your files back

Rissy
Posts: 116
Joined: Sun Aug 14, 2022 8:15 am

Re: Great Lesson, don't mess up with main.py

Post by Rissy » Mon Nov 14, 2022 1:33 pm

scruss wrote:
Sat Oct 08, 2022 6:26 pm
Please use Github Discussions - this site is no longer read by people who know what they're doing.
I don't much like the format of github for discussions of subjects. There doesn't seem to be a familiar "thread" or "topic" layout which is easy to follow. Instead, to me, it looks more like a free-for-all random approach. A bit like Facebook, but much less organised and intuitive.

I guess it could be a case of an old dog having to learn new tricks. Resistant at first, but forced to adapt.......eventually. :lol:
scruss wrote:
Sat Oct 08, 2022 6:26 pm
There's no substitute for backups, but MicroPython_RenameMainDotPy.uf2 can often get your files back
ooh, i'll have to check this out.

I thought i'd bricked my Pico W in a very similar way last week. My only solution was to re-uf2 it, first with flash_nuke, then rebuild it. I never lost anything because I always have my laptop file copies in sync with what's on the Pico. Plus. An additional "superseded" folder containing archives in case i lose the plot and need to go back to a previous revision. Basic housekeeping and redundancy stuff this.

DeaD_EyE
Posts: 19
Joined: Sun Jul 17, 2022 12:57 pm
Contact:

Re: Great Lesson, don't mess up with main.py

Post by DeaD_EyE » Mon Nov 14, 2022 3:41 pm

Rissy wrote:
Mon Nov 14, 2022 1:33 pm
I don't much like the format of github for discussions of subjects. There doesn't seem to be a familiar "thread" or "topic" layout which is easy to follow. Instead, to me, it looks more like a free-for-all random approach. A bit like Facebook, but much less organised and intuitive.
Here is a user, who has used since year 2000 phpBB2, phpBB3, woltlab and vBulletin.
The user experience on Git-Hub-Discussions is in my opinion more than worse.
It is a little bit better as Facebook and Reddit, but not like real boards.

@ontopic
Depending on the board, you have the option to activate the boot mode.

RP2: Hold boot mode when connecting
Then use the image that erases the flash.

ESP32: Hold the boot button, press the reset button and then release the boot button.

Use the esptool.py to delete the flash.

Post Reply