add another homing after steel sheet is removed; added timeout for pinda cooling; if PINDA doesn't trigger before reaching Z = -1mm, temp. calibration fails

This commit is contained in:
PavelSindler 2018-04-24 13:43:51 +02:00
parent 043c8c66be
commit 010ceceff9
7 changed files with 299 additions and 242 deletions

View File

@ -3015,12 +3015,12 @@ void process_commands()
memcpy(destination, current_position, sizeof(destination)); memcpy(destination, current_position, sizeof(destination));
feedrate = 0.0; feedrate = 0.0;
#if Z_HOME_DIR > 0 // If homing away from BED do Z first #if Z_HOME_DIR > 0 // If homing away from BED do Z first
if(home_z) if(home_z)
homeaxis(Z_AXIS); homeaxis(Z_AXIS);
#endif #endif
#ifdef QUICK_HOME #ifdef QUICK_HOME
// In the quick mode, if both x and y are to be homed, a diagonal move will be performed initially. // In the quick mode, if both x and y are to be homed, a diagonal move will be performed initially.
if(home_x && home_y) //first diagonal move if(home_x && home_y) //first diagonal move
{ {
@ -3055,7 +3055,7 @@ void process_commands()
current_position[Y_AXIS] = destination[Y_AXIS]; current_position[Y_AXIS] = destination[Y_AXIS];
current_position[Z_AXIS] = destination[Z_AXIS]; current_position[Z_AXIS] = destination[Z_AXIS];
} }
#endif /* QUICK_HOME */ #endif /* QUICK_HOME */
#ifdef TMC2130 #ifdef TMC2130
if(home_x) if(home_x)
@ -3082,16 +3082,16 @@ void process_commands()
if(code_seen(axis_codes[Y_AXIS]) && code_value_long() != 0) if(code_seen(axis_codes[Y_AXIS]) && code_value_long() != 0)
current_position[Y_AXIS]=code_value()+add_homing[Y_AXIS]; current_position[Y_AXIS]=code_value()+add_homing[Y_AXIS];
#if Z_HOME_DIR < 0 // If homing towards BED do Z last #if Z_HOME_DIR < 0 // If homing towards BED do Z last
#ifndef Z_SAFE_HOMING #ifndef Z_SAFE_HOMING
if(home_z) { if(home_z) {
#if defined (Z_RAISE_BEFORE_HOMING) && (Z_RAISE_BEFORE_HOMING > 0) #if defined (Z_RAISE_BEFORE_HOMING) && (Z_RAISE_BEFORE_HOMING > 0)
destination[Z_AXIS] = Z_RAISE_BEFORE_HOMING * home_dir(Z_AXIS) * (-1); // Set destination away from bed destination[Z_AXIS] = Z_RAISE_BEFORE_HOMING * home_dir(Z_AXIS) * (-1); // Set destination away from bed
feedrate = max_feedrate[Z_AXIS]; feedrate = max_feedrate[Z_AXIS];
plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], feedrate, active_extruder); plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], feedrate, active_extruder);
st_synchronize(); st_synchronize();
#endif // defined (Z_RAISE_BEFORE_HOMING) && (Z_RAISE_BEFORE_HOMING > 0) #endif // defined (Z_RAISE_BEFORE_HOMING) && (Z_RAISE_BEFORE_HOMING > 0)
#if (defined(MESH_BED_LEVELING) && !defined(MK1BP)) // If Mesh bed leveling, moxve X&Y to safe position for home #if (defined(MESH_BED_LEVELING) && !defined(MK1BP)) // If Mesh bed leveling, moxve X&Y to safe position for home
if (!(axis_known_position[X_AXIS] && axis_known_position[Y_AXIS] )) if (!(axis_known_position[X_AXIS] && axis_known_position[Y_AXIS] ))
{ {
homeaxis(X_AXIS); homeaxis(X_AXIS);
@ -3115,11 +3115,11 @@ void process_commands()
enable_endstops(true); enable_endstops(true);
endstops_hit_on_purpose(); endstops_hit_on_purpose();
homeaxis(Z_AXIS); homeaxis(Z_AXIS);
#else // MESH_BED_LEVELING #else // MESH_BED_LEVELING
homeaxis(Z_AXIS); homeaxis(Z_AXIS);
#endif // MESH_BED_LEVELING #endif // MESH_BED_LEVELING
} }
#else // defined(Z_SAFE_HOMING): Z Safe mode activated. #else // defined(Z_SAFE_HOMING): Z Safe mode activated.
if(home_all_axes) { if(home_all_axes) {
destination[X_AXIS] = round(Z_SAFE_HOMING_X_POINT - X_PROBE_OFFSET_FROM_EXTRUDER); destination[X_AXIS] = round(Z_SAFE_HOMING_X_POINT - X_PROBE_OFFSET_FROM_EXTRUDER);
destination[Y_AXIS] = round(Z_SAFE_HOMING_Y_POINT - Y_PROBE_OFFSET_FROM_EXTRUDER); destination[Y_AXIS] = round(Z_SAFE_HOMING_Y_POINT - Y_PROBE_OFFSET_FROM_EXTRUDER);
@ -3161,24 +3161,24 @@ void process_commands()
SERIAL_ECHOLNRPGM(MSG_ZPROBE_OUT); SERIAL_ECHOLNRPGM(MSG_ZPROBE_OUT);
} }
} }
#endif // Z_SAFE_HOMING #endif // Z_SAFE_HOMING
#endif // Z_HOME_DIR < 0 #endif // Z_HOME_DIR < 0
if(code_seen(axis_codes[Z_AXIS]) && code_value_long() != 0) if(code_seen(axis_codes[Z_AXIS]) && code_value_long() != 0)
current_position[Z_AXIS]=code_value()+add_homing[Z_AXIS]; current_position[Z_AXIS]=code_value()+add_homing[Z_AXIS];
#ifdef ENABLE_AUTO_BED_LEVELING #ifdef ENABLE_AUTO_BED_LEVELING
if(home_z) if(home_z)
current_position[Z_AXIS] += zprobe_zoffset; //Add Z_Probe offset (the distance is negative) current_position[Z_AXIS] += zprobe_zoffset; //Add Z_Probe offset (the distance is negative)
#endif #endif
// Set the planner and stepper routine positions. // Set the planner and stepper routine positions.
// At this point the mesh bed leveling and world2machine corrections are disabled and current_position // At this point the mesh bed leveling and world2machine corrections are disabled and current_position
// contains the machine coordinates. // contains the machine coordinates.
plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]); plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);
#ifdef ENDSTOPS_ONLY_FOR_HOMING #ifdef ENDSTOPS_ONLY_FOR_HOMING
enable_endstops(false); enable_endstops(false);
#endif #endif
feedrate = saved_feedrate; feedrate = saved_feedrate;
feedmultiply = saved_feedmultiply; feedmultiply = saved_feedmultiply;
@ -3451,17 +3451,32 @@ void process_commands()
} }
lcd_show_fullscreen_message_and_wait_P(MSG_TEMP_CAL_WARNING); lcd_show_fullscreen_message_and_wait_P(MSG_TEMP_CAL_WARNING);
bool result = lcd_show_fullscreen_message_yes_no_and_wait_P(MSG_STEEL_SHEET_CHECK, false, false); bool result = lcd_show_fullscreen_message_yes_no_and_wait_P(MSG_STEEL_SHEET_CHECK, false, false);
if (result) if (result)
{ {
current_position[Z_AXIS] = 50; current_position[Z_AXIS] = 50;
current_position[Y_AXIS] = 190; current_position[Y_AXIS] += 180;
plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], 3000 / 60, active_extruder); plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], 3000 / 60, active_extruder);
st_synchronize(); st_synchronize();
lcd_show_fullscreen_message_and_wait_P(MSG_REMOVE_STEEL_SHEET); lcd_show_fullscreen_message_and_wait_P(MSG_REMOVE_STEEL_SHEET);
current_position[Y_AXIS] -= 180;
plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], 3000 / 60, active_extruder);
st_synchronize();
feedrate = homing_feedrate[Z_AXIS] / 10;
enable_endstops(true);
endstops_hit_on_purpose();
homeaxis(Z_AXIS);
plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);
enable_endstops(false);
} }
if ((current_temperature_pinda > 35) && (farm_mode == false)) { if ((current_temperature_pinda > 35) && (farm_mode == false)) {
//waiting for PIDNA probe to cool down in case that we are not in farm mode //waiting for PIDNA probe to cool down in case that we are not in farm mode
lcd_wait_for_pinda(35); current_position[Z_AXIS] = 100;
plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], 3000 / 60, active_extruder);
if (lcd_wait_for_pinda(35) == false) { //waiting for PINDA probe to cool, if this takes more then time expected, temp. cal. fails
lcd_temp_cal_show_result(false);
break;
}
} }
lcd_update_enable(true); lcd_update_enable(true);
KEEPALIVE_STATE(NOT_BUSY); //no need to print busy messages as we print current temperatures periodicaly KEEPALIVE_STATE(NOT_BUSY); //no need to print busy messages as we print current temperatures periodicaly
@ -3504,7 +3519,9 @@ void process_commands()
plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], 3000 / 60, active_extruder); plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], 3000 / 60, active_extruder);
st_synchronize(); st_synchronize();
find_bed_induction_sensor_point_z(-1.f); bool find_z_result = find_bed_induction_sensor_point_z(-1.f);
if(find_z_result == false) lcd_temp_cal_show_result(find_z_result);
zero_z = current_position[Z_AXIS]; zero_z = current_position[Z_AXIS];
//current_position[Z_AXIS] //current_position[Z_AXIS]
@ -3553,7 +3570,9 @@ void process_commands()
current_position[Y_AXIS] = pgm_read_float(bed_ref_points + 1); current_position[Y_AXIS] = pgm_read_float(bed_ref_points + 1);
plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], 3000 / 60, active_extruder); plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], 3000 / 60, active_extruder);
st_synchronize(); st_synchronize();
find_bed_induction_sensor_point_z(-1.f); find_z_result = find_bed_induction_sensor_point_z(-1.f);
if (find_z_result == false) lcd_temp_cal_show_result(find_z_result);
z_shift = (int)((current_position[Z_AXIS] - zero_z)*axis_steps_per_unit[Z_AXIS]); z_shift = (int)((current_position[Z_AXIS] - zero_z)*axis_steps_per_unit[Z_AXIS]);
SERIAL_ECHOLNPGM(""); SERIAL_ECHOLNPGM("");
@ -3566,25 +3585,8 @@ void process_commands()
EEPROM_save_B(EEPROM_PROBE_TEMP_SHIFT + i * 2, &z_shift); EEPROM_save_B(EEPROM_PROBE_TEMP_SHIFT + i * 2, &z_shift);
} }
custom_message_type = 0; lcd_temp_cal_show_result(true);
custom_message = false;
eeprom_update_byte((uint8_t*)EEPROM_CALIBRATION_STATUS_PINDA, 1);
SERIAL_ECHOLNPGM("Temperature calibration done. Continue with pressing the knob.");
disable_x();
disable_y();
disable_z();
disable_e0();
disable_e1();
disable_e2();
setTargetBed(0); //set bed target temperature back to 0
// setTargetHotend(0,0); //set hotend target temperature back to 0
lcd_show_fullscreen_message_and_wait_P(MSG_TEMP_CALIBRATION_DONE);
temp_cal_active = true;
eeprom_update_byte((unsigned char *)EEPROM_TEMP_CAL_ACTIVE, 1);
lcd_update_enable(true);
lcd_update(2);
break; break;
} }
#endif //PINDA_THERMISTOR #endif //PINDA_THERMISTOR

View File

@ -2218,6 +2218,13 @@ const char * const MSG_TEMP_CALIBRATION_ON_LANG_TABLE[LANG_NUM] PROGMEM = {
MSG_TEMP_CALIBRATION_ON_CZ MSG_TEMP_CALIBRATION_ON_CZ
}; };
const char MSG_TEMP_CAL_FAILED_EN[] PROGMEM = "Temperature calibration failed";
const char MSG_TEMP_CAL_FAILED_CZ[] PROGMEM = "Teplotni kalibrace selhala";
const char * const MSG_TEMP_CAL_FAILED_LANG_TABLE[LANG_NUM] PROGMEM = {
MSG_TEMP_CAL_FAILED_EN,
MSG_TEMP_CAL_FAILED_CZ
};
const char MSG_TEMP_CAL_WARNING_EN[] PROGMEM = "Stable ambient temperature 21-26C is needed a rigid stand is required."; const char MSG_TEMP_CAL_WARNING_EN[] PROGMEM = "Stable ambient temperature 21-26C is needed a rigid stand is required.";
const char * const MSG_TEMP_CAL_WARNING_LANG_TABLE[1] PROGMEM = { const char * const MSG_TEMP_CAL_WARNING_LANG_TABLE[1] PROGMEM = {
MSG_TEMP_CAL_WARNING_EN MSG_TEMP_CAL_WARNING_EN

View File

@ -726,6 +726,8 @@ extern const char* const MSG_TEMP_CALIBRATION_OFF_LANG_TABLE[LANG_NUM];
#define MSG_TEMP_CALIBRATION_OFF LANG_TABLE_SELECT(MSG_TEMP_CALIBRATION_OFF_LANG_TABLE) #define MSG_TEMP_CALIBRATION_OFF LANG_TABLE_SELECT(MSG_TEMP_CALIBRATION_OFF_LANG_TABLE)
extern const char* const MSG_TEMP_CALIBRATION_ON_LANG_TABLE[LANG_NUM]; extern const char* const MSG_TEMP_CALIBRATION_ON_LANG_TABLE[LANG_NUM];
#define MSG_TEMP_CALIBRATION_ON LANG_TABLE_SELECT(MSG_TEMP_CALIBRATION_ON_LANG_TABLE) #define MSG_TEMP_CALIBRATION_ON LANG_TABLE_SELECT(MSG_TEMP_CALIBRATION_ON_LANG_TABLE)
extern const char* const MSG_TEMP_CAL_FAILED_LANG_TABLE[LANG_NUM];
#define MSG_TEMP_CAL_FAILED LANG_TABLE_SELECT(MSG_TEMP_CAL_FAILED_LANG_TABLE)
extern const char* const MSG_TEMP_CAL_WARNING_LANG_TABLE[1]; extern const char* const MSG_TEMP_CAL_WARNING_LANG_TABLE[1];
#define MSG_TEMP_CAL_WARNING LANG_TABLE_SELECT_EXPLICIT(MSG_TEMP_CAL_WARNING_LANG_TABLE, 0) #define MSG_TEMP_CAL_WARNING LANG_TABLE_SELECT_EXPLICIT(MSG_TEMP_CAL_WARNING_LANG_TABLE, 0)
extern const char* const MSG_TOSHIBA_FLASH_AIR_COMPATIBILITY_OFF_LANG_TABLE[1]; extern const char* const MSG_TOSHIBA_FLASH_AIR_COMPATIBILITY_OFF_LANG_TABLE[1];

View File

@ -415,3 +415,4 @@
#define MSG_CHANGED_PRINTER "Varovani: doslo ke zmene typu tiskarny." #define MSG_CHANGED_PRINTER "Varovani: doslo ke zmene typu tiskarny."
#define MSG_CHANGED_BOTH "Varovani: doslo ke zmene typu tiskarny a motherboardu." #define MSG_CHANGED_BOTH "Varovani: doslo ke zmene typu tiskarny a motherboardu."
#define MSG_WAITING_TEMP_PINDA "Cekani na zchladnuti PINDA" #define MSG_WAITING_TEMP_PINDA "Cekani na zchladnuti PINDA"
#define MSG_TEMP_CAL_FAILED "Teplotni kalibrace selhala"

View File

@ -423,3 +423,4 @@
#define(length=20, lines=4) MSG_CHANGED_PRINTER "Warning: printer type changed." #define(length=20, lines=4) MSG_CHANGED_PRINTER "Warning: printer type changed."
#define(length=20, lines=4) MSG_CHANGED_BOTH "Warning: both printer type and motherboard type changed." #define(length=20, lines=4) MSG_CHANGED_BOTH "Warning: both printer type and motherboard type changed."
#define(length=20, lines=3) MSG_WAITING_TEMP_PINDA "Waiting for PINDA probe cooling" #define(length=20, lines=3) MSG_WAITING_TEMP_PINDA "Waiting for PINDA probe cooling"
#define(length=20, lines=8) MSG_TEMP_CAL_FAILED "Temperature calibration failed"

View File

@ -9,6 +9,7 @@
#include "stepper.h" #include "stepper.h"
#include "ConfigurationStore.h" #include "ConfigurationStore.h"
#include <string.h> #include <string.h>
#include "Timer.h"
#include "util.h" #include "util.h"
#include "mesh_bed_leveling.h" #include "mesh_bed_leveling.h"
@ -2600,23 +2601,33 @@ void lcd_adjust_z() {
} }
void lcd_wait_for_pinda(uint8_t temp) { bool lcd_wait_for_pinda(float temp) {
lcd_set_custom_characters_degree(); lcd_set_custom_characters_degree();
setTargetHotend(0, 0); setTargetHotend(0, 0);
setTargetBed(0); setTargetBed(0);
Timer pinda_timeout;
pinda_timeout.start();
bool target_temp_reached = true;
while (current_temperature_pinda > temp){ while (current_temperature_pinda > temp){
lcd_display_message_fullscreen_P(MSG_WAITING_TEMP_PINDA); lcd_display_message_fullscreen_P(MSG_WAITING_TEMP_PINDA);
lcd.setCursor(0, 4); lcd.setCursor(0, 4);
lcd.print(LCD_STR_THERMOMETER[0]); lcd.print(LCD_STR_THERMOMETER[0]);
lcd.print(ftostr3(current_temperature_pinda)); lcd.print(ftostr3(current_temperature_pinda));
lcd.print("/35"); lcd.print("/");
lcd.print(ftostr3(temp));
lcd.print(LCD_STR_DEGREE); lcd.print(LCD_STR_DEGREE);
delay_keep_alive(1000); delay_keep_alive(1000);
serialecho_temperatures(); serialecho_temperatures();
if (pinda_timeout.expired(8 * 60 * 1000ul)) { //PINDA cooling from 60 C to 35 C takes about 7 minutes
target_temp_reached = false;
break;
}
} }
lcd_set_custom_characters_arrows(); lcd_set_custom_characters_arrows();
lcd_update_enable(true); lcd_update_enable(true);
return(target_temp_reached);
} }
void lcd_wait_for_heater() { void lcd_wait_for_heater() {
@ -3063,6 +3074,36 @@ void lcd_bed_calibration_show_result(BedSkewOffsetDetectionResultType result, ui
} }
} }
void lcd_temp_cal_show_result(bool result) {
custom_message_type = 0;
custom_message = false;
disable_x();
disable_y();
disable_z();
disable_e0();
disable_e1();
disable_e2();
setTargetBed(0); //set bed target temperature back to 0
if (result == true) {
eeprom_update_byte((uint8_t*)EEPROM_CALIBRATION_STATUS_PINDA, 1);
SERIAL_ECHOLNPGM("Temperature calibration done. Continue with pressing the knob.");
lcd_show_fullscreen_message_and_wait_P(MSG_TEMP_CALIBRATION_DONE);
temp_cal_active = true;
eeprom_update_byte((unsigned char *)EEPROM_TEMP_CAL_ACTIVE, 1);
}
else {
eeprom_update_byte((uint8_t*)EEPROM_CALIBRATION_STATUS_PINDA, 0);
SERIAL_ECHOLNPGM("Temperature calibration failed. Continue with pressing the knob.");
lcd_show_fullscreen_message_and_wait_P(MSG_TEMP_CAL_FAILED);
temp_cal_active = false;
eeprom_update_byte((unsigned char *)EEPROM_TEMP_CAL_ACTIVE, 0);
}
lcd_update_enable(true);
lcd_update(2);
}
static void lcd_show_end_stops() { static void lcd_show_end_stops() {
lcd.setCursor(0, 0); lcd.setCursor(0, 0);
lcd_printPGM((PSTR("End stops diag"))); lcd_printPGM((PSTR("End stops diag")));

View File

@ -267,10 +267,13 @@ void lcd_farm_sdcard_menu_w();
void lcd_wait_for_heater(); void lcd_wait_for_heater();
void lcd_wait_for_cool_down(); void lcd_wait_for_cool_down();
void lcd_wait_for_pinda(uint8_t temp);
void adjust_bed_reset(); void adjust_bed_reset();
void lcd_extr_cal_reset(); void lcd_extr_cal_reset();
void lcd_temp_cal_show_result(bool result);
bool lcd_wait_for_pinda(float temp);
union MenuData; union MenuData;
void bowden_menu(); void bowden_menu();