10000 docs: Move ESP32 specific WDT to esp32/quickref · micropython/micropython@1010243 · GitHub
[go: up one dir, main page]

Skip to content

Commit 1010243

Browse files
committed
docs: Move ESP32 specific WDT to esp32/quickref
1 parent b214280 commit 1010243

File tree

2 files changed

+34
-30
lines changed

2 files changed

+34
-30
lines changed

docs/esp32/quickref.rst

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -425,6 +425,34 @@ See :ref:`machine.WDT <machine.WDT>`. ::
425425
wdt = WDT(timeout=5000) # timeout in milliseconds
426426
wdt.feed()
427427

428+
429+
When the WDT timeout is short, there is a software update issue:
430+
you don't have enough time to copy the updates to the device.
431+
ESP32 alows reinitialise the watchdog with a longer timeout – like an hour.
432+
433+
More comprehansive example usage::
434+
435+
# main.py # starts automatically after boot.py
436+
import sys
437+
from machine import WDT
438+
439+
wdt = WDT(timeout=5000) # 5s
440+
441+
while True: # infinite work loop
442+
# do something useful in less than 5 seconds
443+
444+
# 1/0 # uncoment this line to raise an runtime exception, then WDT reboot
445+
446+
# while True: # uncomment three lines to simulate program deadlock, then WDT reboot
447+
# print('Wait for WDT reboot')
448+
# sleep_ms(1000)
449+
450+
wdt.feed() # all right
451+
452+
if False: # replace False with True to terminate the program
453+
wdt = WDT(timeout=1000 * 60 * 60) # 1 hour before WDT reboot
454+
sys.exit(0) # will enter to REPL(WebREPL)
455+
428456
Deep-sleep mode
429457
---------------
430458

docs/library/machine.WDT.rst

Lines changed: 6 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -5,43 +5,19 @@ class WDT -- watchdog timer
55
===========================
66

77
The WDT is used to restart the system when the application crashes and ends
8-
up into a non recoverable state. Once started it cannot be stopped
9-
in any way. After enabling, the application must "feed" the
8+
up into a non recoverable state. Once started it cannot be stopped or
9+
reconfigured in any way. After enabling, the application must "feed" the
1010
watchdog periodically to prevent it from expiring and resetting the system.
1111

1212
Example usage::
1313

1414
from machine import WDT
1515< 8000 /td>
wdt = WDT(timeout=2000) # enable it with a timeout of 2s
16-
wdt.feed()
16+
while True:
17+
# do something useful in less than 2 seconds
1718

18-
19-
When the WDT timeout is short, there is a software update issue:
20-
you don't have enough time to copy the updates to the device.
21-
You may reinitialise the watchdog with a longer timeout – like an hour.
22-
23-
More comprehansive example usage::
24-
25-
# main.py # starts automatically after boot.py
26-
import sys
27-
from machine import WDT
28-
29-
wdt = WDT(timeout=5000) # 5s
30-
31-
while True: # infinite work loop
32-
# do something useful in less than 5 seconds
33-
34-
# 1/0 # uncoment this line to raise an runtime exception, then WDT reboot
35-
36-
# while True: # uncomment three lines to simulate program deadlock, then WDT reboot
37-
# print('Wait for WDT reboot')
38-
# sleep_ms(1000)
39-
40-
wdt.feed() # all right
41-
42-
if False: # replace False with True to terminate the program
43-
wdt = WDT(timeout=1000 * 60 * 60) # 1 hour before WDT reboot
44-
sys.exit(0) # will enter to REPL(WebREPL)
19+
if verify_that_everything_is_functioning_correctly():
20+
wdt.feed()
4521

4622
Availability of this class: pyboard, WiPy, esp8266, esp32.
4723

0 commit comments

Comments
 (0)
0