Browse Source

Merge pull request #7079 from thinkyhead/bf_m600_fixes

M600 fixes
pull/1/head
Scott Lahteine 8 years ago
committed by GitHub
parent
commit
2e1b7d3a22
  1. 50
      Marlin/Marlin_main.cpp
  2. 4
      Marlin/mesh_bed_leveling.h
  3. 14
      Marlin/planner.cpp
  4. 9
      Marlin/ultralcd.cpp

50
Marlin/Marlin_main.cpp

@ -5866,7 +5866,7 @@ inline void gcode_M17() {
idle();
heaters_heating = false;
HOTEND_LOOP() {
if (thermalManager.degTargetHotend(e) && abs(thermalManager.degHotend(e) - thermalManager.degTargetHotend(e)) > 3) {
if (thermalManager.degTargetHotend(e) && abs(thermalManager.degHotend(e) - thermalManager.degTargetHotend(e)) > TEMP_HYSTERESIS) {
heaters_heating = true;
#if ENABLED(ULTIPANEL)
lcd_advanced_pause_show_message(ADVANCED_PAUSE_MESSAGE_WAIT_FOR_NOZZLES_TO_HEAT);
@ -5882,7 +5882,7 @@ inline void gcode_M17() {
) {
if (move_away_flag) return false; // already paused
if (!DEBUGGING(DRYRUN) && unload_length != 0) {
if (!DEBUGGING(DRYRUN) && (unload_length != 0 || retract != 0)) {
#if ENABLED(PREVENT_COLD_EXTRUSION)
if (!thermalManager.allow_cold_extrude &&
thermalManager.degTargetHotend(active_extruder) < thermalManager.extrude_min_temp) {
@ -5919,10 +5919,11 @@ inline void gcode_M17() {
COPY(resume_position, current_position);
set_destination_to_current();
if (retract) {
// Initial retract before move to filament change position
destination[E_AXIS] += retract;
RUNPLAN(PAUSE_PARK_RETRACT_FEEDRATE);
}
// Lift Z axis
if (z_lift > 0) {
@ -5951,6 +5952,7 @@ inline void gcode_M17() {
destination[E_AXIS] += unload_length;
RUNPLAN(FILAMENT_CHANGE_UNLOAD_FEEDRATE);
stepper.synchronize();
}
if (show_lcd) {
#if ENABLED(ULTIPANEL)
@ -5963,11 +5965,12 @@ inline void gcode_M17() {
#endif
idle();
}
// Disable extruders steppers for manual filament changing
// Disable extruders steppers for manual filament changing (only on boards that have separate ENABLE_PINS)
#if E0_ENABLE_PIN != X_ENABLE_PIN && E1_ENABLE_PIN != Y_ENABLE_PIN
disable_e_steppers();
safe_delay(100);
#endif
// Start the heater idle timers
const millis_t nozzle_timeout = (millis_t)(PAUSE_PARK_NOZZLE_TIMEOUT) * 1000UL;
@ -5989,15 +5992,44 @@ inline void gcode_M17() {
filament_change_beep(max_beep_count);
#endif
// If the nozzle has timed out, wait for the user to press the button to re-heat the nozzle, then
// re-heat the nozzle, re-show the insert screen, restart the idle timers, and start over
if (!nozzle_timed_out)
HOTEND_LOOP()
nozzle_timed_out |= thermalManager.is_heater_idle(e);
if (nozzle_timed_out) {
#if ENABLED(ULTIPANEL)
if (nozzle_timed_out)
lcd_advanced_pause_show_message(ADVANCED_PAUSE_MESSAGE_CLICK_TO_HEAT_NOZZLE);
#endif
// Wait for LCD click or M108
while (wait_for_user) idle(true);
// Re-enable the heaters if they timed out
HOTEND_LOOP() thermalManager.reset_heater_idle_timer(e);
// Wait for the heaters to reach the target temperatures
ensure_safe_temperature();
#if ENABLED(ULTIPANEL)
lcd_advanced_pause_show_message(ADVANCED_PAUSE_MESSAGE_INSERT);
#endif
// Start the heater idle timers
const millis_t nozzle_timeout = (millis_t)(PAUSE_PARK_NOZZLE_TIMEOUT) * 1000UL;
HOTEND_LOOP()
thermalManager.start_heater_idle_timer(e, nozzle_timeout);
wait_for_user = true; /* Wait for user to load filament */
nozzle_timed_out = false;
#if HAS_BUZZER
filament_change_beep(max_beep_count, true);
#endif
}
idle(true);
}
KEEPALIVE_STATE(IN_HANDLER);
@ -6049,7 +6081,7 @@ inline void gcode_M17() {
stepper.synchronize();
}
#if ENABLED(ULTIPANEL) && defined(ADVANCED_PAUSE_EXTRUDE_LENGTH) && ADVANCED_PAUSE_EXTRUDE_LENGTH > 0
#if ENABLED(ULTIPANEL) && ADVANCED_PAUSE_EXTRUDE_LENGTH > 0
float extrude_length = initial_extrude_length;
@ -6104,8 +6136,6 @@ inline void gcode_M17() {
filament_ran_out = false;
#endif
set_current_to_destination();
#if ENABLED(ULTIPANEL)
// Show status screen
lcd_advanced_pause_show_message(ADVANCED_PAUSE_MESSAGE_STATUS);
@ -7643,7 +7673,7 @@ inline void gcode_M18_M84() {
if (parser.seen('X')) disable_X();
if (parser.seen('Y')) disable_Y();
if (parser.seen('Z')) disable_Z();
#if ((E0_ENABLE_PIN != X_ENABLE_PIN) && (E1_ENABLE_PIN != Y_ENABLE_PIN)) // Only enable on boards that have seperate ENABLE_PINS
#if E0_ENABLE_PIN != X_ENABLE_PIN && E1_ENABLE_PIN != Y_ENABLE_PIN // Only enable on boards that have separate ENABLE_PINS
if (parser.seen('E')) disable_e_steppers();
#endif
}

4
Marlin/mesh_bed_leveling.h

@ -94,8 +94,8 @@
}
static float calc_z0(const float &a0, const float &a1, const float &z1, const float &a2, const float &z2) {
const float delta_z = (z2 - z1) / (a2 - a1);
const float delta_a = a0 - a1;
const float delta_z = (z2 - z1) / (a2 - a1),
delta_a = a0 - a1;
return z1 + delta_a * delta_z;
}

14
Marlin/planner.cpp

@ -534,10 +534,10 @@ void Planner::check_axes_activity() {
if (!ubl.state.active) return;
#if ENABLED(ENABLE_LEVELING_FADE_HEIGHT)
// if z_fade_height enabled (nonzero) and raw_z above it, no leveling required
if ((planner.z_fade_height) && (planner.z_fade_height <= RAW_Z_POSITION(lz))) return;
if (planner.z_fade_height && planner.z_fade_height <= RAW_Z_POSITION(lz)) return;
lz += ubl.state.z_offset + ubl.get_z_correction(lx, ly) * ubl.fade_scaling_factor_for_z(lz);
#else // no fade
lz += ubl.state.z_offset + ubl.get_z_correction(lx,ly);
lz += ubl.state.z_offset + ubl.get_z_correction(lx, ly);
#endif // FADE
#endif // UBL
@ -598,9 +598,9 @@ void Planner::check_axes_activity() {
if (ubl.state.active) {
const float z_physical = RAW_Z_POSITION(logical[Z_AXIS]);
const float z_ublmesh = ubl.get_z_correction(logical[X_AXIS], logical[Y_AXIS]);
const float z_virtual = z_physical - ubl.state.z_offset - z_ublmesh;
const float z_physical = RAW_Z_POSITION(logical[Z_AXIS]),
z_correct = ubl.get_z_correction(logical[X_AXIS], logical[Y_AXIS]),
z_virtual = z_physical - ubl.state.z_offset - z_correct;
float z_logical = LOGICAL_Z_POSITION(z_virtual);
#if ENABLED(ENABLE_LEVELING_FADE_HEIGHT)
@ -614,10 +614,10 @@ void Planner::check_axes_activity() {
// so L=(P-O-M)/(1-M/H) for L<H
if (planner.z_fade_height) {
if (z_logical < planner.z_fade_height )
z_logical = z_logical / (1.0 - (z_ublmesh * planner.inverse_z_fade_height));
if (z_logical >= planner.z_fade_height)
z_logical = LOGICAL_Z_POSITION(z_physical - ubl.state.z_offset);
else
z_logical /= 1.0 - z_correct * planner.inverse_z_fade_height;
}
#endif // ENABLE_LEVELING_FADE_HEIGHT

9
Marlin/ultralcd.cpp

@ -1019,7 +1019,7 @@ void kill_screen(const char* lcd_msg) {
#if ENABLED(AUTO_BED_LEVELING_UBL)
float mesh_edit_value, mesh_edit_accumulator; // We round mesh_edit_value to 2.5 decimal places. So we keep a
// seperate value that doesn't lose precision.
// separate value that doesn't lose precision.
static int ubl_encoderPosition = 0;
static void _lcd_mesh_fine_tune(const char* msg) {
@ -1107,11 +1107,16 @@ void kill_screen(const char* lcd_msg) {
#if ENABLED(ADVANCED_PAUSE_FEATURE)
void lcd_enqueue_filament_change() {
if (!DEBUGGING(DRYRUN) && thermalManager.tooColdToExtrude(active_extruder)) {
#if ENABLED(PREVENT_COLD_EXTRUSION)
if (!DEBUGGING(DRYRUN) && !thermalManager.allow_cold_extrude &&
thermalManager.degTargetHotend(active_extruder) < thermalManager.extrude_min_temp) {
lcd_save_previous_screen();
lcd_goto_screen(lcd_advanced_pause_toocold_menu);
return;
}
#endif
lcd_advanced_pause_show_message(ADVANCED_PAUSE_MESSAGE_INIT);
enqueue_and_echo_commands_P(PSTR("M600 B0"));
}

Loading…
Cancel
Save