Skip to content

Instantly share code, notes, and snippets.

@rmeissn
Last active July 23, 2025 07:29
Show Gist options
  • Save rmeissn/f24294a20b57c870abf1c9e760e54954 to your computer and use it in GitHub Desktop.
Save rmeissn/f24294a20b57c870abf1c9e760e54954 to your computer and use it in GitHub Desktop.
Flashforge Adventurer 3 Cura

The firmware of the Flashforge Adventurer 3 seems to understand only a subset of typical marlin gcode:

  • no G0 support (use G1 instead)
  • if XYZ coordinates are combined within G1, the bed leveling mesh seems to be ignored (use two G1 (one for Z and one for XY) instead)
  • M140 does not support decimal point numbers (only e.g. S50 instead of S50.0)
  • M104 does not support decimal point numbers (only e.g. S50 instead of S50.0)
  • no relative E value support (cura produces absolute E values either way)
  • a Z-Offset needs to be included in each Z coordinate if required (use cura Z-Offset plugin and tick "extensive z-offset processing")

-> I've created a bash script to convert cura gcode to flashforge gcode. I'm not sure I've covered all edge cases, but it seems to work.

X: 150mm
Y: 150mm
Z: 150mm
Build_Plate: Rectangular
Origin at Center: Tick
Heated Bed: Tick
Heated Build Volume: false
G-Code Flavor: Marlin
xmin: -20
ymin: -10
xmax: 10
ymax: 10
gantry hight: 150
no of extruders: 1
Apply Extruder Offset: Tick
M104 S0 T0 ; Hotend to 0°C
M140 S0 T0 ; Bed to 0°C
G162 Z F1800 ; Move Z Axes to Maximum
G28 X Y ; Home XY
M132 X Y A B ; Recall home offsets
M652 ; ???
G91 ; Relative Positioning
M18 ; Disable Steppers
M107 ;Turn-off fan
M140 S{material_bed_temperature} T0
M104 S{material_print_temperature} T0
M104 S0 T1 ; Tool 1 to 0°C
M107 ; Fan off
M900 K0.000 T0 ; K-Factor to 0
G90 ; Absolute Positioning
G28 ; Home XYZ
M132 X Y Z A B ; Recall home offsets
G1 Z50.250 F420 ; Move Z to 50mm
G161 X Y F3300 ; Move Axes to Minimum
M7 T0 ; Stabilize bed temperature
M6 T0 ; Stabilize extruder temperature
M651 S255 ; Set case fan on
M108 T0 ; Break and Continue
#!/bin/bash
# use as: transform_cura_to_flashforge.sh xxx.gcode
ConvertedGCode=$(cat $1)
# replace temperature of kind xx.0 to just xx
M140=$(echo "$ConvertedGCode" | grep M140)
while IFS= read -r line; do
convertedLine=$(echo "$line" | sed -E 's/S([0-9]+)\.0/S\1/g')
ConvertedGCode="${ConvertedGCode//$line/$convertedLine}"
done <<< "$M140"
M104=$(echo "$ConvertedGCode" | grep M104)
while IFS= read -r line; do
convertedLine=$(echo "$line" | sed -E 's/S([0-9]+)\.0/S\1/g')
ConvertedGCode="${ConvertedGCode//$line/$convertedLine}"
done <<< "$M104"
# seperate each G0 with Z coordinate into two G1 commands
linesWithZ=$(echo "$ConvertedGCode" | grep G0 | grep ' Z.*\.')
while IFS= read -r line; do
# Extracting relevant parts
speed=$(echo "$line" | awk -F '[ ;]' '{print $2}')
x=$(echo "$line" | awk -F '[ ;]' '{print $3}')
y=$(echo "$line" | awk -F '[ ;]' '{print $4}')
z=$(echo "$line" | awk -F '[ ;]' '{print $5}')
# Creating the new lines
z_line="G1 F420 ${z}0"
xy_line="G1 $speed $x $y"
# Printing the new lines
replacement=$(printf "%s\n%s\n" "$z_line" "$xy_line")
#echo "$line"
#echo $replacement
# Replacing within the original text
ConvertedGCode="${ConvertedGCode//$line/$replacement}"
# the following lines are currently not working
#ConvertedGCode=$(echo "$ConvertedGCode" | sed -e "s/\$line/\$replacement/g")
#ConvertedGCode=$(echo "$ConvertedGCode" | sed -e "s/$line/$replacement/g")
done <<< "$linesWithZ"
# Convert each remaining G0 to G1
ConvertedGCode=$(echo "$ConvertedGCode" | sed -e 's/G0/G1/g')
ending='.gcode'
convertedFile=${1%$ending}\-converted.g
echo "$ConvertedGCode" > $convertedFile
@dbaarda
Copy link

dbaarda commented Jul 16, 2025

Update: I've done more extensive testing on Linear Advance and the Adv3 definitely doesn't support it. I did calibration tests where the Kf values were only set at the beginning of the print job, doing each calibration line as a separate print job. I tried Kf values for new 0.0 ->2.0 and old 0.0 -> 200.0 values. None of these showed any differences in the output.

I've also noticed that the particular combination of gcode commands it uses suggests the firmware is descended from MakerBot. I got this from the documentation of M132 on MakerBot, which seems to be the only firmware documented as supporting this particular use of that command, but also G161 and G162 support this theory. That means the other gcode documented as supported by that firmware at https://reprap.org/wiki/G-code probably also works, but there are clearly additional tweaks like M651 re-purposed (probably by defining the documented macro) to control the case fan, and M652 added for turning the case fan off. Note M900 is documented as not supported by MakerBot which matches with my testing.

I've been playing with OrcaSlicer for the Adv3 and its looking very promising, but it needs a few tweaks that I'm working on. I'll post more details when I have them ready.

@dbaarda
Copy link

dbaarda commented Jul 23, 2025

I also found the following documenting adv3 gcode. It's been automatically translated from Japanese so it's a bit confusing at times, but the author seems to have done extensive reverse-engineering work and written alternative control software;

https://take4-blue.com/en/3d-printer/adventurer3-control-3/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment