Single nozzle filament change (#11994)

This commit is contained in:
InsanityAutomation
2018-10-07 18:06:14 -04:00
committed by Scott Lahteine
parent bfcf570d68
commit 74cd6cb4fc
94 changed files with 1267 additions and 38 deletions

View File

@ -35,6 +35,10 @@
#include "../../feature/leds/leds.h"
#endif
#if ENABLED(SINGLENOZZLE)
#include "../../module/tool_change.h"
#endif
/**
* M104: Set hot end temperature
*/
@ -44,12 +48,12 @@ void GcodeSuite::M104() {
const uint8_t e = target_extruder;
#if ENABLED(SINGLENOZZLE)
if (e != active_extruder) return;
#endif
if (parser.seenval('S')) {
const int16_t temp = parser.value_celsius();
#if ENABLED(SINGLENOZZLE)
singlenozzle_temp[e] = temp;
if (e != active_extruder) return;
#endif
thermalManager.setTargetHotend(temp, e);
#if ENABLED(DUAL_X_CARRIAGE)
@ -85,14 +89,14 @@ void GcodeSuite::M109() {
if (get_target_extruder_from_command()) return;
if (DEBUGGING(DRYRUN)) return;
#if ENABLED(SINGLENOZZLE)
if (target_extruder != active_extruder) return;
#endif
const bool no_wait_for_cooling = parser.seenval('S'),
set_temp = no_wait_for_cooling || parser.seenval('R');
if (set_temp) {
const int16_t temp = parser.value_celsius();
#if ENABLED(SINGLENOZZLE)
singlenozzle_temp[target_extruder] = temp;
if (target_extruder != active_extruder) return;
#endif
thermalManager.setTargetHotend(temp, target_extruder);
#if ENABLED(DUAL_X_CARRIAGE)
@ -115,13 +119,8 @@ void GcodeSuite::M109() {
#endif
#if ENABLED(ULTRA_LCD)
const bool heating = thermalManager.isHeatingHotend(target_extruder);
if (heating || !no_wait_for_cooling)
#if HOTENDS > 1
lcd_status_printf_P(0, heating ? PSTR("E%i " MSG_HEATING) : PSTR("E%i " MSG_COOLING), target_extruder + 1);
#else
lcd_setstatusPGM(heating ? PSTR("E " MSG_HEATING) : PSTR("E " MSG_COOLING));
#endif
if (thermalManager.isHeatingHotend(target_extruder) || !no_wait_for_cooling)
thermalManager.set_heating_message(target_extruder);
#endif
}

View File

@ -27,6 +27,11 @@
#include "../gcode.h"
#include "../../Marlin.h" // for fan_speed — should move those to Planner
#if ENABLED(SINGLENOZZLE)
#include "../../module/motion.h"
#include "../../module/tool_change.h"
#endif
/**
* M106: Set Fan Speed
*
@ -42,6 +47,15 @@
*/
void GcodeSuite::M106() {
const uint8_t p = parser.byteval('P');
const uint16_t s = parser.ushortval('S', 255);
#if ENABLED(SINGLENOZZLE)
if (p != active_extruder) {
if (p < EXTRUDERS) singlenozzle_fan_speed[p] = MIN(s, 255U);
return;
}
#endif
if (p < FAN_COUNT) {
#if ENABLED(EXTRA_FAN_SPEED)
const int16_t t = parser.intval('T');
@ -55,14 +69,12 @@ void GcodeSuite::M106() {
fan_speed[p] = new_fan_speed[p];
break;
default:
new_fan_speed[p] = MIN(t, 255);
new_fan_speed[p] = MIN(t, 255U);
break;
}
return;
}
#endif // EXTRA_FAN_SPEED
const uint16_t s = parser.ushortval('S', 255);
fan_speed[p] = MIN(s, 255U);
}
}
@ -72,6 +84,13 @@ void GcodeSuite::M106() {
*/
void GcodeSuite::M107() {
const uint16_t p = parser.ushortval('P');
#if ENABLED(SINGLENOZZLE)
if (p != active_extruder) {
if (p < EXTRUDERS) singlenozzle_fan_speed[p] = 0;
return;
}
#endif
if (p < FAN_COUNT) fan_speed[p] = 0;
}