Repository navigation
馃悰 Don't watchdog-reset during ESP3D commands - #28739
Merged
thinkyhead merged 1 commit intoOct 23, 2026
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Follow-up to #28725, which made
USE_WATCHDOGsubscribe Marlin's loop task to the ESP32 Task Watchdog (4 s, or 8 s withWATCHDOG_DURATION_8S).With
ESP3D_WIFISUPPORTandWIFI_CUSTOM_COMMAND, an[ESP鈥command sent over serial is handled byesp3dlib.parse(), called fromwifi_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. Theesp_task_wdt.hinclude moves to the top ofHAL.cppso it coversUSE_WATCHDOGas well asUSE_ESP32_TASK_WDT.Requirements
An ESP32 board with
ESP3D_WIFISUPPORT,WIFI_CUSTOM_COMMANDandUSE_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) withESP3D_WIFISUPPORTandWIFI_CUSTOM_COMMAND, sending[ESP410]over serial:[ESP410]task_wdt: Task watchdog got triggered ... loopTask, reboot at 4.0 sokafter 6.4 s, twice in a rowAfter those commands, a temporary test command that blocks without refreshing the watchdog still triggers it on
loopTaskat 4.0 s, so the loop task is watched again once ESP3D returns.Builds:
mks_tinybeeconfig-01,mks_tinybeewith ESP3D andUSE_WATCHDOGdisabled, andesp32config-01 (WIFISUPPORT).Configurations
buildroot/tests/mks_tinybee/config-01.ini, plusWIFI_CUSTOM_COMMANDto send[ESP鈥commands over serial.Related Issues
Follow-up to #28725.