Преглед изворни кода

Merge pull request #657 from PavelSindler/temp_cal_update

Temp calibration update
XPila пре 6 година
родитељ
комит
79b9f736aa

+ 27 - 21
Firmware/Marlin_main.cpp

@@ -3452,13 +3452,32 @@ void process_commands()
 			}
 			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);
+			
 			if (result)
 			{
 				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);
 				st_synchronize();
 				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)) {
+				//waiting for PIDNA probe to cool down in case that we are not in farm mode
+				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);
 			KEEPALIVE_STATE(NOT_BUSY); //no need to print busy messages as we print current temperatures periodicaly
@@ -3501,7 +3520,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);
 			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];
 
 			//current_position[Z_AXIS]
@@ -3550,7 +3571,9 @@ void process_commands()
 				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);
 				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]);
 
 				SERIAL_ECHOLNPGM("");
@@ -3563,25 +3586,8 @@ void process_commands()
 				EEPROM_save_B(EEPROM_PROBE_TEMP_SHIFT + i * 2, &z_shift);
 
 			}
-			custom_message_type = 0;
-			custom_message = false;
+			lcd_temp_cal_show_result(true);
 
-			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;
 		}
 #endif //PINDA_THERMISTOR

+ 14 - 0
Firmware/language_all.cpp

@@ -2218,6 +2218,13 @@ const char * const MSG_TEMP_CALIBRATION_ON_LANG_TABLE[LANG_NUM] PROGMEM = {
 	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 * const MSG_TEMP_CAL_WARNING_LANG_TABLE[1] PROGMEM = {
 	MSG_TEMP_CAL_WARNING_EN
@@ -2354,6 +2361,13 @@ const char * const MSG_WAITING_TEMP_LANG_TABLE[LANG_NUM] PROGMEM = {
 	MSG_WAITING_TEMP_CZ
 };
 
+const char MSG_WAITING_TEMP_PINDA_EN[] PROGMEM = "Waiting for PINDA probe cooling";
+const char MSG_WAITING_TEMP_PINDA_CZ[] PROGMEM = "Cekani na zchladnuti PINDA";
+const char * const MSG_WAITING_TEMP_PINDA_LANG_TABLE[LANG_NUM] PROGMEM = {
+	MSG_WAITING_TEMP_PINDA_EN,
+	MSG_WAITING_TEMP_PINDA_CZ
+};
+
 const char MSG_WATCH_EN[] PROGMEM = "Info screen";
 const char MSG_WATCH_CZ[] PROGMEM = "Informace";
 const char * const MSG_WATCH_LANG_TABLE[LANG_NUM] PROGMEM = {

+ 4 - 0
Firmware/language_all.h

@@ -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)
 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)
+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];
 #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];
@@ -770,6 +772,8 @@ extern const char* const MSG_VTRAV_MIN_LANG_TABLE[1];
 #define MSG_VTRAV_MIN LANG_TABLE_SELECT_EXPLICIT(MSG_VTRAV_MIN_LANG_TABLE, 0)
 extern const char* const MSG_WAITING_TEMP_LANG_TABLE[LANG_NUM];
 #define MSG_WAITING_TEMP LANG_TABLE_SELECT(MSG_WAITING_TEMP_LANG_TABLE)
+extern const char* const MSG_WAITING_TEMP_PINDA_LANG_TABLE[LANG_NUM];
+#define MSG_WAITING_TEMP_PINDA LANG_TABLE_SELECT(MSG_WAITING_TEMP_PINDA_LANG_TABLE)
 extern const char* const MSG_WATCH_LANG_TABLE[LANG_NUM];
 #define MSG_WATCH LANG_TABLE_SELECT(MSG_WATCH_LANG_TABLE)
 extern const char* const MSG_WATCHDOG_RESET_LANG_TABLE[1];

+ 2 - 0
Firmware/language_cz.h

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

+ 2 - 0
Firmware/language_en.h

@@ -422,3 +422,5 @@
 #define(length=20, lines=4) MSG_CHANGED_MOTHERBOARD		 "Warning: motherboard 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=3) MSG_WAITING_TEMP_PINDA		 "Waiting for PINDA probe cooling"
+#define(length=20, lines=8) MSG_TEMP_CAL_FAILED			 "Temperature calibration failed"

+ 60 - 0
Firmware/ultralcd.cpp

@@ -9,6 +9,7 @@
 #include "stepper.h"
 #include "ConfigurationStore.h"
 #include <string.h>
+#include "Timer.h"
 
 #include "util.h"
 #include "mesh_bed_leveling.h"
@@ -2600,6 +2601,35 @@ void lcd_adjust_z() {
 
 }
 
+bool lcd_wait_for_pinda(float temp) {
+	lcd_set_custom_characters_degree();
+	setTargetHotend(0, 0);
+	setTargetBed(0);
+	Timer pinda_timeout;
+	pinda_timeout.start();
+	bool target_temp_reached = true;
+
+	while (current_temperature_pinda > temp){
+		lcd_display_message_fullscreen_P(MSG_WAITING_TEMP_PINDA);
+
+		lcd.setCursor(0, 4);
+		lcd.print(LCD_STR_THERMOMETER[0]);
+		lcd.print(ftostr3(current_temperature_pinda));
+		lcd.print("/");
+		lcd.print(ftostr3(temp));
+		lcd.print(LCD_STR_DEGREE);
+		delay_keep_alive(1000);
+		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_update_enable(true);
+	return(target_temp_reached);
+}
+
 void lcd_wait_for_heater() {
 	lcd_display_message_fullscreen_P(MSG_WIZARD_HEATING);
 
@@ -3044,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() {
 	lcd.setCursor(0, 0);
 	lcd_printPGM((PSTR("End stops diag")));

+ 4 - 0
Firmware/ultralcd.h

@@ -270,6 +270,10 @@ void lcd_wait_for_cool_down();
 void adjust_bed_reset();
 void lcd_extr_cal_reset();
 
+void lcd_temp_cal_show_result(bool result);
+bool lcd_wait_for_pinda(float temp);
+
+
 union MenuData;
 
 void bowden_menu();