Skip to content

Instantly share code, notes, and snippets.

@tfmoraes
Created March 19, 2024 21:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tfmoraes/70eb471fcc46329c59266f230a24c0bc to your computer and use it in GitHub Desktop.
Save tfmoraes/70eb471fcc46329c59266f230a24c0bc to your computer and use it in GitHub Desktop.
Diff with configuration to make marlin simulator listen to socket on 8099
diff --git a/Marlin/Configuration.h b/Marlin/Configuration.h
index 4f93a4de48..8604de245a 100644
--- a/Marlin/Configuration.h
+++ b/Marlin/Configuration.h
@@ -1,6 +1,6 @@
/**
* Marlin 3D Printer Firmware
- * Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
+ * Copyright (c) 2021 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
*
* Based on Sprinter and grbl.
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
@@ -21,6 +21,8 @@
*/
#pragma once
+#define CONFIG_EXAMPLES_DIR "config/examples/Simulator"
+
/**
* Configuration.h
*
@@ -37,6 +39,22 @@
*/
#define CONFIGURATION_H_VERSION 02010202
+//
+// Simulator currently supports these displays. Choose one!
+//
+#define REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER
+//#define REPRAP_DISCOUNT_SMART_CONTROLLER
+//#define TFT_CLASSIC_UI
+//#define TFT_COLOR_UI
+
+// Enable parent LCD based on your selection above
+#if EITHER(TFT_CLASSIC_UI, TFT_COLOR_UI)
+ #define TFT_GENERIC
+ #define TOUCH_SCREEN
+#elif ENABLED(LIGHTWEIGHT_UI)
+ #define REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER
+#endif
+
//===========================================================================
//============================= Getting Started =============================
//===========================================================================
@@ -88,7 +106,7 @@
// Choose the name from boards.h that matches your setup
#ifndef MOTHERBOARD
- #define MOTHERBOARD BOARD_RAMPS_14_EFB
+ #define MOTHERBOARD BOARD_SIMULATED
#endif
/**
@@ -99,7 +117,11 @@
*
* :[-1, 0, 1, 2, 3, 4, 5, 6, 7]
*/
-#define SERIAL_PORT 0
+
+/**
+ * SERIAL_PORT 3 makes the simulator listen on a socket on port 8099
+ */
+#define SERIAL_PORT 3
/**
* Serial Port Baud Rate
@@ -1150,6 +1172,10 @@
#define W_MAX_ENDSTOP_INVERTING false // Set to true to invert the logic of the endstop.
#define Z_MIN_PROBE_ENDSTOP_INVERTING false // Set to true to invert the logic of the probe.
+#define X_MIN_ENDSTOP_HIT_STATE HIGH
+#define Y_MIN_ENDSTOP_HIT_STATE HIGH
+#define Z_MIN_ENDSTOP_HIT_STATE HIGH
+
// Enable this feature if all enabled endstop pins are interrupt-capable.
// This will remove the need to poll the interrupt pins, saving many CPU cycles.
//#define ENDSTOP_INTERRUPTS_FEATURE
@@ -1335,6 +1361,7 @@
* or (with LCD_BED_LEVELING) the LCD controller.
*/
//#define PROBE_MANUALLY
+//#define MANUAL_PROBE_START_Z 0.2
/**
* A Fix-Mounted Probe either doesn't deploy or needs manual deployment.
@@ -2204,7 +2231,7 @@
* M501 - Read settings from EEPROM. (i.e., Throw away unsaved changes)
* M502 - Revert settings to "factory" defaults. (Follow with M500 to init the EEPROM.)
*/
-//#define EEPROM_SETTINGS // Persistent storage with M500 and M501
+#define EEPROM_SETTINGS // Persistent storage with M500 and M501
//#define DISABLE_M503 // Saves ~2700 bytes of flash. Disable for release!
#define EEPROM_CHITCHAT // Give feedback on EEPROM commands. Disable to save flash.
#define EEPROM_BOOT_SILENT // Keep M503 quiet and only give errors during first load
@@ -2267,7 +2294,7 @@
* P1 Raise the nozzle always to Z-park height.
* P2 Raise the nozzle by Z-park amount, limited to Z_MAX_POS.
*/
-//#define NOZZLE_PARK_FEATURE
+#define NOZZLE_PARK_FEATURE
#if ENABLED(NOZZLE_PARK_FEATURE)
// Specify a park position as { X, Y, Z_raise }
@@ -2314,7 +2341,7 @@
*
* Caveats: The ending Z should be the same as starting Z.
*/
-//#define NOZZLE_CLEAN_FEATURE
+#define NOZZLE_CLEAN_FEATURE
#if ENABLED(NOZZLE_CLEAN_FEATURE)
// Default number of pattern repetitions
@@ -2395,7 +2422,7 @@
*
* View the current statistics with M78.
*/
-//#define PRINTCOUNTER
+#define PRINTCOUNTER
#if ENABLED(PRINTCOUNTER)
#define PRINTCOUNTER_SAVE_INTERVAL 60 // (minutes) EEPROM save interval during print. A value of 0 will save stats at end of print.
#endif
@@ -2421,7 +2448,7 @@
* the firmware with the feature disabled, reset EEPROM, and (optionally)
* re-flash the firmware again with this feature enabled.
*/
-//#define PASSWORD_FEATURE
+#define PASSWORD_FEATURE
#if ENABLED(PASSWORD_FEATURE)
#define PASSWORD_LENGTH 4 // (#) Number of digits (1-9). 3 or 4 is recommended
#define PASSWORD_ON_STARTUP
@@ -2488,7 +2515,7 @@
* SD Card support is disabled by default. If your controller has an SD slot,
* you must uncomment the following option or it won't work.
*/
-//#define SDSUPPORT
+#define SDSUPPORT
/**
* SD CARD: ENABLE CRC
@@ -2543,7 +2570,7 @@
// If CLOCKWISE normally moves DOWN this makes it go UP.
// If CLOCKWISE normally moves UP this makes it go DOWN.
//
-//#define REVERSE_MENU_DIRECTION
+#define REVERSE_MENU_DIRECTION
//
// This option reverses the encoder direction for Select Screen.
@@ -3148,12 +3175,12 @@
// Interface. Enable one of the following options:
//#define TFT_INTERFACE_FSMC
- //#define TFT_INTERFACE_SPI
+ #define TFT_INTERFACE_SPI
// TFT Resolution. Enable one of the following options:
//#define TFT_RES_320x240
//#define TFT_RES_480x272
- //#define TFT_RES_480x320
+ #define TFT_RES_480x320
//#define TFT_RES_1024x600
#endif
diff --git a/Marlin/Configuration_adv.h b/Marlin/Configuration_adv.h
index 1b17c59727..5406e928ec 100644
--- a/Marlin/Configuration_adv.h
+++ b/Marlin/Configuration_adv.h
@@ -1,6 +1,6 @@
/**
* Marlin 3D Printer Firmware
- * Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
+ * Copyright (c) 2021 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
*
* Based on Sprinter and grbl.
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
@@ -21,6 +21,8 @@
*/
#pragma once
+#define CONFIG_EXAMPLES_DIR "config/examples/Simulator"
+
/**
* Configuration_adv.h
*
@@ -1784,7 +1786,7 @@
// A bigger font is available for edit items. Costs 3120 bytes of flash.
// Western only. Not available for Cyrillic, Kana, Turkish, Greek, or Chinese.
- //#define USE_BIG_EDIT_FONT
+ #define USE_BIG_EDIT_FONT
// A smaller font may be used on the Info Screen. Costs 2434 bytes of flash.
// Western only. Not available for Cyrillic, Kana, Turkish, Greek, or Chinese.
@@ -1838,11 +1840,11 @@
//#define STATUS_CUTTER_ANIM // Use a second bitmap to indicate spindle / laser active
//#define STATUS_COOLER_ANIM // Use a second bitmap to indicate laser cooling
//#define STATUS_FLOWMETER_ANIM // Use multiple bitmaps to indicate coolant flow
- //#define STATUS_ALT_BED_BITMAP // Use the alternative bed bitmap
- //#define STATUS_ALT_FAN_BITMAP // Use the alternative fan bitmap
- //#define STATUS_FAN_FRAMES 3 // :[0,1,2,3,4] Number of fan animation frames
- //#define STATUS_HEAT_PERCENT // Show heating in a progress bar
- //#define BOOT_MARLIN_LOGO_ANIMATED // Animated Marlin logo. Costs ~3260 (or ~940) bytes of flash.
+ #define STATUS_ALT_BED_BITMAP // Use the alternative bed bitmap
+ #define STATUS_ALT_FAN_BITMAP // Use the alternative fan bitmap
+ #define STATUS_FAN_FRAMES 3 // :[0,1,2,3,4] Number of fan animation frames
+ #define STATUS_HEAT_PERCENT // Show heating in a progress bar
+ #define BOOT_MARLIN_LOGO_ANIMATED // Animated Marlin logo. Costs ~3260 (or ~940) bytes of flash.
// Frivolous Game Options
//#define MARLIN_BRICKOUT
@@ -1853,7 +1855,7 @@
#endif // HAS_MARLINUI_U8GLIB
#if HAS_MARLINUI_U8GLIB || IS_DWIN_MARLINUI
- #define MENU_HOLLOW_FRAME // Enable to save many cycles by drawing a hollow frame on Menu Screens
+ //#define MENU_HOLLOW_FRAME // Enable to save many cycles by drawing a hollow frame on Menu Screens
//#define OVERLAY_GFX_REVERSE // Swap the CW/CCW indicators in the graphics overlay
#endif
@@ -2063,28 +2065,28 @@
*
* Warning: Does not respect endstops!
*/
-//#define BABYSTEPPING
+#define BABYSTEPPING
#if ENABLED(BABYSTEPPING)
//#define INTEGRATED_BABYSTEPPING // EXPERIMENTAL integration of babystepping into the Stepper ISR
- //#define BABYSTEP_WITHOUT_HOMING
+ #define BABYSTEP_WITHOUT_HOMING
//#define BABYSTEP_ALWAYS_AVAILABLE // Allow babystepping at all times (not just during movement)
- //#define BABYSTEP_XY // Also enable X/Y Babystepping. Not supported on DELTA!
+ #define BABYSTEP_XY // Also enable X/Y Babystepping. Not supported on DELTA!
#define BABYSTEP_INVERT_Z false // Change if Z babysteps should go the other way
//#define BABYSTEP_MILLIMETER_UNITS // Specify BABYSTEP_MULTIPLICATOR_(XY|Z) in mm instead of micro-steps
#define BABYSTEP_MULTIPLICATOR_Z 1 // (steps or mm) Steps or millimeter distance for each Z babystep
#define BABYSTEP_MULTIPLICATOR_XY 1 // (steps or mm) Steps or millimeter distance for each XY babystep
- //#define DOUBLECLICK_FOR_Z_BABYSTEPPING // Double-click on the Status Screen for Z Babystepping.
+ #define DOUBLECLICK_FOR_Z_BABYSTEPPING // Double-click on the Status Screen for Z Babystepping.
#if ENABLED(DOUBLECLICK_FOR_Z_BABYSTEPPING)
#define DOUBLECLICK_MAX_INTERVAL 1250 // Maximum interval between clicks, in milliseconds.
// Note: Extra time may be added to mitigate controller latency.
- //#define MOVE_Z_WHEN_IDLE // Jump to the move Z menu on double-click when printer is idle.
+ #define MOVE_Z_WHEN_IDLE // Jump to the move Z menu on double-click when printer is idle.
#if ENABLED(MOVE_Z_WHEN_IDLE)
#define MOVE_Z_IDLE_MULTIPLICATOR 1 // Multiply 1mm by this factor for the move step size.
#endif
#endif
- //#define BABYSTEP_DISPLAY_TOTAL // Display total babysteps since last G28
+ #define BABYSTEP_DISPLAY_TOTAL // Display total babysteps since last G28
//#define BABYSTEP_ZPROBE_OFFSET // Combine M851 Z and Babystepping
#if ENABLED(BABYSTEP_ZPROBE_OFFSET)
@@ -2110,12 +2112,12 @@
*
* See https://marlinfw.org/docs/features/lin_advance.html for full instructions.
*/
-//#define LIN_ADVANCE
+#define LIN_ADVANCE
#if ENABLED(LIN_ADVANCE)
#if ENABLED(DISTINCT_E_FACTORS)
- #define ADVANCE_K { 0.22 } // (mm) Compression length per 1mm/s extruder speed, per extruder
+ #define ADVANCE_K { 0.0 } // (mm) Compression length per 1mm/s extruder speed, per extruder
#else
- #define ADVANCE_K 0.22 // (mm) Compression length applying to all extruders
+ #define ADVANCE_K 0.0 // (mm) Compression length applying to all extruders
#endif
//#define ADVANCE_K_EXTRA // Add a second linear advance constant, configurable with M900 L.
//#define LA_DEBUG // Print debug information to serial during operation. Disable for production use.
@@ -2282,7 +2284,7 @@
//
// G60/G61 Position Save and Return
//
-//#define SAVED_POSITIONS 1 // Each saved position slot costs 12 bytes
+#define SAVED_POSITIONS 1 // Each saved position slot costs 12 bytes
//
// G2/G3 Arc Support
@@ -2294,15 +2296,15 @@
#define MIN_CIRCLE_SEGMENTS 72 // Minimum number of segments in a complete circle
//#define ARC_SEGMENTS_PER_SEC 50 // Use the feedrate to choose the segment length
#define N_ARC_CORRECTION 25 // Number of interpolated segments between corrections
- //#define ARC_P_CIRCLES // Enable the 'P' parameter to specify complete circles
+ #define ARC_P_CIRCLES // Enable the 'P' parameter to specify complete circles
//#define SF_ARC_FIX // Enable only if using SkeinForge with "Arc Point" fillet procedure
#endif
// G5 Bézier Curve Support with XYZE destination and IJPQ offsets
-//#define BEZIER_CURVE_SUPPORT // Requires ~2666 bytes
+#define BEZIER_CURVE_SUPPORT // Requires ~2666 bytes
#if EITHER(ARC_SUPPORT, BEZIER_CURVE_SUPPORT)
- //#define CNC_WORKSPACE_PLANES // Allow G2/G3/G5 to operate in XY, ZX, or YZ planes
+ #define CNC_WORKSPACE_PLANES // Allow G2/G3/G5 to operate in XY, ZX, or YZ planes
#endif
/**
@@ -2479,7 +2481,7 @@
//#define NO_TIMEOUTS 1000 // (ms)
// Some clients will have this feature soon. This could make the NO_TIMEOUTS unnecessary.
-//#define ADVANCED_OK
+#define ADVANCED_OK
// Printrun may have trouble receiving long strings all at once.
// This option inserts short delays between lines of serial output.
@@ -2524,7 +2526,7 @@
*
* Note that M207 / M208 / M209 settings are saved to EEPROM.
*/
-//#define FWRETRACT
+#define FWRETRACT
#if ENABLED(FWRETRACT)
#define FWRETRACT_AUTORETRACT // Override slicer retractions
#if ENABLED(FWRETRACT_AUTORETRACT)
@@ -2647,7 +2649,7 @@
*
* Enable PARK_HEAD_ON_PAUSE to add the G-code M125 Pause and Park.
*/
-//#define ADVANCED_PAUSE_FEATURE
+#define ADVANCED_PAUSE_FEATURE
#if ENABLED(ADVANCED_PAUSE_FEATURE)
#define PAUSE_PARK_RETRACT_FEEDRATE 60 // (mm/s) Initial retract feedrate.
#define PAUSE_PARK_RETRACT_LENGTH 2 // (mm) Initial retract.
@@ -2687,10 +2689,10 @@
//#define FILAMENT_CHANGE_RESUME_ON_INSERT // Automatically continue / load filament when runout sensor is triggered again.
//#define PAUSE_REHEAT_FAST_RESUME // Reduce number of waits by not prompting again post-timeout before continuing.
- //#define PARK_HEAD_ON_PAUSE // Park the nozzle during pause and filament change.
- //#define HOME_BEFORE_FILAMENT_CHANGE // If needed, home before parking for filament change
+ #define PARK_HEAD_ON_PAUSE // Park the nozzle during pause and filament change.
+ #define HOME_BEFORE_FILAMENT_CHANGE // If needed, home before parking for filament change
- //#define FILAMENT_LOAD_UNLOAD_GCODES // Add M701/M702 Load/Unload G-codes, plus Load/Unload in the LCD Prepare menu.
+ #define FILAMENT_LOAD_UNLOAD_GCODES // Add M701/M702 Load/Unload G-codes, plus Load/Unload in the LCD Prepare menu.
//#define FILAMENT_UNLOAD_ALL_EXTRUDERS // Allow M702 to unload all extruders above a minimum target temp (as set by M302)
#endif
@@ -3276,11 +3278,11 @@
* Add the M240 G-code to take a photo.
* The photo can be triggered by a digital pin or a physical movement.
*/
-//#define PHOTO_GCODE
+#define PHOTO_GCODE
#if ENABLED(PHOTO_GCODE)
// A position to move to (and raise Z) before taking the photo
- //#define PHOTO_POSITION { X_MAX_POS - 5, Y_MAX_POS, 0 } // { xpos, ypos, zraise } (M240 X Y Z)
- //#define PHOTO_DELAY_MS 100 // (ms) Duration to pause before moving back (M240 P)
+ #define PHOTO_POSITION { X_MAX_POS - 5, Y_MAX_POS, 0 } // { xpos, ypos, zraise } (M240 X Y Z)
+ #define PHOTO_DELAY_MS 100 // (ms) Duration to pause before moving back (M240 P)
//#define PHOTO_RETRACT_MM 6.5 // (mm) E retract/recover for the photo move (M240 R S)
// Canon RC-1 or homebrew digital camera trigger
@@ -3596,7 +3598,7 @@
* Enables G53 and G54-G59.3 commands to select coordinate systems
* and G92.1 to reset the workspace to native machine space.
*/
-//#define CNC_COORDINATE_SYSTEMS
+#define CNC_COORDINATE_SYSTEMS
// @section reporting
@@ -3669,7 +3671,7 @@
// @section reporting
// Extra options for the M114 "Current Position" report
-//#define M114_DETAIL // Use 'M114` for details to check planner calculations
+#define M114_DETAIL // Use 'M114` for details to check planner calculations
//#define M114_REALTIME // Real current position based on forward kinematics
//#define M114_LEGACY // M114 used to synchronize on every call. Enable if needed.
@@ -3683,7 +3685,7 @@
#define FASTER_GCODE_PARSER
#if ENABLED(FASTER_GCODE_PARSER)
- //#define GCODE_QUOTED_STRINGS // Support for quoted string parameters
+ #define GCODE_QUOTED_STRINGS // Support for quoted string parameters
#endif
/**
@@ -3692,9 +3694,9 @@
//#define MEATPACK_ON_SERIAL_PORT_1
//#define MEATPACK_ON_SERIAL_PORT_2
-//#define GCODE_CASE_INSENSITIVE // Accept G-code sent to the firmware in lowercase
+#define GCODE_CASE_INSENSITIVE // Accept G-code sent to the firmware in lowercase
-//#define REPETIER_GCODE_M360 // Add commands originally from Repetier FW
+#define REPETIER_GCODE_M360 // Add commands originally from Repetier FW
/**
* Enable this option for a leaner build of Marlin that removes all
@@ -3711,13 +3713,13 @@
* Note that G0 feedrates should be used with care for 3D printing (if used at all).
* High feedrates may cause ringing and harm print quality.
*/
-//#define PAREN_COMMENTS // Support for parentheses-delimited comments
-//#define GCODE_MOTION_MODES // Remember the motion mode (G0 G1 G2 G3 G5 G38.X) and apply for X Y Z E F, etc.
+#define PAREN_COMMENTS // Support for parentheses-delimited comments
+#define GCODE_MOTION_MODES // Remember the motion mode (G0 G1 G2 G3 G5 G38.X) and apply for X Y Z E F, etc.
// Enable and set a (default) feedrate for all G0 moves
-//#define G0_FEEDRATE 3000 // (mm/min)
+#define G0_FEEDRATE 3000 // (mm/min)
#ifdef G0_FEEDRATE
- //#define VARIABLE_G0_FEEDRATE // The G0 feedrate is set by F in G0 motion mode
+ #define VARIABLE_G0_FEEDRATE // The G0 feedrate is set by F in G0 motion mode
#endif
/**
@@ -3725,7 +3727,7 @@
*
* Execute certain G-code commands immediately after power-on.
*/
-//#define STARTUP_COMMANDS "M17 Z"
+#define STARTUP_COMMANDS "M118 Sim Startup!"
/**
* G-code Macros
@@ -3733,7 +3735,7 @@
* Add G-codes M810-M819 to define and run G-code macros.
* Macros are not saved to EEPROM.
*/
-//#define GCODE_MACROS
+#define GCODE_MACROS
#if ENABLED(GCODE_MACROS)
#define GCODE_MACROS_SLOTS 5 // Up to 10 may be used
#define GCODE_MACROS_SLOT_SIZE 50 // Maximum length of a single macro
@@ -3857,10 +3859,10 @@
* Host Prompt Support enables Marlin to use the host for user prompts so
* filament runout and other processes can be managed from the host side.
*/
-//#define HOST_ACTION_COMMANDS
+#define HOST_ACTION_COMMANDS
#if ENABLED(HOST_ACTION_COMMANDS)
//#define HOST_PAUSE_M76 // Tell the host to pause in response to M76
- //#define HOST_PROMPT_SUPPORT // Initiate host prompts to get user feedback
+ #define HOST_PROMPT_SUPPORT // Initiate host prompts to get user feedback
#if ENABLED(HOST_PROMPT_SUPPORT)
//#define HOST_STATUS_NOTIFICATIONS // Send some status messages to the host as notifications
#endif
@@ -3875,7 +3877,7 @@
*
* Implement M486 to allow Marlin to skip objects
*/
-//#define CANCEL_OBJECTS
+#define CANCEL_OBJECTS
#if ENABLED(CANCEL_OBJECTS)
#define CANCEL_OBJECTS_REPORTING // Emit the current object as a status message
#endif
@@ -4233,7 +4235,7 @@
//
// M43 - display pin status, toggle pins, watch pins, watch endstops & toggle LED, test servo probe
//
-//#define PINS_DEBUGGING
+#define PINS_DEBUGGING
// Enable Tests that will run at startup and produce a report
//#define MARLIN_TEST_BUILD
diff --git a/platformio.ini b/platformio.ini
index e3bdb6f586..4060b2ad50 100644
--- a/platformio.ini
+++ b/platformio.ini
@@ -13,7 +13,7 @@
[platformio]
src_dir = Marlin
boards_dir = buildroot/share/PlatformIO/boards
-default_envs = mega2560
+default_envs = simulator_linux_debug
include_dir = Marlin
extra_configs =
Marlin/config.ini
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment