From d195107d747f2cbd1a6b9f5ddfe0022bea59a3d7 Mon Sep 17 00:00:00 2001 From: Leo Meyer Date: Tue, 12 Aug 2025 09:49:50 +0200 Subject: [PATCH 1/3] Update README.md --- README.md | 56 ++++++++++++++++++++++++++++++++++++++++++------------- 1 file changed, 43 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index 3ef650ef54..d224b4b4f2 100644 --- a/README.md +++ b/README.md @@ -1,23 +1,53 @@ ## Knutwurst's i3 MEGA M/S/P/X/Chiron/4MP2 Hybrid Firmware
(based on Marlin 2.1.x) -## Übersicht +## Fork purpose: Avoid nozzle heat loss during bed heating at the start of a print (new parameter C for G-code M104) -Marlin is optimized to build with the **PlatformIO IDE** extension for **Visual Studio Code**. You can still build Marlin with **Arduino IDE**, and we hope to improve the Arduino build experience, but at this time PlatformIO is the better choice. +## For a detailed description, license etc. please see the [original repository](https://github.com/knutwurst/Marlin-2-0-x-Anycubic-i3-MEGA-S). -### Wenn dir gefällt, was ich mache, kannst du mir hier einen Kaffee spendieren*: [![Donate](https://img.shields.io/badge/Donate-PayPal-green.svg)](https://paypal.me/oliverkoester) -*Es muss jetzt keine großzügige Spende sein. Ein paar Cent reichen um mir zu zeigen, wer überhaupt Interesse daran hat und wem die Weiterentwicklung wichtig ist. So bleibt die Motivation da und ich weiß einfach, dass ich nicht für die Tonne programmiere ;) +This fork attempts to fix or at least alleviate the problem of nozzle heat loss while the printer is waiting for the bed to heat up. +Cura, for example, by default emits G-code that waits for 60 seconds after bed heating starts until nozzle heating begins. +When experimenting with new filament types it is often the case that settings need to be tweaked; so, printing is stopped relatively early +and the model is sliced again. If it takes only a few seconds until the print can be restarted the bed and nozzle do not fully cool down. +As the bed typically requires more time to heat up than the nozzle it is being given a "head start" of 60 seconds. +However, if the nozzle is not being heated during this time, it cools down by a lot and needs to be re-heated once the 60 seconds are up. +This results in an annoying loss of time, especially if a print run needs to be re-started often. -## Overview +Typical Cura G-code looks like this (from _Machine Settings_, _Start G-code_): -- [Beginner's Guide](https://github.com/knutwurst/Marlin-2-0-x-Anycubic-i3-MEGA-S/wiki/Beginner's-Guide-(English)) -- [Features](https://github.com/knutwurst/Marlin-2-0-x-Anycubic-i3-MEGA-S/wiki/Features-(English)) -- [Frequently asked questions (FAQ)](https://github.com/knutwurst/Marlin-2-0-x-Anycubic-i3-MEGA-S/wiki/FAQ-(english)) -- [Wiki/Tutotrials](https://github.com/knutwurst/Marlin-2-0-x-Anycubic-i3-MEGA-S/wiki) -- [Official Facebook-Group (german)](https://www.facebook.com/groups/knutwurst/) -- [Downloads](https://github.com/knutwurst/Marlin-2-0-x-Anycubic-i3-MEGA-S/releases) + ... + M107 ; start with the fan off + M140 S80 ; Start heating the bed + G4 S60 ; wait 1 minute + M104 S235 ; start heating the hot end + M190 S80 ; wait for bed + M109 S235 ; wait for hotend + ... +This fork attempts to alleviate this problem by adding a new parameter to the [M104 G-code](https://marlinfw.org/docs/gcode/M104.html): **`C`** -### If you like what I do you can buy me a coffee*: [![Donate](https://img.shields.io/badge/Donate-PayPal-green.svg)](https://paypal.me/oliverkoester) -*It doesn't have to be a generous donation. A few cents are enough to show me who is interested in further development. So the motivation stays and I just know that I am not programming for the bin ;) +During the start of a print, right before bed heating begins, the slicer should emit a new command like e. g.: + M104 C100 + +This command sets the current extruder's target nozzle temperature to its **c**urrent value, but at least to 100 °C if the current value is less than that. +It overrides any following `S` specifications. If `I` has been specified it has no effect. It should not be used with the `F` autotemp flag; +at least this behavior has not been tested. It _should_ work on machines with multiple extruders (i. e. it respects the `T` parameter) but this case still needs to be tested as well. + +The effect of this line is that the nozzle temperature does not drop as much during bed heating, or is set to a sensible value when starting with a cold nozzle. +Subsequent nozzle heating takes less valuable time and conserves the user's nerves. + +Example for new Cura _Start G-code_: + + ... + M107 ; start with the fan off + M104 C100 ; avoid nozzle heat loss + M140 S80 ; Start heating the bed + ... + +This patch does not modify existing lines of code so it should (theoretically) not break anything if the new C parameter is not being used. +Further documentation than what's in the source code is not yet provided. + +Ideally this patch could be merged upstream into the Marlin repository. However, I have no proper way to test the effects as I do with Knutwurst's firmware. + +There may still be some minor issues (behavior with autotemp, conflicting parameters, ...) but the basic functionality works (at least on my machine ;-) From 47dc7c98a85fd09dfebe7ded9671c724888e41fb Mon Sep 17 00:00:00 2001 From: Leo Meyer Date: Tue, 12 Aug 2025 10:08:01 +0200 Subject: [PATCH 2/3] Add M104 parameter C: Sets the target temperature to the current temperature of the selected tool or to min_temp if it is higher. This can avoid unnecessary heat loss. --- Marlin/src/gcode/temp/M104_M109.cpp | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/Marlin/src/gcode/temp/M104_M109.cpp b/Marlin/src/gcode/temp/M104_M109.cpp index af3b691b58..d176cf12b5 100644 --- a/Marlin/src/gcode/temp/M104_M109.cpp +++ b/Marlin/src/gcode/temp/M104_M109.cpp @@ -50,9 +50,11 @@ * M109: Set Hotend Temperature target and wait * * Parameters - * I : Material Preset index (if material presets are defined) - * T : Tool index. If omitted, applies to the active tool - * S : The target temperature in current units. For M109, only wait when heating up. + * I : Material Preset index (if material presets are defined) + * T : Tool index. If omitted, applies to the active tool + * C : Sets the target temperature to the current temperature of the selected tool + * or to min_temp if it is higher. This can avoid unnecessary heat loss. + * S : The target temperature in current units. For M109, only wait when heating up. * * With AUTOTEMP... * F : Autotemp Scaling Factor. Set non-zero to enable Auto-temp. @@ -65,6 +67,7 @@ * Examples * M104 S100 : Set target to 100° and return. * M109 R150 : Set target to 150°. Wait until the hotend gets close to 150°. + * M104 C100 : Set target to 100° or the current temperature, whichever is higher. * * With PRINTJOB_TIMER_AUTOSTART turning on heaters will start the print job timer * (used by printingIsActive, etc.) and turning off heaters will stop the timer. @@ -92,8 +95,21 @@ void GcodeSuite::M104_M109(const bool isM109) { } #endif - // Get the temperature from 'S' or 'R' bool no_wait_for_cooling = false; + + // Avoid nozzle heat loss: + // If 'C' is specified for M104 keep the hotend at its current temperature. + // The value after 'C' specifies the minimum temperature (to avoid heating to e. g. 20 °C). + if (!got_temp && !isM109 && parser.seenval('C')) { + celsius_t min_temp = parser.value_celsius(); + temp = thermalManager.wholeDegHotend(target_extruder); + // If the current temperature is below the minimum, start heating to the minimum + if (temp < min_temp) + temp = min_temp; + no_wait_for_cooling = got_temp = true; + } + + // Get the temperature from 'S' or 'R' if (!got_temp) { no_wait_for_cooling = parser.seenval('S'); got_temp = no_wait_for_cooling || (isM109 && parser.seenval('R')); From cc80044e426b789b301e6cd012bf6d6b95b48d9f Mon Sep 17 00:00:00 2001 From: Leo Meyer Date: Tue, 12 Aug 2025 10:27:04 +0200 Subject: [PATCH 3/3] Revert "Update README.md" This reverts commit d195107d747f2cbd1a6b9f5ddfe0022bea59a3d7. --- README.md | 56 +++++++++++++------------------------------------------ 1 file changed, 13 insertions(+), 43 deletions(-) diff --git a/README.md b/README.md index d224b4b4f2..3ef650ef54 100644 --- a/README.md +++ b/README.md @@ -1,53 +1,23 @@ ## Knutwurst's i3 MEGA M/S/P/X/Chiron/4MP2 Hybrid Firmware
(based on Marlin 2.1.x) -## Fork purpose: Avoid nozzle heat loss during bed heating at the start of a print (new parameter C for G-code M104) +## Übersicht -## For a detailed description, license etc. please see the [original repository](https://github.com/knutwurst/Marlin-2-0-x-Anycubic-i3-MEGA-S). +Marlin is optimized to build with the **PlatformIO IDE** extension for **Visual Studio Code**. You can still build Marlin with **Arduino IDE**, and we hope to improve the Arduino build experience, but at this time PlatformIO is the better choice. -This fork attempts to fix or at least alleviate the problem of nozzle heat loss while the printer is waiting for the bed to heat up. -Cura, for example, by default emits G-code that waits for 60 seconds after bed heating starts until nozzle heating begins. -When experimenting with new filament types it is often the case that settings need to be tweaked; so, printing is stopped relatively early -and the model is sliced again. If it takes only a few seconds until the print can be restarted the bed and nozzle do not fully cool down. -As the bed typically requires more time to heat up than the nozzle it is being given a "head start" of 60 seconds. +### Wenn dir gefällt, was ich mache, kannst du mir hier einen Kaffee spendieren*: [![Donate](https://img.shields.io/badge/Donate-PayPal-green.svg)](https://paypal.me/oliverkoester) +*Es muss jetzt keine großzügige Spende sein. Ein paar Cent reichen um mir zu zeigen, wer überhaupt Interesse daran hat und wem die Weiterentwicklung wichtig ist. So bleibt die Motivation da und ich weiß einfach, dass ich nicht für die Tonne programmiere ;) -However, if the nozzle is not being heated during this time, it cools down by a lot and needs to be re-heated once the 60 seconds are up. -This results in an annoying loss of time, especially if a print run needs to be re-started often. -Typical Cura G-code looks like this (from _Machine Settings_, _Start G-code_): +## Overview - ... - M107 ; start with the fan off - M140 S80 ; Start heating the bed - G4 S60 ; wait 1 minute - M104 S235 ; start heating the hot end - M190 S80 ; wait for bed - M109 S235 ; wait for hotend - ... +- [Beginner's Guide](https://github.com/knutwurst/Marlin-2-0-x-Anycubic-i3-MEGA-S/wiki/Beginner's-Guide-(English)) +- [Features](https://github.com/knutwurst/Marlin-2-0-x-Anycubic-i3-MEGA-S/wiki/Features-(English)) +- [Frequently asked questions (FAQ)](https://github.com/knutwurst/Marlin-2-0-x-Anycubic-i3-MEGA-S/wiki/FAQ-(english)) +- [Wiki/Tutotrials](https://github.com/knutwurst/Marlin-2-0-x-Anycubic-i3-MEGA-S/wiki) +- [Official Facebook-Group (german)](https://www.facebook.com/groups/knutwurst/) +- [Downloads](https://github.com/knutwurst/Marlin-2-0-x-Anycubic-i3-MEGA-S/releases) -This fork attempts to alleviate this problem by adding a new parameter to the [M104 G-code](https://marlinfw.org/docs/gcode/M104.html): **`C`** -During the start of a print, right before bed heating begins, the slicer should emit a new command like e. g.: +### If you like what I do you can buy me a coffee*: [![Donate](https://img.shields.io/badge/Donate-PayPal-green.svg)](https://paypal.me/oliverkoester) +*It doesn't have to be a generous donation. A few cents are enough to show me who is interested in further development. So the motivation stays and I just know that I am not programming for the bin ;) - M104 C100 - -This command sets the current extruder's target nozzle temperature to its **c**urrent value, but at least to 100 °C if the current value is less than that. -It overrides any following `S` specifications. If `I` has been specified it has no effect. It should not be used with the `F` autotemp flag; -at least this behavior has not been tested. It _should_ work on machines with multiple extruders (i. e. it respects the `T` parameter) but this case still needs to be tested as well. - -The effect of this line is that the nozzle temperature does not drop as much during bed heating, or is set to a sensible value when starting with a cold nozzle. -Subsequent nozzle heating takes less valuable time and conserves the user's nerves. - -Example for new Cura _Start G-code_: - - ... - M107 ; start with the fan off - M104 C100 ; avoid nozzle heat loss - M140 S80 ; Start heating the bed - ... - -This patch does not modify existing lines of code so it should (theoretically) not break anything if the new C parameter is not being used. -Further documentation than what's in the source code is not yet provided. - -Ideally this patch could be merged upstream into the Marlin repository. However, I have no proper way to test the effects as I do with Knutwurst's firmware. - -There may still be some minor issues (behavior with autotemp, conflicting parameters, ...) but the basic functionality works (at least on my machine ;-)