[2.0.x] Macro G-codes#9365
Conversation
|
Just because I'm curious: Wouldn't it be easier in your case to use slicers gcode on tool change section? |
|
@Sebastianv650 I did exactly that so far. But let me add two more pieces for the complete picture. First, my printer has interchangeable hotends, and a E3D Volcano requires a different material change procedure than a regular E3D hotend. Second, there is a post-processing script involved which adds all the required purge tower stuff to the g code generated by slic3r. The script does automatic placement of the towers and I want the tool change to happen at the position of the purge towers. So far I used self-defined placeholders in the slic3r tool change g-codes which were replaced by the post-processing script with the coordinates of the purge towers. But this way the script has to scan lots of g code lines for the placeholders to replace them. To fasten things up I decided to have the script handle the complete tool change/purge tower procedure. That's where the g-code macro idea came into play because this way the script just places a single M810 when the material change should happen. What M810 means for the current print is defined in the slic3r start g-code section. Maybe this macro stuff is complete nonsense, and I'm not sure it's a general purpose feature for Marlin, either. But it's implemented now, so if anyone has use for it, there you go. |
e925eb0 to
934a03c
Compare
|
Hmm, I see that actually this cannot work without further additions. First of all, if you use If, as I attempted to do, you instead use The correct way to deal with multiple commands is to use So, in order to support this feature, the G-code core parser would need to be extended with an additional variable ( |
|
@thinkyhead thank you for the feedback. I'll have a look at And I understand from your changes that configuration for this kind of feature should be placed into |
|
Most new options should go in |
6534523 to
779001c
Compare
|
@revilor I've finished this up but haven't yet given it a test run. Have a look at your earliest convenience. If it works as-advertised then it can get merged soon. |
|
@thinkyhead I've been working on more complex extension of the command queue. To not mix it up with this PR I created a separate PR #9479. I can of course also integrate my queue extensions into this PR in case you prefer it that way. |
|
@thinkyhead Thank you for your latest additions to this PR, everything works fine for me. Feel free to merge and deal with PR #9479 independently. |
Let's keep that separate. It needs to be more carefully considered. We have very limited SRAM to use, and the current PSTR-based method works well to keep RAM use low. A "command stack" is going to involve another large, persistent buffer, which never makes us happy. Obviously for 1284p with its generous 16K or SRAM, no problem. But most of us are still using Mega2560, and are already very close to limits. Use |
422fe87 to
8916532
Compare
8b99060 to
a01473d
Compare
2308508 to
1e946d6
Compare
0226dcc to
834ea7f
Compare
9fb4e95 to
ad12b9b
Compare
5f6db62 to
d0c96ee
Compare
9d867f9 to
849dea9
Compare
579c7f3 to
d52deeb
Compare
|
I have most of my printers are tuned very similar and can use the same print profile other than the start and stop g-code. I have been toying with the idea to have the start and end g-code of each of my printers embedded in the machine/firmware. This may be a good use case for this pull request. I could embed M810 in my start script and M811 for my stop script. This would make my sliced g-code universal across all my printers similar to tool paths for CNC. |
8a7664f to
5d487ef
Compare
19bb675 to
68f03dc
Compare
68f03dc to
7d900b3
Compare
|
I've rebased this and updated the code to use the Also:
To obtain the updated code in your working copy… |
7d900b3 to
4bb96af
Compare
4bb96af to
8c6254e
Compare
8c6254e to
6aae746
Compare
* Synchronize on M204, M205 (MarlinFirmware#12302) * Add parser.seen for multiple parameters * Fix M666, use !seen for report * Synchronize on M204, M205 * Ignore ARM-based Teensy library on ATUSB90-based Teensy (MarlinFirmware#12311) Works around PIO src_filter behavior (see platformio/platformio-core#1905) * Tweak / reduce menu items * IS_DELTA => ENABLED(DELTA) * Clear up HAS_WORKSPACE_OFFSET meaning * Revive SCARA's home offset (unimplemented) * Use first_page flag in place of page.page == 0 * Apply #pragma once, misc cleanup (MarlinFirmware#12322) * Apply #pragma once in headers * Adjust some thermistors formatting * Misc cleanup and formatting * Fix broken LPC176x build (MarlinFirmware#12317) * Fix broken LPC176x build * Add UBL+HD44780 test for LPC1768 * Return to status to show manual deploy/stow messages (MarlinFirmware#12324) * Add servos to pins_FYSTEC_F6_13.h * Remove dead comment * Fix VMAX editing Fix MarlinFirmware#12326 * Use board-specific or platform SPI pins in HAL_STM32 (MarlinFirmware#12323) * Suppress some compile warnings * Fix EEPROM servo angles init, section grouping * Drop 'register' storage specifier * Provide DOGLCD SPI pins for MKS SBASE + VIKI * Update Italian language (MarlinFirmware#12327) * Allow disable of LCD_TIMEOUT_TO_STATUS (when 0) * Clean up some U8G files * Clean up file endings * Turn PlatformIO LDF off for LPC176x builds (MarlinFirmware#12334) * Update, correct sanity-checks for up to 6 extruders (MarlinFirmware#12333) * Extend error messages for E factors sanity-checks * ENABLED(NEWPANEL) => HAS_LCD_MENU * MSG_UBL_EDIT_MESH_MENU => MSG_EDIT_MESH * Add a mesh edit menu for MBL / ABL-Bilinear * Add MESH_EDIT_MENU to example configs * Cleanups for leveling-related code * M420 support in MARLIN_DEV_MODE * Fix endstops enable behavior during probing Fix a bug introduced in MarlinFirmware#9582 * Recommend keeping endstops off * Fix 'M43 T' to use 'L' as last pin - The documentation is correct. The code was wrong. * Provide a default for Z_PROBE_LOW_POINT * Use multiplier edit item for mesh point editing * Update and fix CHDK * Clean up ENCODER_RATE_MULTIPLIER config * G28 O respects HOME_AFTER_DEACTIVATE Addressing MarlinFirmware#11271 * Prevent current step-down going negative Addressing MarlinFirmware#11348 * Fix "circle" * Fix MBL XY parameter error messages Fix MarlinFirmware#11522 * Updated slovak translation (MarlinFirmware#12338) * Update German language (MarlinFirmware#12336) * Hide mesh editing until a valid mesh exists * Restore LPC1768_PIN_INTERRUPT_M, apply to Z3 - In reference to MarlinFirmware#12166 * Clean up bq Zum Mega 3D pins * Remove trailing whitespace * Add Geeetech Rostock 301 config, update GTM32 Pro VB pins (MarlinFirmware#12345) * Update Italian language (MarlinFirmware#12344) * Change Marlin debug flag names to fix conflicts (MarlinFirmware#12340) In reference to MarlinFirmware#11000 * LCD menu code refactoring and cleanup (MarlinFirmware#12308) * Show the appropriate pause message (MarlinFirmware#12348) * Fixed advanced pause messages (MarlinFirmware#12353) * Apply some tool-change cleanup * More advanced pause tweaks (MarlinFirmware#12356) * Followup to LCD_TIMEOUT_TO_STATUS=0 * Make continuous purge screen fit 20x4 * Unify purge message modes * Preserve last-set pause header mode * Update German translation (MarlinFirmware#12355) * Update Slovak translation (MarlinFirmware#12354) * Update Italian language (MarlinFirmware#12352) * Fix const pointer assignment compile error (MarlinFirmware#12350) * Use IS_SD_PRINTING() more * Use card.stopSDPrint() for completeness * Fix Resume from SD Pause In reference to MarlinFirmware#12098 (comment) * Restore GTM32_PRO_VB temp and heater pins Undo MarlinFirmware#12345 * Set CUSTOM_MACHINE_NAME for some configs * Combine more tool-change variables (MarlinFirmware#12137) * Fix up xdiff, ydiff, zdiff in tool change Followup to MarlinFirmware#12137 * Clean trailing whitespace * Apply HAS_LCD_MENU in EEPROM code * Remove obsolete comments * Extend pins errors to include the processor * More comprehensive NO_LCD_MENUS (MarlinFirmware#12367) * No error on T0 with single-extruder and fix MIXING_EXTRUDER virtual tools (MarlinFirmware#12375) * Update Slovak translation (MarlinFirmware#12376) * Update Italian language (MarlinFirmware#12368) * [2.0.x] Macro G-codes (MarlinFirmware#9365) * Fix M91x sanity-check to permit TMC2660 Fix MarlinFirmware#12362 * Solve endstops issues (MarlinFirmware#12382) - Partially reverts MarlinFirmware#11900 and tries to solve MarlinFirmware#12336 * Update German language (MarlinFirmware#12379) * Have 'mfdoc' open the local site when it's ready * Add reference comments to MeshLevelingState * Break out of 'mfpub' if 'gh-pages' checkout fails * Use 'serial_spaces' in 'print_2d_array' * Tweak 'echo_not_entered' used by MBL's G29 * Tevo Little Monster example configuration (MarlinFirmware#12370) * Allow G26 to use the active extruder (MarlinFirmware#12387) * Make lcd_quick_feedback argument optional * Add click_to_cancel option to wait_for_hotend/bed * Have G26 use the active nozzle and wait_for_hotend/bed * Use wait_for_release in UBL G29 * Add 'T' parameter to G26 for an initial tool-change * Update Raptor config * Update HAL and libs formatting * Reduce code size with plain inlines * Apply extra condition to LCD_PROGRESS_BAR * Adjust some comment spacing * Encapsulate common display code in a singleton (MarlinFirmware#12395) * Encapsulate common LCD code in a singleton * Depend more UBL code on UBL_DEVEL_DEBUGGING - Since most users don't need the debugging on at all times, this helps reduce the default build size for UBL by over 2K, a little closer to fitting on 128K boards. * Clean up LCD width/height determination * For now (!) don't synchronize in M204 and M205 See if this has any deleterious effect on motion planning by slicers that inser their own jerk and acceleration controls. The problem I see is that these settings can take effect on blocks already in the planner, and the only way around this would be to shadow these settings in planner blocks and use the shadowed settings in the planner. * Update UBL comments for debug change * Differentiate translated On/Off from Serial ON/OFF * Fix BABYSTEP_ZPROBE_OFFSET (MarlinFirmware#12408) Fix MarlinFirmware#12399 Did not compile without `WATCH_HOTENDS || WATCH_THE_BED`. Add condition to include "../../module/temperature.h". * Clear old _site contents on regeneration * Followup to 50af1d1 * Add M412 to enable/disable filament runout detection (MarlinFirmware#12406) * Clean TLM trailing whitespace * Group status methods, share reset_status with Extensible UI (MarlinFirmware#12414) * Group status methods, share reset_status with Extensible UI * Move common DOGM code to headers * Refine endstops fixes (MarlinFirmware#12413) When endstops/probe are enabled `ENDSTOP_NOISE_THRESHOLD` calls to `update` are required to properly re-sync endstops/probe status. * Fix tool-change for MIXING_EXTRUDER with < 2 virtual tools (MarlinFirmware#12417) Fix MarlinFirmware#12416 Better handling of `ENABLED(MIXING_EXTRUDER) && !MIXING_VIRTUAL_TOOLS > 1` - to not fall through to the general case. Fix compiler warnings for `#elif EXTRUDERS < 2`. * Debug of G2-G3 for UBL (MarlinFirmware#12386) Changes only affect UBL. Everything else is left alone. * Updates to Formbot T-Rex 2+ configuration files (MarlinFirmware#12422) Updates to Formbot T-Rex 2+ configuration files * Endstops fix followup (MarlinFirmware#12423) Followup to MarlinFirmware#12413 * Add required "cardreader.h" include (MarlinFirmware#12419) * Update Portuguese-Brazilian translation (MarlinFirmware#12402) * Fix Formbot Trex-2+ configs Followup to MarlinFirmware#12422 * Clean up pins files * UltiMachine Archim 1 support (MarlinFirmware#12404) * Fix an old sanity check * hasstatus => has_status * Move RRW keypad code to a common method (MarlinFirmware#12429) * Rejigger Filament Runout class (MarlinFirmware#12428) * Miscellaneous LCD code renaming, reordering (MarlinFirmware#12430) * Move special characters to language.h * Apply some naming standards * Clean up menu item draw functions * Rename some Temperature methods * UI => ExtUI * Fix to runout sensor code. (MarlinFirmware#12431) - "old_state" is no longer a class static variable. * Optimize target_extruder, ignore T with mixing (MarlinFirmware#12432) * Optimize target_extruder, ignore T with mixing * Give G-code Tn parity with tool_change * Fix GcodeSuite::T active_extruder reference * Tweak extruder errors * No need for Cap:PAREN_COMMENTS * Support two MAX6675 thermocouples (MarlinFirmware#8686) * Optimize Power-Loss Recovery (MarlinFirmware#12440) * Consolidate, optimize some LCD menu code (MarlinFirmware#12450) * Make CardReader class static (MarlinFirmware#12451) * Make CardReader a static class * Make CardReader flags into bitfields * Use 'target_extruder' in M104 as with M109 (MarlinFirmware#12448) * Enable SD Card on RepRap Display and RADDS (MarlinFirmware#12446) * Enable SD Card on RepRap Display and RADDS Define the necessary pins in `pins_RADDS.h` (copied from the `RADDS_DISPLAY` section) for the use of the SD card slot on RRD. * Fix a compile warning (MarlinFirmware#12452) * Allow float XY probe offsets Responding to MarlinFirmware#12383 XY probe offsets should be integers because adding decimal points makes the code larger. But if decimals are very much wanted, this commit removes the old restriction. * Followup to static CardReader * Change temperature pin order for RemRam V1 (MarlinFirmware#12458) Beta testers suggested to adopt the RAMPS order of temperature probe connectors. This commit fixes the order to the RAMPS order. * Fix compile error with SD_FIRMWARE_UPDATE (MarlinFirmware#12462) * Fix compile error with ZONESTAR_LCD+NO_LCD_MENUS (MarlinFirmware#12466) * Don't start watching heaters when target is 0 (MarlinFirmware#12453) * Various fixes for MarlinUI and ExtUI (MarlinFirmware#12439) * Remove extra include * Fix MAX_MESSAGE_LENGTH * Fix access to the DWT peripheral for STM32 HAL (MarlinFirmware#12434) Access to the DWT peripheral for the `CYCCNT` register needs to happen before `main()`. The code needs to be called after the setup of the system clocks, so the right place is between the `premain()` and `main()` function of the STM32 Arduino core. This patch moves the DWT access code to a new function, which is then placed between `premain()` and `main()`. * Fix "no effect" and "unused variable" compile warnings (MarlinFirmware#12473) * Update M303.cpp (MarlinFirmware#12471) * Fixed displaying of kill MSG_OUTAGE_RECOVERY string. (MarlinFirmware#12470) * GTM32 Pro VB changes from Markku Sinisalo * Combine Travis CI option-setting commands (MarlinFirmware#12474) * Fix LCD compile error, etc. (MarlinFirmware#12472) * Clean up some u8g code (MarlinFirmware#12476) * Get u8g reference for lcdprint * Modify MBL to use IJ instead of XY (MarlinFirmware#12478) * Corrected unused var, default switch, Travis tests (MarlinFirmware#12477) * Fix compilation errors. Followup to MarlinFirmware#12439 (MarlinFirmware#12481) * Fix for MarlinFirmware#12482 (MarlinFirmware#12483) Fix Z-move to uninitialized position in SWITCHING_EXTRUDERS tool_change (no_move=true) * Revert MarlinFirmware#12311 PIO LDF work-around (MarlinFirmware#12484) * Followup to MarlinFirmware#12451 * Apply/unapply const here and there * Shift YZ on graphical display to fit Z+123.45 * Don't show updir with no card present * Expanded options for _Statusscreen.h (MarlinFirmware#12455) See the PR for full details. The updated system will be documented on the website in the near future. * Revert some const changes (for now) * Fix ADC_KEYPAD middle button (MarlinFirmware#12493) * Invert hotend bitmaps, by default * General cleanup of Re-ARM pins * Fix problems with LPC1768 EEPROM flash emulation (MarlinFirmware#12503) * Remove duplicate calls to PrepareSector Some flash memory API calls require that a call to `PrepareSector` is done before use. However this call is already made by the LPC1768 framework so the calls in this code are not required. * Ensure correct alignment of RAM buffer The LPC176X flash API requires that the RAM buffer used for write operations must be word-aligned. This change ensures that this is the case. * Additional pin definitions for Archim 2 (MarlinFirmware#12500) - Added GPIO pins to Archim 2 - Added new 108 pin to `fastio_Due.h` * Use superscript 3 in language_en.h (MarlinFirmware#12504) * Fix a minor compile warning * Revert ADC_KEYPAD direction behavior (MarlinFirmware#12508) * Remove extra declarations in cardreader.cpp (MarlinFirmware#12520) * Fast PWM for controller fan (MarlinFirmware#12485) * Bring superscripts slightly lower in BDF fonts * Clean up font data generation script * Don't show superscript ³ with NOT_EXTENDED_ISO10646_1_5X7 (MarlinFirmware#12513) * Fix backslash in language_test.h * Use wait_for_bed with WAIT_FOR_BED_HEATER Addressing MarlinFirmware#12517 * Allow Serial Overrun Protection to be disabled * Hide some compile warnings * Put status screen options in Configuration_adv.h * Update Italian language (MarlinFirmware#12512) * NUM_ARRAY => COUNT * Update Turkish language (MarlinFirmware#12524) * Correct FANMUX2_PIN (MarlinFirmware#12538) * Update Slovak translation (MarlinFirmware#12523) * Fix wait_for_bed compile error * Add support for FYSETC F6 V1.3 board (MarlinFirmware#12527) * Fix English special symbols (MarlinFirmware#12529) * Adjust Formbot Raptor pins * Add missing boards to Makefile * Add Formbot Raptor2 and Raise3D pins (MarlinFirmware#12532) * Add Formbot Raptor2 board * Add Raise3D Rumba board * Add sample config for Delta with MKS SBASE (MarlinFirmware#10819) * Hide M217 compile warning * Improve runout sensor, fix LIGHTWEIGHT_UI screen size (MarlinFirmware#12544) * Save recovery info on SD pause * Space out multiple edit lines a bit * Fix runout debug output Followup to MarlinFirmware#12544 * Add poll_runout_states, which returns 1 for runouts (MarlinFirmware#12547) * Add heating progress bars (MarlinFirmware#12543) * Followup to heating progress * Fans loop macro * Fix "paused" message and M125 called by M25 (MarlinFirmware#12551) * Fix Skew factors (MarlinFirmware#12555) - Ensure Skew factors are calculated from test square measurements * Fix "No SD Card" indicator * Tweak FR icon. Update font data. * A single SERIAL_ECHO macro type (MarlinFirmware#12557) * Fix angles for disabled EDITABLE_SERVO_ANGLES (MarlinFirmware#12559) * Move stepper enable/disable to stepper_indirection.h (MarlinFirmware#12562) * Tweaks to endstops code * Remove AVR-only MARLIN_DEV_MODE code * Fix pause/resume SD print Followup to MarlinFirmware#12551, addressing MarlinFirmware#12566 * Alternative fan image option (MarlinFirmware#12579) * Alternative fan bitmap * Move bed over by 3px * Print a space after scrolling status * Don't include STM32 Core code when compiling STM32 Generic (MarlinFirmware#12575) * Build and CI fixes and optimizations (MarlinFirmware#12584) -Disable LDF "deep+" mode on AT90USB platforms. Appears not needed any longer (likely due to fix platformio/platformio-core@7322df2). Results in identical binary output and cuts compile time in half -Disable Cartesio config from CircleCI (compile failure) -Disable Geetech I3 Pro X GT2560 from CircleCI (compile failure) -Enable EEPROM on Micromake example config (fix compile failure) -Move FolgerTech/i3-2020 to AVR platform in CircleCI (fix CirculeCI build failure) -Disable various examples failing to build in CircleCI -Enable various examples no longer failing to build in CircleCI * Fix up some delta settings * Update mfpub * Trinamic: Split stealthChop, improve driver monitoring, etc. (MarlinFirmware#12582) * Signal an invalid mesh for M420 enable / load * Tweak config formatting * Link to font docs in ultralcd_DOGM.cpp * Sanity-check for negative steps, feedrate, accel * M425 Backlash Correction (MarlinFirmware#11061) * Add Z_MIN_PROBE_PIN to MKS SBASE pins * Refresh screen on SD Init * Followup to servo angles patch Fix MarlinFirmware#12594 * Simpler AVR + Trinamic + Soft Serial sanity-check (MarlinFirmware#12606) * Fix some serial echos of pin states * Center ABL grid on bed with H parameter. (MarlinFirmware#12610) * Align classic bed icon consistently * Improve some config comments readability (MarlinFirmware#12615) * Fix broken pins file include (MarlinFirmware#12617) * TMC connection test, spreadCycle parameters, improved debugging (MarlinFirmware#12616) * Sanity-check LIGHTWEIGHT_UI, move comment up (MarlinFirmware#12630) * Allow ExtUI to use LCD_SET_PROGRESS_MANUALLY (MarlinFirmware#12628) * Add spreadCycle parameter sets (MarlinFirmware#12645) * [2.0.x] G33 clean up (MarlinFirmware#12648) Remove obsolete workarounds in G33 for the now fixed zprobe_zoffset bug * [2.0.x] Enable PIDTEMPBED in Anet A8 example config (MarlinFirmware#12655) * [2.0.x] Set DEFAULT_NOMINAL_FILAMENT_DIA to 1.75 in Anet A6 config (MarlinFirmware#12664) * [2.0.x] Update Czech translation (MarlinFirmware#12683) * Squelch warning mentioned in MarlinFirmware#11061 (MarlinFirmware#12676) * [2.0.x] Limit PID autotune target to maxtemp-15 (MarlinFirmware#12691) * Limit set hotend temperature to maxtemp. (MarlinFirmware#12690) * Added MKS MINI 12864 support to FYSETC F6 V1.3 (MarlinFirmware#12656) * FYSETC F6 13 - E2_SERIAL_TX_PIN correction (MarlinFirmware#12667) * Followup to MarlinFirmware#12691 (typo) * GTM32 Pro VB FAN-PIN correction (MarlinFirmware#12666) * Add Formbot 350c Thermistor (MarlinFirmware#12661) * Add support for MKS Robin board (MarlinFirmware#12650) Implement initial support for MKS Robin (STM32F103ZET6) board. Custom build script is used to generate encrypted firmware compatible with original MSK Robin bootloader (i.e. safe firmware update from SD card and possibility to go back to original close-source firmware). * Wanhao Duplicator i3 Plus pins create (MarlinFirmware#12701) * Update Formbot T-Rex 3 pins (MarlinFirmware#12662)
This PR adds g codes M810 to M819 which allow to define g code macros.
Example usage:
Define macro 0
M810 G1 X0 Y0 Z0 F200|G4 S10|G1 X10 Y10 Z10
Use macro 0
M810
will enqueue the g code commands
G1 X0 Y0 Z0 F200
G4 S10
G1 X10 Y10 Z10
Background: for my multi-material setup based on a Prusa stepper multiplexer and a self-designed 4x Y-Splitter I needed material change procedures which are more complex than what M701 and M702 provides. As it is a very specific requirement for my setup it makes no sense to extend M701 and M702 accordingly. Instead I added a way to create macros which may be a useful feature for other Marlin users and different use cases, too.