Skip to content

Instantly share code, notes, and snippets.

@cp2004
Created July 17, 2022 18:18
Show Gist options
  • Save cp2004/364c83626c8cb61b96818a6d9879a005 to your computer and use it in GitHub Desktop.
Save cp2004/364c83626c8cb61b96818a6d9879a005 to your computer and use it in GitHub Desktop.
Setting up the Marlin Simulator and OctoPrint

Setting up the native Marlin Simulator and connecting to OctoPrint

This details the steps I had to go through to get this up & running on & connected to OctoPrint. It provides a GUI to simulate the printer, supporting a subset of the Marlin features. You can connect to it via OctoPrint, but it requires a small patch.

Windows Setup

Dependencies

  1. Git checkout of Marlin, setup with AutoBuildMarlin/Platformio in VS Code.
  2. Check ini/native.ini in case anything has changed with requirements
  3. Download and install MYSYS2, following the instructions there
  4. Run pacman -S --needed base-devel mingw-w64-x86_64-toolchain mingw64/mingw-w64-x86_64-glm mingw64/mingw-w64-x86_64-SDL2 mingw64/mingw-w64-x86_64-SDL2_net mingw-w64-x86_64-dlfcn or whatever command is listed in the native.ini file in the MYSYS2 terminal
  5. OctoPrint git checkout setup & running

Building & Running

  1. Grab the Simulator Example Configurations to use in Marlin
  2. Change the SERIAL_PORT to 3, this makes the Simulator listen on a socket on port 8099
  3. Build, you should end up with a MarlinSimulator.exe
  4. You will need a small patch to allow OctoPrint to connect to the TCP socket. This commit demonstrates the necessary changes
  5. Add socket://localhost:8099 to the additional serial ports in OctoPrint
  6. Run the simulator, and connect OctoPrint
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment