Repository navigation
Wanhao Duplicator 9: build again, Wanhao's factory settings and Y directions, power-loss recovery, endstop noise filter - #1205
Merged
thinkyhead merged 12 commits intoOct 14, 2026
Conversation
Le-Syl21
added a commit
to Le-Syl21/WANHAO-Duplicator-9
that referenced
this pull request
Sep 14, 2026
The site (docs/, GitHub Pages) helps owners identify their D9, download the right firmware and flash it, in English and French. The 24 .hex are rebuilt in one pass from Marlin bugfix-2.1.x and the configurations of MarlinFirmware/Configurations#1205, so standard and Y-inverted builds all come from the same sources. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01ENsGGxgZ7pU5Z87YfBS2iY
Le-Syl21
added a commit
to Le-Syl21/WANHAO-Duplicator-9
that referenced
this pull request
Sep 16, 2026
…r levelling - The head returns to the bed centre (Z up 10 mm) after G29, so the bed no longer hides the screen (EVENT_GCODE_AFTER_G29, also proposed in MarlinFirmware/Configurations#1205). Tested on an MK2 300. - BTT Smart Filament Sensor V2.0: motion signal on D9, next to the runout input D8 on the board's sensor plug (pin names from Wanhao's wiring diagram, found by dustovich). Off by default, 100 m default jam length so a plain runout switch cannot fake a jam; M412 S1 L10 + M500 to use it. Settings saved by v2.0.4 or earlier hold zero runout and motion lengths, so these builds load the defaults instead (one line in settings.cpp). - New Filament sensor page on the site with a wiring diagram (SVG, EN/FR). Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01ENsGGxgZ7pU5Z87YfBS2iY
thinkyhead
force-pushed
the
import-2.1.x
branch
3 times, most recently
from
October 3, 2026 16:21
6b04ca2 to
109c2b7
Compare
thinkyhead
force-pushed
the
import-2.1.x
branch
from
October 14, 2026 17:20
72fa3fa to
171c7dd
Compare
HOST_START_MENU_ITEM and HOST_SHUTDOWN_MENU_ITEM add entries to the MarlinUI menu, and the D9 runs a DGUS display, which has none. Since Marlin#28442 SanityCheck rejects them without MarlinUI, so none of the twelve D9 examples has built on bugfix-2.1.x since June.
The MK1 carries an inductive probe on Z_MIN, which pulls the pin low when it triggers. Wanhao's own MK1 firmware sets Z_MIN_ENDSTOP_INVERTING and Z_MIN_PROBE_ENDSTOP_INVERTING true, and Klipper's printer-wanhao-duplicator-9-2018.cfg reads it as !PH3 — both LOW, where these examples had HIGH. The probe offsets were the MK2's BLTouch ones. Use Klipper's MK1 values instead: x_offset 27, y_offset 3, z_offset 1.4.
The D9 board wires a power-fail detector to pin 63 (POWER_LOSS_PIN, POWER_LOSS_STATE LOW in pins_WANHAO_D9.h), and Wanhao's own firmware used it to resume prints after an outage. Enable POWER_LOSS_RECOVERY with PLR_ENABLED_DEFAULT to bring that back, and POWER_LOSS_PULLUP so a pin left unconnected reads "power present" instead of floating low and halting a print. Boots on a D9 MK2 300 with M413 S1.
The MK3 head upgrade moves the Y motor from the back of the frame to the
front, and Wanhao's MK3 firmware reverses the Y direction to match, as
an owner who upgraded a D9 300 describes on r/3Dprinting ("wanhao D9
300 MK3"). The MK3 examples were copied from the MK2 and kept its
INVERT_Y_DIR false.
Wanhao's own MK2 firmwares keep Y not inverted on every size, including the 500, which Wanhao rebuilt in July 2019 (V1.1.2.1). Reading the Y DIR writes in Stepper::set_directions() of the published binaries shows the same order on the 300, 400 and 500, and the method gives back the values of Wanhao's MK2 V1.1.2 source. The 500 example had been switched to an inverted Y for one owner's machine; go back to the factory direction.
Probing ends at the back corner, so the bed stays forward over the screen. EVENT_GCODE_AFTER_G29 raises Z to 10 mm and moves to the bed center (150/200/250).
thinkyhead
force-pushed
the
wanhao-d9-fixes
branch
from
October 14, 2026 17:32
4a5129b to
7cffdd5
Compare
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.
Requirements
Any of the twelve
Wanhao/Duplicator 9examples (MK1, MK1u2, MK2, MK3 × 300 / 400 / 500), on theWANHAO_D9board.Description
Eleven commits, each standing on its own:
bugfix-2.1.xsince 🔧 Enable HOST_ACTION_COMMANDS by default Marlin#28442. They enabledHOST_START_MENU_ITEMandHOST_SHUTDOWN_MENU_ITEM, which now require MarlinUI, and the D9 runs a DGUS display. Both are back to the template's disabled form.Z_MIN_ENDSTOP_INVERTINGandZ_MIN_PROBE_ENDSTOP_INVERTINGtrue, and Klipper'sprinter-wanhao-duplicator-9-2018.cfgreads it as!PH3— both LOW, where these examples had HIGH.POWER_LOSS_RECOVERYis enabled and on by default. This commit used the power-fail input on pin 63, declared inpins_WANHAO_D9.h; commit 10 turns that pin off again.ENDSTOP_NOISE_THRESHOLD 2fixed it on his printer ([BUG] Homing failed with Marlin 2.0.x Marlin#16371 describes the same symptom). The same commit keepsM503, which the examples had disabled; flash stays at 50–52 %.G29), probe clearances, probe and homing feedrates,HOMING_BUMP_DIVISOR,BLTOUCH_DELAY, thermal protection periods,TEMP_HYSTERESIS, bed max temperature, classic jerk, park position, preheat values andFAN_SOFT_PWMon the BLTouch models. The MK3 has no published source: comparing the constants in its V1.1.3 binary with the MK2's V1.1.2 and V1.1.2.1 shows the same values except the bed max temperature (105 °C, 90 °C on the 500). Three values cannot follow Wanhao:HEATER_0_MAXTEMPstops at 305 because thermistor 1's table ends at 320 °C with the 15 °C overshoot, the mesh stays 5×5 because DGUS Reloaded requires it, and the min temperatures stay at 5 °C so a disconnected thermistor is still caught.EEPROM_INIT_NOWwiped the EEPROM on the first boot of every new build, so each update lost the probe Z offset and the mesh.EEPROM_AUTO_INITstill resets a store that doesn't match.POWER_LOSS_PINis-1: the job is saved on each Z change instead, and a print can still be resumed after a real outage. Tested on that printer: prints run.EVENT_GCODE_AFTER_G29raises Z to 10 mm and moves to the bed centre (150, 200 or 250). Tested on an MK2 300: the 25 points probe, then the head stops at X150 Y150 Z10.Wanhao's site is gone, but its Dropbox links still work. The directions and settings above were read out of those factory binaries. For the directions: in
Stepper::set_directions(), each axis writes its DIR pin (PK0, PK3 and PK7 on this board, all on PORTK) first withINVERT_x_DIR, then with its complement, so the order of the set and clear instructions gives the setting. The method returns the exact values of the four source packages Wanhao published (MK1 V0.15 and V0.164(B), MK2 V1.1.2, MK2 kit V1.1.31) before being applied to the MK3 and to the 500. The binaries, the extraction script and the results are kept at https://github.com/Le-Syl21/WANHAO-Duplicator-9.Benefits
The D9 examples build again, so they can be part of the next release builds, start from the settings Wanhao shipped, and home and probe without hitting the bed clips.
All twelve build locally against current
bugfix-2.1.x(flash 49.9–50.8 %, RAM 66.4–67.2 %). The MK2 300 build runs on my printer: homing, BLTouch probing, a 5×5G29mesh, andM413reporting recovery on; the noise filter was confirmed on another owner's MK2 300. I have no MK1 or MK3 to run those builds on. The board file itself gets a small update in MarlinFirmware/Marlin#28583.Related Issues
Follows #1155 and #1182.