|
Posted 19 august 2023
The Marlin firmware comes with a simulator. Compile it as a simulated board and the then generated execuatble is a complete simulator.
The simulator does what your printer does including display, buildplate, extruder, heating, SD card, EEPROM, printing and a command line to enter GCODE manually.
It allows to monitor or analyse pins and serial interfaces. And it is the quietest 3d printer I know.
So, how hard can it be to compile it ?
The simulator is under development thus not all boards, drivers, displays are supported yet.
The currently supported displays are stated in file Configurations/config/Simulator/Configuration.h .
In platform.ini set default_envs depended on Linux, MacOs or Windows (see below).
Close VSC when you start to install the required packages.
Linux (Ubuntu):A number of additional packages is needed, they are described in ini/native.ini , as I discovered later.Install each package with "sudo apt-get install ..." as described in ini/native.ini. I installed (some may not be needed): - sudo apt-get install libglm-dev - sudo apt-get install libsdl2-image-dev - sudo apt-get install libsdl2-dev - sudo apt-get install libsdl2-mixer-dev - sudo apt-get install libsdl2-ttf-dev - sudo apt-get install libsdl2-net-dev platform.ini: default_envs = simulator_linux_debug
Compiling did not go smoothly thus at some point I had to delete directory .cache
located in .platformio in my home directory, and the .pio directory in Marlin. On Windows I even removed the complete .platformio directory.
Run simulator: in the Marlin\.pio\build\simulator_linux_debug double click MarlinSimulator
Simulator item SD Card, Generate Empty Image: crashes the simulator on Ubuntu.
MacOs:I don't have a Mac. See ini/native.ini .Windows 11:The MSYS2 building platform is needed for Windows. Install MSYS2 from https://www.msys2.org/ .After installation it opens a MSYS2 terminal window. In the opened window execute the complete "pacman -S --needed ..." line as described in ini/native.ini. In Windows extend the environment variable Path with the directories as described in ini/native.ini . The Environment Variables... Path can be found in Advanced system settings (type this in the "Search" bar of Windows or in Settings "Find a setting"). Check: Open a Windows PowerShell and type "which gcc" which replies "/mingw64/bin/gcc" . platform.ini: default_envs = simulator_windows
First attempt on windows gave this error: '"CC"' is not recognized as an internal or external command.
Run simulator: in the Marlin\.pio\build\simulator_windows double click MarlinSimulator.exe
How to create an .img file which can be read by the simulator (Windows)Install WIN32 DISK IMAGER https://win32diskimager.org/Slice your stl file and store it on a SD card (use a small size SD card, if possible). Start Win32 Disk Imager and select the device letter of the SD card. Input the Image File location and file name (example C:/fs.img ). Push button Read. The SD card will be read and stored as C:/fs.img . Then copy/move fs.img to the appropriate simulator directory (example simulator_windows Marlin\.pio\build\simulator_windows ). A fs.img is automatically loaded when the simulator is started. Other .img files can be selected when the simulator is running but that did not always work (Linux) or I was too impatient. But the fs.img created on Windows worked correctly on Ubuntu as well.
3D Benchy speedprint challengeBesides configurating a printer the code has many magic numbers and hard-coded values. #define TFT_COLOR_UIDownload the Marlin and Configurations bugfix-2.1.x branch. Set the display background to blue (new) so the display distinguishes better within the black Simulator. In Configuration.h :
Things you may (not) want
|
Ad by Google.