Allow G26 to use the active extruder (#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
This commit is contained in:
Scott Lahteine
2018-11-10 18:07:38 -06:00
committed by GitHub
parent 4260282df7
commit 6093df11dc
7 changed files with 107 additions and 82 deletions

View File

@ -38,6 +38,7 @@
#include "../../module/planner.h"
#include "../../module/stepper.h"
#include "../../module/motion.h"
#include "../../module/tool_change.h"
#include "../../module/temperature.h"
#include "../../lcd/ultralcd.h"
@ -165,18 +166,12 @@ int8_t g26_prime_flag;
if (!is_lcd_clicked()) return false; // Return if the button isn't pressed
lcd_setstatusPGM(PSTR("Mesh Validation Stopped."), 99);
#if HAS_LCD_MENU
lcd_quick_feedback(true);
lcd_quick_feedback();
#endif
wait_for_release();
return true;
}
bool exit_from_g26() {
lcd_setstatusPGM(PSTR("Leaving G26"), -1);
wait_for_release();
return G26_ERR;
}
#endif
mesh_index_pair find_closest_circle_to_print(const float &X, const float &Y) {
@ -412,58 +407,50 @@ inline bool look_for_lines_to_connect() {
* wait for them to get up to temperature.
*/
inline bool turn_on_heaters() {
millis_t next = millis() + 5000UL;
SERIAL_ECHOLNPGM("Waiting for heatup.");
#if HAS_HEATED_BED
#if ENABLED(ULTRA_LCD)
if (g26_bed_temp > 25) {
if (g26_bed_temp > 25) {
#if ENABLED(ULTRA_LCD)
lcd_setstatusPGM(PSTR("G26 Heating Bed."), 99);
lcd_quick_feedback(true);
lcd_quick_feedback();
#if HAS_LCD_MENU
lcd_external_control = true;
#endif
#endif
thermalManager.setTargetBed(g26_bed_temp);
while (ABS(thermalManager.degBed() - g26_bed_temp) > 3) {
#endif
thermalManager.setTargetBed(g26_bed_temp);
#if HAS_LCD_MENU
if (is_lcd_clicked()) return exit_from_g26();
// Wait for the temperature to stabilize
if (!thermalManager.wait_for_bed(true
#if G26_CLICK_CAN_CANCEL
, true
#endif
if (ELAPSED(millis(), next)) {
next = millis() + 5000UL;
thermalManager.print_heaterstates();
SERIAL_EOL();
}
idle();
SERIAL_FLUSH(); // Prevent host M105 buffer overrun.
}
#if ENABLED(ULTRA_LCD)
}
lcd_setstatusPGM(PSTR("G26 Heating Nozzle."), 99);
lcd_quick_feedback(true);
#endif
#endif
// Start heating the nozzle and wait for it to reach temperature.
thermalManager.setTargetHotend(g26_hotend_temp, 0);
while (ABS(thermalManager.degHotend(0) - g26_hotend_temp) > 3) {
#if HAS_LCD_MENU
if (is_lcd_clicked()) return exit_from_g26();
#endif
if (ELAPSED(millis(), next)) {
next = millis() + 5000UL;
thermalManager.print_heaterstates();
SERIAL_EOL();
)
) return G26_ERR;
}
idle();
SERIAL_FLUSH(); // Prevent host M105 buffer overrun.
}
#endif // HAS_HEATED_BED
// Start heating the active nozzle
#if ENABLED(ULTRA_LCD)
lcd_setstatusPGM(PSTR("G26 Heating Nozzle."), 99);
lcd_quick_feedback();
#endif
thermalManager.setTargetHotend(g26_hotend_temp, active_extruder);
// Wait for the temperature to stabilize
if (!thermalManager.wait_for_hotend(active_extruder, true
#if G26_CLICK_CAN_CANCEL
, true
#endif
)
) return G26_ERR;
#if ENABLED(ULTRA_LCD)
lcd_reset_status();
lcd_quick_feedback(true);
lcd_quick_feedback();
#endif
return G26_OK;
@ -507,7 +494,7 @@ inline bool prime_nozzle() {
wait_for_release();
lcd_setstatusPGM(PSTR("Done Priming"), 99);
lcd_quick_feedback(true);
lcd_quick_feedback();
lcd_external_control = false;
}
else
@ -515,7 +502,7 @@ inline bool prime_nozzle() {
{
#if ENABLED(ULTRA_LCD)
lcd_setstatusPGM(PSTR("Fixed Length Prime."), 99);
lcd_quick_feedback(true);
lcd_quick_feedback();
#endif
set_destination_from_current();
destination[E_AXIS] += g26_prime_length;
@ -553,17 +540,21 @@ float valid_trig_angle(float d) {
* Q Retraction multiplier
* R Repetitions (number of grid points)
* S Nozzle Size (diameter) in mm
* T Tool index to change to, if included
* U Random deviation (50 if no value given)
* X X position
* Y Y position
*/
void GcodeSuite::G26() {
SERIAL_ECHOLNPGM("G26 command started. Waiting for heater(s).");
SERIAL_ECHOLNPGM("G26 starting...");
// Don't allow Mesh Validation without homing first,
// or if the parameter parsing did not go OK, abort
if (axis_unhomed_error()) return;
// Change the tool first, if specified
if (parser.seenval('T')) tool_change(parser.value_int());
g26_extrusion_multiplier = EXTRUSION_MULTIPLIER;
g26_retraction_multiplier = RETRACTION_MULTIPLIER;
g26_layer_height = MESH_TEST_LAYER_HEIGHT;
@ -891,6 +882,7 @@ void GcodeSuite::G26() {
LEAVE:
lcd_setstatusPGM(PSTR("Leaving G26"), -1);
wait_for_release();
retract_filament(destination);
destination[Z_AXIS] = Z_CLEARANCE_BETWEEN_PROBES;
@ -914,7 +906,7 @@ void GcodeSuite::G26() {
#if HAS_HEATED_BED
thermalManager.setTargetBed(0);
#endif
thermalManager.setTargetHotend(0, 0);
thermalManager.setTargetHotend(active_extruder, 0);
}
}