[英]Recommended way to break out of a Watchdog Timer (WDT) supported main loop
I need to include hardware WDTs on both ESP32 and rp Pico based systems running micropython.我需要在运行 micropython 的基于 ESP32 和 rp Pico 的系统上包含硬件 WDT。 I am using the Thonny IDE and with an 8s timeout on the Pico I can interrupt (Cntrl-C) the system and quickly delete the main from the board.我正在使用 Thonny IDE,在 Pico 上有 8 秒超时,我可以中断 (Cntrl-C) 系统并快速从电路板上删除主电路。 This then allows me to continue development of the code.这让我可以继续开发代码。 This approach works with an 8s timeout but if I was working with much shorter delays I am not so sure that it would.这种方法适用于 8 秒的超时,但如果我使用更短的延迟,我不太确定它是否会。 My concern is getting stuck with a main.py I can't change?我担心的是我无法更改的 main.py 卡住了? Is there a better way anyone can recommend to handle this.有没有任何人可以推荐的更好的方法来处理这个问题。
Harry哈利
PS: Relative beginner with Python. The more I know, the more I know I don't! PS:相对初学者Python,越知道越不知道!
What works for me: add time.sleep() for 5 seconds in the beginning of your code where you can kill script from Thonny using CTRL+C before WDT has been initiated.对我有用的是:在代码开头添加 time.sleep() 5 秒,您可以在启动 WDT 之前使用 CTRL+C 从 Thonny 中终止脚本。 This way you dont need to delete file manually from board, you just stop it's execution before WDT这样你就不需要从板上手动删除文件,你只需在 WDT 之前停止它的执行
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.