MicroPython在安全模式和出厂重置文件系统下的系统修复问题

7. Safe mode and factory reset

If something goes wrong with your pyboard, don’t panic! It is almost impossible for you to break the pyboard by programming the wrong thing.

The first thing to try is to enter safe mode: this temporarily skips execution of boot.py and main.pyand gives default USB settings.

If you have problems with the filesystem you can do a factory reset, which restores the filesystem to its original state.

7.1. Safe mode

To enter safe mode, do the following steps:

  1. Connect the pyboard to USB so it powers up.
  2. Hold down the USR switch.
  3. While still holding down USR, press and release the RST switch.
  4. The LEDs will then cycle green to orange to green+orange and back again.
  5. Keep holding down USR until only the orange LED is lit, and then let go of the USR switch.
  6. The orange LED should flash quickly 4 times, and then turn off.
  7. You are now in safe mode.

In safe mode, the boot.py and main.py files are not executed, and so the pyboard boots up with default settings. This means you now have access to the filesystem (the USB drive should appear), and you can edit boot.py and main.py to fix any problems.

Entering safe mode is temporary, and does not make any changes to the files on the pyboard.

7.2. Factory reset the filesystem

If you pyboard’s filesystem gets corrupted (for example, you forgot to eject/unmount it), or you have some code in boot.py or main.py which you can’t escape from, then you can reset the filesystem.

Resetting the filesystem deletes all files on the internal pyboard storage (not the SD card), and restores the files boot.pymain.pyREADME.txt and pybcdc.inf back to their original state.

To do a factory reset of the filesystem you follow a similar procedure as you did to enter safe mode, but release USR on green+orange:

  1. Connect the pyboard to USB so it powers up.
  2. Hold down the USR switch.
  3. While still holding down USR, press and release the RST switch.
  4. The LEDs will then cycle green to orange to green+orange and back again.
  5. Keep holding down USR until both the green and orange LEDs are lit, and then let go of the USR switch.
  6. The green and orange LEDs should flash quickly 4 times.
  7. The red LED will turn on (so red, green and orange are now on).
  8. The pyboard is now resetting the filesystem (this takes a few seconds).
  9. The LEDs all turn off.
  10. You now have a reset filesystem, and are in safe mode.
  11. Press and release the RST switch to boot normally.

7.安全模式和出厂重置

如果你的黑板出了问题,不要惊慌!通过编写错误的东西来破坏pyboard几乎是不可能的。

首先要尝试的是进入安全模式:这暂时跳过执行boot.pymain.py和给出默认的USB设置。

如果您在文件系统上遇到问题,则可以执行恢复出厂设置,将文件系统恢复到原始状态。

7.1。安全模式

要进入安全模式,请执行以下步骤:

  1. 将黑板连接到USB,以便启动。
  2. 按住USR开关。
  3. 在按住USR的同时,按下并释放RST开关。
  4. 然后,LED将以绿色循环至橙色至绿色+橙色,然后再次返回。
  5. 继续按住USR直到只有橙色LED亮起,然后松开USR开关。
  6. 橙色LED应快速闪烁4次,然后熄灭。
  7. 你现在处于安全模式。

在安全模式下,文件boot.pymain.py文件不会执行,所以pyboard启动默认设置。这意味着您现在可以访问文件系统(应该显示USB驱动器),您可以编辑boot.py 和main.py修复任何问题。

进入安全模式是暂时的,并且不会对pyboard上的文件进行任何更改。

7.2。出厂重置文件系统

如果你的pyboard的文件系统被损坏(例如,你忘记弹出/卸载它),或者你有一些代码boot.py或者main.py你不能逃避,那么你可以重置文件系统。

重置文件系统删除的内部pyboard存储(不是SD卡)的所有文件,并恢复文件boot.pymain.pyREADME.txt 并pybcdc.inf返回到原来的状态。

要执行文件系统的出厂重置,请按照与进入安全模式相似的步骤进行操作,但以绿色+橙色释放USR:

  1. 将黑板连接到USB,以便启动。
  2. 按住USR开关。
  3. 在按住USR的同时,按下并释放RST开关。
  4. 然后,LED将以绿色循环至橙色至绿色+橙色,然后再次返回。
  5. 继续按住USR,直到绿色和橙色指示灯亮起,然后松开USR开关。
  6. 绿色和橙色LED应快速闪烁4次。
  7. 红色LED将亮起(红色,绿色和橙色现在亮起)。
  8. pyboard现在重置文件系统(这需要几秒钟)。
  9. LED全部熄灭。
  10. 您现在有一个重置文件系统,并处于安全模式。
  11. 按下并释放RST开关以正常启动。

  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值