manage response update

This commit is contained in:
PavelSindler 2018-08-03 18:37:52 +02:00
parent 5824da8310
commit a1f69e0924
3 changed files with 48 additions and 40 deletions

View File

@ -467,7 +467,7 @@ void gcode_M701();
void proc_commands();
void manage_response();
void manage_response(bool move_axes, bool turn_off_nozzle);
bool mmu_get_response(bool timeout, bool clear);
void mmu_not_responding();
void mmu_load_to_nozzle();

View File

@ -6834,7 +6834,7 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE))
printf_P(PSTR("T code: %d \n"), tmp_extruder);
fprintf_P(uart2io, PSTR("T%d\n"), tmp_extruder);
manage_response();
manage_response(true, true);
snmm_extruder = tmp_extruder; //filament change is finished
@ -8890,7 +8890,7 @@ bool mmu_get_response(bool timeout, bool clear) {
}
void manage_response() {
void manage_response(bool move_axes, bool turn_off_nozzle) {
bool response = false;
mmu_print_saved = false;
@ -8911,31 +8911,34 @@ void manage_response() {
mmu_print_saved = true;
hotend_temp_bckp = degTargetHotend(active_extruder);
z_position_bckp = current_position[Z_AXIS];
x_position_bckp = current_position[X_AXIS];
y_position_bckp = current_position[Y_AXIS];
//lift z
current_position[Z_AXIS] += Z_PAUSE_LIFT;
if (current_position[Z_AXIS] > Z_MAX_POS) current_position[Z_AXIS] = Z_MAX_POS;
plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], 15, active_extruder);
st_synchronize();
//set nozzle target temperature to 0
setAllTargetHotends(0);
//Move XY to side
current_position[X_AXIS] = X_PAUSE_POS;
current_position[Y_AXIS] = Y_PAUSE_POS;
plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], 50, active_extruder);
st_synchronize();
printf_P(PSTR("MMU not responding\n"));
lcd_show_fullscreen_message_and_wait_P(_i("MMU needs user attention. Please press knob to resume nozzle target temperature."));
setTargetHotend(hotend_temp_bckp, active_extruder);
while ((degTargetHotend(active_extruder) - degHotend(active_extruder)) > 5) {
delay_keep_alive(1000);
lcd_wait_for_heater();
}
if (move_axes) {
z_position_bckp = current_position[Z_AXIS];
x_position_bckp = current_position[X_AXIS];
y_position_bckp = current_position[Y_AXIS];
//lift z
current_position[Z_AXIS] += Z_PAUSE_LIFT;
if (current_position[Z_AXIS] > Z_MAX_POS) current_position[Z_AXIS] = Z_MAX_POS;
plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], 15, active_extruder);
st_synchronize();
//Move XY to side
current_position[X_AXIS] = X_PAUSE_POS;
current_position[Y_AXIS] = Y_PAUSE_POS;
plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], 50, active_extruder);
st_synchronize();
}
if (turn_off_nozzle) {
//set nozzle target temperature to 0
setAllTargetHotends(0);
printf_P(PSTR("MMU not responding\n"));
lcd_show_fullscreen_message_and_wait_P(_i("MMU needs user attention. Please press knob to resume nozzle target temperature."));
setTargetHotend(hotend_temp_bckp, active_extruder);
while ((degTargetHotend(active_extruder) - degHotend(active_extruder)) > 5) {
delay_keep_alive(1000);
lcd_wait_for_heater();
}
}
}
lcd_display_message_fullscreen_P(_i("Check MMU. Fix the issue and then press button on MMU unit."));
}
@ -8943,13 +8946,18 @@ void manage_response() {
printf_P(PSTR("MMU start responding\n"));
lcd_clear();
lcd_display_message_fullscreen_P(_i("MMU OK. Resuming..."));
current_position[X_AXIS] = x_position_bckp;
current_position[Y_AXIS] = y_position_bckp;
plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], 50, active_extruder);
st_synchronize();
current_position[Z_AXIS] = z_position_bckp;
plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], 15, active_extruder);
st_synchronize();
if (move_axes) {
current_position[X_AXIS] = x_position_bckp;
current_position[Y_AXIS] = y_position_bckp;
plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], 50, active_extruder);
st_synchronize();
current_position[Z_AXIS] = z_position_bckp;
plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], 15, active_extruder);
st_synchronize();
}
else {
delay_keep_alive(1000); //delay just for showing MMU OK message for a while in case that there are no xyz movements
}
}
}
if (lcd_update_was_enabled) lcd_update_enable(true);
@ -9121,7 +9129,7 @@ void mmu_M600_load_filament(bool automatic) {
printf_P(PSTR("T code: %d \n"), tmp_extruder);
fprintf_P(uart2io, PSTR("T%d\n"), tmp_extruder);
manage_response();
manage_response(false, true);
snmm_extruder = tmp_extruder; //filament change is finished
mmu_load_to_nozzle();

View File

@ -3069,8 +3069,8 @@ bool lcd_wait_for_pinda(float temp) {
}
void lcd_wait_for_heater() {
lcd_display_message_fullscreen_P(_T(MSG_WIZARD_HEATING));
lcd_display_message_fullscreen_P(_T(MSG_WIZARD_HEATING));
lcd_set_degree();
lcd_set_cursor(0, 4);
lcd_print(LCD_STR_THERMOMETER[0]);
lcd_print(ftostr3(degHotend(active_extruder)));
@ -5228,7 +5228,7 @@ void extr_adj(int extruder) //loading filament for SNMM
lcd_print(snmm_extruder + 1);
// get response
manage_response();
manage_response(false, false);
lcd_update_enable(true);
@ -5301,7 +5301,7 @@ void extr_unload() { //unload just current filament for multimaterial printers
fprintf_P(uart2io, PSTR("U0\n"));
// get response
manage_response();
manage_response(false, true);
lcd_update_enable(true);
#else //SNMM_V2