Global_en - ghzserg/zmod GitHub Wiki
A macro is a small program written in Klipper/Gcode.
It can be called from:
- A GCODE file
- The Fluidd/Mainsail console (press the English letter
C
in Fluidd)
Note
The value in parentheses is the default value
🔷 Global Parameters 🔷 |
|||
---|---|---|---|
LANG | GET_ZMOD_DATA | SAVE_ZMOD_DATA | |
NOZZLE_CONTROL | SET_TIMEZONE |
🔷 Start Print Parameters [START_PRINT] 🔷 |
|||
---|---|---|---|
PRINT_LEVELING | FORCE_MD5 | CLEAR | USE_KAMP |
MIDI_START | LOAD_ZOFFSET | MESH_TEST | PRECLEAR |
DISABLE_SKEW_CORRECT | DISABLE_PRIMING |
🔷 End Print Parameters [END_PRINT] 🔷 |
|||
---|---|---|---|
MIDI_END | CLOSE_DIALOGS | STOP_MOTOR | AUTO_REBOOT |
🔷 System-Wide Parameters 🔷 |
|||
---|---|---|---|
MOTION_SENSOR | CHINA_CLOUD | SAVE_MOONRAKER | LED |
FIX_SCV | FIX_E0011 | FIX_E0017 | MIDI_ON |
USE_SWAP | DISPLAY_OFF_TIMEOUT | NEW_SAVE_CONFIG | NICE |
PRO_POWEROFF_TIMEOUT |
Set the language for ZMOD operation.
- LANG - language: en (English), ru (Russian), de (German), fr (French), it (Italian), es (Spanish), zh (Chinese), ja (Japanese), ko (Korean) (en)
Example:
LANG LANG=en
Change the timezone.
- ZONE - time zone (Asia/Yekaterinburg)
Does not work on AD5X
Control nozzle collision with the bed or part detachment.
Emergency shutdown if weight exceeds the set limit.
- WEIGHT - weight in grams (1500)
Settings persist after reboot.
Set NOZZLE_CONTROL WEIGHT=0
to disable this feature.
Control is disabled until the macro is first called.
When using the native screen, macro execution reboots the printer.
Without the native screen, restarts Klipper (configuration files are modified).
Works automatically, but additional macros are available for Gcode:
-
ZCONTROL_ON
- enable control -
ZCONTROL_OFF
- disable control -
ZCONTROL_STATUS
- check status -
ZCONTROL_PAUSE
- pause on trigger (only after command queue clears; avoid using on initial layers) -
ZCONTROL_ABORT
- abort Klipper on trigger
To enable nozzle control on initial layers, add ZCONTROL_PAUSE
in the slicer at the desired layer.
Retrieve ZMOD global parameters/flags. After execution, the console displays saved parameters applied at runtime.
Fluidd
-> Macros
-> Main
-> ZMOD PARAMETERS
Save ZMOD global parameters/flags (applied during every print).
Do not add this macro to start/end Gcode or Gcode files. Call it from the Fluidd/Mainsail console. Parameters are saved to mod_data/variables.cfg
after shutdown (do not edit manually).
To edit parameters:
- Go to
Fluidd
->Macros
->System
->SAVE ZMOD PARAMETERS
, select the parameter, modify it, and clickSEND
. - Alternatively, enter commands directly in the Fluidd console, e.g.,
SAVE_ZMOD_DATA CLOSE_DIALOGS=2
.
Play MIDI on print start (""), 0 to disable.
Example: SAVE_ZMOD_DATA MIDI_START=Pain-Shut-your-mouth.mid
Enable nozzle pre-clearing in CLEAR_NOZZLE: 0 (no), 1 (yes) (0).
Example: SAVE_ZMOD_DATA PRECLEAR=0
Build bed mesh before each print (using native screen if enabled): 0 (no), 1 (yes) (0). For native screen bed leveling, enable "Local Network Only" via the printer menu: Settings -> WiFi icon -> Network Mode.
Example: SAVE_ZMOD_DATA PRINT_LEVELING=1
Use Adaptive Mesh (KAMP) instead of full bed mesh where possible: 0 (no), 1 (yes) (0).
Recommended to set SAVE_ZMOD_DATA CLEAR=LINE_PURGE
to align purge location with KAMP mesh.
Example: SAVE_ZMOD_DATA USE_KAMP=1
Test bed mesh before printing: 0 (no), 1 (yes) (1).
If KAMP smart purge is used, heating occurs near the purge area instead of a corner.
Test procedure:
- Raise 5mm
- Move X +3mm
- Retract
- Probe
- Raise 5mm
- Unretract
The test checks if the Z value falls within the mesh range ±0.21mm. If not, a warning is issued and the print aborts.
This is a rough check and not foolproof.
Example: SAVE_ZMOD_DATA MESH_TEST=0
Verify file MD5 hash and delete on mismatch: 0 (disable), 1 (enable) (1).
Use addMD5.bat or addMD5.sh (Linux/Mac) in post-processing scripts. Add to Orca: Process Profile -> Other -> Post-Processing Scripts.
Example: SAVE_ZMOD_DATA FORCE_MD5=1
1 (disable SKEW correction), 0 (load skew_profile
via SKEW_PROFILE LOAD=skew_profile
) (1).
Example: SAVE_ZMOD_DATA DISABLE_SKEW_CORRECT=1
Load Z-offset from global parameters saved via SET_GCODE_OFFSET: 1 (yes), 0 (no) (1).
Example: SAVE_ZMOD_DATA LOAD_ZOFFSET=0
Disable nozzle priming via extrusion: 0 (no), 1 (yes) (0).
Example: SAVE_ZMOD_DATA DISABLE_PRIMING=0
Select nozzle purge algorithm (LINE_PURGE):
- _CLEAR1 - Orca-style (may scratch bed with KAMP)
- _CLEAR2 - FF group style (may scratch bed with KAMP)
- _CLEAR3 - FF group alternative (may scratch bed with KAMP)
- _CLEAR4 - Shreider's code (top-right to bottom-right)
- _CLEAR_TRAP - For brushes (top-right to bottom-right)
- LINE_PURGE - KAMP purge
Custom purge macros can be added to mod_data/user.cfg
.
Example: SAVE_ZMOD_DATA CLEAR=LINE_PURGE
Play MIDI on print end (""), 0 to disable.
Example: SAVE_ZMOD_DATA MIDI_END=Pain-Shut-your-mouth.mid
Automatically close dialogs after print end/cancel: 0 (no), 1 (yes, slow), 2 (yes, fast) (0). For fast closing, enable "Local Network Only" via the printer menu.
Example: SAVE_ZMOD_DATA CLOSE_DIALOGS=2
Automatically disable motors 25 seconds after print end/cancel: 0 (no), 1 (yes) (1).
Example: SAVE_ZMOD_DATA STOP_MOTOR=1
Automatically reboot the printer after printing completes (0):
- 0 - no reboot
- 1 - reboot the printer via the
REBOOT
command - 2 - without the native screen: reboot the firmware via
FIRMWARE_RESTART
; with the screen: reboot the printer via theREBOOT
command
Example: SAVE_ZMOD_DATA AUTO_REBOOT=0
Use a filament motion sensor instead of the filament presence sensor (0):
- 0 - no
- 1 - yes
When using the filament motion sensor, disable it on the native screen; otherwise, printing will pause.
Example: SAVE_ZMOD_DATA MOTION_SENSOR=1
Fix incorrect SCV (square_corner_velocity) when rendering acceleration graphs and calculating input shapers.
- 0 - keep the parameter as in stock (5)
- 1 - use
square_corner_velocity
frommod_data/user.cfg
orprinter.base.cfg
Example: SAVE_ZMOD_DATA FIX_SCV=1
In our printer, square_corner_velocity: 25
, but shaper graph calculations and accelerations are based on SCV = 5
.
This primarily affects displayed accelerations and calculated smoothing levels.
shaper_type_x
, shaper_freq_x
, shaper_type_y
, shaper_freq_y
remain unchanged.
However, with correct calculations, the resulting accelerations drop by approximately half.
Recommendation: add the following to mod_data/user.cfg
:
[printer]
square_corner_velocity: 9
This reduces cornering speeds and generally improves print quality with a slight speed trade-off.
This is an experimental parameter
Common causes of E0011 error:
- Host did not respond within the allotted time (0.025 sec)
- MCU did not respond within the allotted time (0.025 sec)
Specific causes:
- Frozen Nations MCU mainboard or eboard.
Lost communication with MCU 'mcu'
. Solution: Reboot. Replace the mainboard (mcu
) or extruder board (eboard
). - Host CPU overload (shaper calculations/graph rendering).
- EMMC overload (git operations, backups, large file uploads during printing, etc.).
- Insufficient RAM. Solution: Re-solder the CPU and upgrade to 256MB RAM.
- Damaged extruder cable. Solution: Replace/fix the cable.
- Loose extruder board cable connection. Solution: Replace the extruder board.
- SWAP data loading (SWAP resides on EMMC, which operates at 10 MB/s; SWAP data during shaper calculations can reach 25MB). Solution: Disable SWAP if you have 256MB RAM via
SAVE_ZMOD_DATA USE_SWAP=0
. - MCU firmware crash. Solution: Reflash the MCU via factory reset or use the UPDATE_MCU mod.
Fix E0011 and Communication timeout during homing
errors. Changing this parameter will reboot the printer. 0-no, 1-yes (0):
- 0 - keep the stock parameter (0.025)
- 1 - set the parameter to 0.05
Example: SAVE_ZMOD_DATA FIX_E0011=1
The Communication timeout during homing
error may occur due to high communication latency between the host and MCUs. Round-trip time should consistently stay below 10ms. Temporary latency spikes can cause homing failures.
TRSYNC_TIMEOUT
is a Klipper parameter (default: 0.025 sec) that compensates for system delays.
Stock file /opt/klipper/klippy/mcu.py
sets TRSYNC_TIMEOUT = 0.025
. The patch changes it to TRSYNC_TIMEOUT = 0.05
.
How to fix on stock firmware:
- Format a USB drive as FAT32.
- Save the
flashforge_init.sh
file to the USB: - Power off the printer.
- Insert the USB into the printer.
- Power on the printer (it will beep loudly).
- Wait for reboot.
- Remove the USB.
- Reprint the problematic file; E0011 should no longer occur.
Manual fix on stock firmware:
- Install root.
- Use WinSCP to SSH into the printer.
- Edit
/opt/klipper/klippy/mcu.py
. - Locate
TRSYNC_TIMEOUT = 0.025
and change it toTRSYNC_TIMEOUT = 0.05
. - Save the file and reboot the printer.
Fix E0017 error. Changing this parameter will reboot the printer. 0-no, 1-yes (1):
In the stock file /opt/klipper/klippy/toolhead.py
, LOOKAHEAD_FLUSH_TIME = 0.5
. Original Klipper uses LOOKAHEAD_FLUSH_TIME = 0.250
. Our mod works best with LOOKAHEAD_FLUSH_TIME = 0.150
.
- 0 - set to stock value
- 1 - set to 0.150
Example: SAVE_ZMOD_DATA FIX_E0017=1
How to fix on stock firmware:
- Format a USB drive as FAT32.
- Save the appropriate file to the USB:
- Adventurer5M-e0017-4.tgz for FlashForge 5M
- Adventurer5MPro-e0017-4.tgz for FlashForge 5M Pro
- Power off the printer.
- Insert the USB into the printer.
- Power on the printer (it will beep loudly).
- Wait for reboot.
- Remove the USB.
- Reprint the problematic file; E0017 should no longer occur.
Manual fix on stock firmware:
- Install root.
- Use WinSCP to SSH into the printer.
- Edit
/opt/klipper/klippy/toolhead.py
. - Locate
LOOKAHEAD_FLUSH_TIME = 0.5
and change it toLOOKAHEAD_FLUSH_TIME = 0.150
. - Save the file and reboot the printer.
LED brightness at startup (50).
Example: SAVE_ZMOD_DATA LED=50
Play MIDI at startup (""). Use 0
to disable.
Example: SAVE_ZMOD_DATA MIDI_ON=Pain-Shut-your-mouth.mid
Use alternative SAVE_CONFIG (invokes SAVE_CONFIG
without freezing the native screen). NEW_SAVE_CONFIG for PID calibration: 0-no, 1-yes (0).
Example: SAVE_ZMOD_DATA NEW_SAVE_CONFIG=0
Enable SWAP (1):
- 0 - no (Only for upgraded 256MB RAM)
- 1 - yes, on EMMC
- 2 - yes, prefer USB FLASH
Example: SAVE_ZMOD_DATA USE_SWAP=1
Enable Chinese cloud services: 0-no, 1-yes (1).
Example: SAVE_ZMOD_DATA CHINA_CLOUD=0
Even if all cloud options are disabled via the screen, the printer still attempts to send photos, videos, and telemetry to Chinese servers.
Setting this parameter to 0 partially disables these "features."
If Chinese clouds are disabled, the printer will not check for stock firmware updates.
To update stock firmware, enable Chinese clouds via SAVE_ZMOD_DATA CHINA_CLOUD=1
, reboot, and proceed with the update.
To disable Chinese clouds on stock firmware:
- Format a USB drive as FAT32.
- Place flashforge_init.sh on the USB.
- Power off the printer.
- Insert the USB into the printer.
- Power on the printer (it will reboot once).
- Remove the USB.
To enable Chinese clouds on stock firmware:
- Format a USB drive as FAT32.
- Place flashforge_init.sh on the USB.
- Follow the same steps as above.
Set Klipper process priority: 1 (lowest) to 40 (highest) (20).
Example: SAVE_ZMOD_DATA NICE=20
Higher priority allocates more resources to Klipper but may cause Moonraker and camera disconnections.
For Linux users:
NICE=20
grep -q "^nice = " /opt/config/mod_data/variables.cfg && NICE=$(grep "^nice = " /opt/config/mod_data/variables.cfg | cut -d "=" -f2| awk '{print $1}')
NICE=$((20-$NICE))
[ $NICE -ge 20 ] && NICE=19
[ $NICE -lt -20 ] && NICE=-20
renice $NICE $(ps |grep klippy.py| grep -v grep| awk '{print $1}')
Set the timeout (in seconds) to turn off the native screen when not in use. Default: 180.
Note: The native screen needs at least 5 seconds to configure WiFi.
Example: SAVE_ZMOD_DATA DISPLAY_OFF_TIMEOUT=120
Set the timeout (in minutes) for FF5M Pro to auto-power off. Default: 0 (disabled).
Example: SAVE_ZMOD_DATA PRO_POWEROFF_TIMEOUT=10
- 0 - Load macro button layouts from ZMOD (default).
- 1 - Allow saving macro button changes locally in Fluidd/Moonraker.
Locally saved macros are stored in a separate section.
Example: SAVE_ZMOD_DATA SAVE_MOONRAKER=1