Followup fixes for singlenozzle, etc. (#17712)

This commit is contained in:
studiodyne
2020-04-28 07:21:23 +02:00
committed by GitHub
parent 4f003fc7a7
commit 89b17b5463
10 changed files with 61 additions and 34 deletions

View File

@ -2861,6 +2861,17 @@ void Planner::set_max_jerk(const AxisEnum axis, float targetValue) {
#if ENABLED(AUTOTEMP)
void Planner::autotemp_update() {
#if ENABLED(AUTOTEMP_PROPORTIONAL)
const int16_t target = thermalManager.degTargetHotend(active_extruder);
autotemp_min = target + AUTOTEMP_MIN_P;
autotemp_max = target + AUTOTEMP_MAX_P;
#endif
autotemp_factor = TERN(AUTOTEMP_PROPORTIONAL, AUTOTEMP_FACTOR_P, 0);
autotemp_enabled = autotemp_factor != 0;
}
void Planner::autotemp_M104_M109() {
#if ENABLED(AUTOTEMP_PROPORTIONAL)

View File

@ -824,6 +824,7 @@ class Planner {
static bool autotemp_enabled;
static void getHighESpeed();
static void autotemp_M104_M109();
static void autotemp_update();
#endif
#if HAS_LINEAR_E_JERK

View File

@ -193,7 +193,7 @@ const char str_t_thermal_runaway[] PROGMEM = STR_T_THERMAL_RUNAWAY,
NOMORE(speed, 255U);
#if ENABLED(SINGLENOZZLE)
#if ENABLED(SINGLENOZZLE_STANDBY_FAN)
if (target != active_extruder) {
if (target < EXTRUDERS) singlenozzle_fan_speed[target] = speed;
return;

View File

@ -47,11 +47,12 @@
bool toolchange_extruder_ready[EXTRUDERS];
#endif
#if ENABLED(SINGLENOZZLE)
#if ENABLED(SINGLENOZZLE_STANDBY_TEMP)
uint16_t singlenozzle_temp[EXTRUDERS];
#if HAS_FAN
uint8_t singlenozzle_fan_speed[EXTRUDERS];
#endif
#endif
#if BOTH(HAS_FAN, SINGLENOZZLE_STANDBY_FAN)
uint8_t singlenozzle_fan_speed[EXTRUDERS];
#endif
#if ENABLED(MAGNETIC_PARKING_EXTRUDER) || defined(EVENT_GCODE_AFTER_TOOLCHANGE) || (ENABLED(PARKING_EXTRUDER) && PARKING_EXTRUDER_SOLENOIDS_DELAY > 0)
@ -822,7 +823,7 @@ void tool_change_prime() {
#if TOOLCHANGE_FS_FAN >= 0 && HAS_FAN
const int16_t fansp = thermalManager.fan_speed[TOOLCHANGE_FS_FAN];
thermalManager.fan_speed[TOOLCHANGE_FS_FAN] = toolchange_settings.fan_speed;
safe_delay(toolchange_settings.fan_time * 1000);
gcode.dwell(toolchange_settings.fan_time * 1000);
thermalManager.fan_speed[TOOLCHANGE_FS_FAN] = fansp;
#endif
@ -934,7 +935,7 @@ void tool_change(const uint8_t new_tool, bool no_move/*=false*/) {
// Z raise before retraction
#if ENABLED(TOOLCHANGE_ZRAISE_BEFORE_RETRACT) && DISABLED(SWITCHING_NOZZLE)
if (can_move_away && TERN1(toolchange_settings.enable_park)) {
if (can_move_away && TERN1(TOOLCHANGE_PARK, toolchange_settings.enable_park)) {
// Do a small lift to avoid the workpiece in the move back (below)
current_position.z += toolchange_settings.z_raise;
#if HAS_SOFTWARE_ENDSTOPS
@ -956,8 +957,12 @@ void tool_change(const uint8_t new_tool, bool no_move/*=false*/) {
SERIAL_ECHO_MSG(STR_ERR_HOTEND_TOO_COLD);
if (ENABLED(SINGLENOZZLE)) { active_extruder = new_tool; return; }
}
else
unscaled_e_move(-toolchange_settings.swap_length, MMM_TO_MMS(toolchange_settings.retract_speed));
else {
// If first new tool, toolchange without unloading the old not initialized 'Just prime/init the new'
if (first_tool_is_primed)
unscaled_e_move(-toolchange_settings.swap_length, MMM_TO_MMS(toolchange_settings.retract_speed));
first_tool_is_primed = true; // The first new tool will be primed by toolchanging
}
}
#endif
@ -1059,15 +1064,16 @@ void tool_change(const uint8_t new_tool, bool no_move/*=false*/) {
const bool should_move = safe_to_move && !no_move && IsRunning();
if (should_move) {
#if ENABLED(SINGLENOZZLE)
#if HAS_FAN
singlenozzle_fan_speed[old_tool] = thermalManager.fan_speed[0];
thermalManager.fan_speed[0] = singlenozzle_fan_speed[new_tool];
#endif
#if BOTH(HAS_FAN, SINGLENOZZLE_STANDBY_FAN)
singlenozzle_fan_speed[old_tool] = thermalManager.fan_speed[0];
thermalManager.fan_speed[0] = singlenozzle_fan_speed[new_tool];
#endif
#if ENABLED(SINGLENOZZLE_STANDBY_TEMP)
singlenozzle_temp[old_tool] = thermalManager.temp_hotend[0].target;
if (singlenozzle_temp[new_tool] && singlenozzle_temp[new_tool] != singlenozzle_temp[old_tool]) {
thermalManager.setTargetHotend(singlenozzle_temp[new_tool], 0);
TERN_(AUTOTEMP, planner.autotemp_update());
TERN_(HAS_DISPLAY, thermalManager.set_heating_message(0));
(void)thermalManager.wait_for_hotend(0, false); // Wait for heating or cooling
}
@ -1101,7 +1107,7 @@ void tool_change(const uint8_t new_tool, bool no_move/*=false*/) {
#if TOOLCHANGE_FS_FAN >= 0 && HAS_FAN
const int16_t fansp = thermalManager.fan_speed[TOOLCHANGE_FS_FAN];
thermalManager.fan_speed[TOOLCHANGE_FS_FAN] = toolchange_settings.fan_speed;
safe_delay(toolchange_settings.fan_time * 1000);
gcode.dwell(toolchange_settings.fan_time * 1000);
thermalManager.fan_speed[TOOLCHANGE_FS_FAN] = fansp;
#endif
}
@ -1245,10 +1251,9 @@ void tool_change(const uint8_t new_tool, bool no_move/*=false*/) {
// Migrate the temperature to the new hotend
#if HAS_MULTI_HOTEND
thermalManager.setTargetHotend(thermalManager.degTargetHotend(active_extruder), migration_extruder);
#if HAS_DISPLAY
thermalManager.set_heating_message(0);
#endif
thermalManager.setTargetHotend(thermalManager.temp_hotend[active_extruder].target, migration_extruder);
TERN_(AUTOTEMP, planner.autotemp_update());
TERN_(HAS_DISPLAY, thermalManager.set_heating_message(0));
thermalManager.wait_for_hotend(active_extruder);
#endif

View File

@ -108,11 +108,12 @@
#endif
#if ENABLED(SINGLENOZZLE)
#if ENABLED(SINGLENOZZLE_STANDBY_TEMP)
extern uint16_t singlenozzle_temp[EXTRUDERS];
#if HAS_FAN
extern uint8_t singlenozzle_fan_speed[EXTRUDERS];
#endif
#endif
#if BOTH(HAS_FAN, SINGLENOZZLE_STANDBY_FAN)
extern uint8_t singlenozzle_fan_speed[EXTRUDERS];
#endif
TERN_(ELECTROMAGNETIC_SWITCHING_TOOLHEAD, void est_init());