Skip to content

馃悰 Don't watchdog-reset during ESP3D commands - #28739

Merged
thinkyhead merged 1 commit into
MarlinFirmware:bugfix-2.1.xfrom
ellensp:fix-esp3d-command-watchdog
Oct 23, 2026
Merged

thinkyhead merged 1 commit into
MarlinFirmware:bugfix-2.1.xfrom
ellensp:fix-esp3d-command-watchdog

Conversation

@ellensp

@ellensp ellensp commented Oct 23, 2026

Copy link
Copy Markdown
Contributor

Description

Follow-up to #28725, which made USE_WATCHDOG subscribe Marlin's loop task to the ESP32 Task Watchdog (4 s, or 8 s with WATCHDOG_DURATION_8S).

With ESP3D_WIFISUPPORT and WIFI_CUSTOM_COMMAND, an [ESP鈥 command sent over serial is handled by esp3dlib.parse(), called from wifi_custom_command() in Marlin's loop task. ESP3D runs the whole command before it returns, and it can't refresh Marlin's watchdog. Some commands take longer than the timeout, so the watchdog resets the board partway through. [ESP410] (WiFi scan) takes about 6 s on an MKS TinyBee, and [ESP710]FORMAT (format the file system) takes longer.

wifi_custom_command() now removes the loop task from the Task Watchdog while ESP3D handles the command, and adds it back afterwards. The esp_task_wdt.h include moves to the top of HAL.cpp so it covers USE_WATCHDOG as well as USE_ESP32_TASK_WDT.

Requirements

An ESP32 board with ESP3D_WIFISUPPORT, WIFI_CUSTOM_COMMAND and USE_WATCHDOG (enabled by default).

Benefits

[ESP鈥 commands that take longer than the watchdog timeout no longer reset the board.

Tested on an MKS TinyBee (mks_tinybee, ESP3DLib 1.0) with ESP3D_WIFISUPPORT and WIFI_CUSTOM_COMMAND, sending [ESP410] over serial:

Firmware [ESP410]
bugfix-2.1.x task_wdt: Task watchdog got triggered ... loopTask, reboot at 4.0 s
This PR access point list and ok after 6.4 s, twice in a row

After those commands, a temporary test command that blocks without refreshing the watchdog still triggers it on loopTask at 4.0 s, so the loop task is watched again once ESP3D returns.

Builds: mks_tinybee config-01, mks_tinybee with ESP3D and USE_WATCHDOG disabled, and esp32 config-01 (WIFISUPPORT).

Configurations

buildroot/tests/mks_tinybee/config-01.ini, plus WIFI_CUSTOM_COMMAND to send [ESP鈥 commands over serial.

Related Issues

Follow-up to #28725.

Since MarlinFirmware#28725 the Task Watchdog watches Marlin's loop task. An [ESP...]
command from the host runs in that task through esp3dlib.parse(), and
ESP3D can't refresh the watchdog, so a command that takes longer than
the timeout, like an [ESP410] WiFi scan, resets the board.

Take the loop task off the watchdog while ESP3D handles the command,
and put it back afterwards.
@thinkyhead
thinkyhead merged commit 4619379 into MarlinFirmware:bugfix-2.1.x Oct 23, 2026
78 checks passed
@ellensp
ellensp deleted the fix-esp3d-command-watchdog branch October 23, 2026 17:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants