Browse Source

Inital Temp Model cal wizard

3d-gussner 2 years ago
parent
commit
30ec4e8b53
4 changed files with 47 additions and 5 deletions
  1. 6 1
      Firmware/Configuration.h
  2. 11 0
      Firmware/Marlin_main.cpp
  3. 27 4
      Firmware/ultralcd.cpp
  4. 3 0
      Firmware/ultralcd.h

+ 6 - 1
Firmware/Configuration.h

@@ -550,7 +550,12 @@ enum CalibrationStatus
 	// For the wizard: factory assembled, needs to run Z calibration.
 	// For the wizard: factory assembled, needs to run Z calibration.
 	CALIBRATION_STATUS_Z_CALIBRATION = 240,
 	CALIBRATION_STATUS_Z_CALIBRATION = 240,
 
 
-	// The XYZ calibration has been performed, now it remains to run the V2Calibration.gcode.
+#ifdef TEMP_MODEL
+	// The XYZ calibration has been performed, needs to run Temp model calibration.
+	CALIBRATION_STATUS_TEMP_MODEL_CALIBRATION = 235,
+#endif //TEMP_MODEL
+
+// The XYZ calibration AND OR Temp model calibartion has been performed, now it remains to run the V2Calibration.gcode.
 	CALIBRATION_STATUS_LIVE_ADJUST = 230,
 	CALIBRATION_STATUS_LIVE_ADJUST = 230,
 
 
     // Calibrated, ready to print.
     // Calibrated, ready to print.

+ 11 - 0
Firmware/Marlin_main.cpp

@@ -1522,6 +1522,12 @@ void setup()
 		  // Show the message.
 		  // Show the message.
 		  lcd_show_fullscreen_message_and_wait_P(_T(MSG_FOLLOW_CALIBRATION_FLOW));
 		  lcd_show_fullscreen_message_and_wait_P(_T(MSG_FOLLOW_CALIBRATION_FLOW));
 	  }
 	  }
+#ifdef TEMP_MODEL
+	  else if (calibration_status() == CALIBRATION_STATUS_TEMP_MODEL_CALIBRATION) {
+		  lcd_show_fullscreen_message_and_wait_P(_i("Temp model calibration not calibrated yet."));////MSG_TEMP_MODEL_NOT_CAL c=20 c=4
+		  lcd_update_enable(true);
+	  }
+#endif //TEMP_MODEL
 	  else if (calibration_status() == CALIBRATION_STATUS_LIVE_ADJUST) {
 	  else if (calibration_status() == CALIBRATION_STATUS_LIVE_ADJUST) {
 		  // Show the message.
 		  // Show the message.
 		  lcd_show_fullscreen_message_and_wait_P(_T(MSG_BABYSTEP_Z_NOT_SET));
 		  lcd_show_fullscreen_message_and_wait_P(_T(MSG_BABYSTEP_Z_NOT_SET));
@@ -3393,9 +3399,14 @@ bool gcode_M45(bool onlyZ, int8_t verbosity_level)
 				lcd_bed_calibration_show_result(result, point_too_far_mask);
 				lcd_bed_calibration_show_result(result, point_too_far_mask);
 				if (result >= 0)
 				if (result >= 0)
 				{
 				{
+#ifdef TEMP_MODEL
+					calibration_status_store(CALIBRATION_STATUS_TEMP_MODEL_CALIBRATION);
+					if (eeprom_read_byte((uint8_t*)EEPROM_WIZARD_ACTIVE) != 1) lcd_show_fullscreen_message_and_wait_P(_i("Temp model calibration not calibrated yet."));
+#else
 					// Calibration valid, the machine should be able to print. Advise the user to run the V2Calibration.gcode.
 					// Calibration valid, the machine should be able to print. Advise the user to run the V2Calibration.gcode.
 					calibration_status_store(CALIBRATION_STATUS_LIVE_ADJUST);
 					calibration_status_store(CALIBRATION_STATUS_LIVE_ADJUST);
 					if (eeprom_read_byte((uint8_t*)EEPROM_WIZARD_ACTIVE) != 1) lcd_show_fullscreen_message_and_wait_P(_T(MSG_BABYSTEP_Z_NOT_SET));
 					if (eeprom_read_byte((uint8_t*)EEPROM_WIZARD_ACTIVE) != 1) lcd_show_fullscreen_message_and_wait_P(_T(MSG_BABYSTEP_Z_NOT_SET));
+#endif //TEMP_MODEL
 					final_result = true;
 					final_result = true;
 				}
 				}
 			}
 			}

+ 27 - 4
Firmware/ultralcd.cpp

@@ -997,8 +997,12 @@ void lcd_commands()
         //if (lcd_commands_step == 1 && calibrated()) {
         //if (lcd_commands_step == 1 && calibrated()) {
         if (lcd_commands_step == 1 && temp_model_valid()) {
         if (lcd_commands_step == 1 && temp_model_valid()) {
             enquecommand_P(PSTR("M500"));
             enquecommand_P(PSTR("M500"));
-            lcd_commands_step = 0;
-            lcd_commands_type = LcdCommands::Idle;
+            if (eeprom_read_byte((uint8_t*)EEPROM_WIZARD_ACTIVE) == 1) {
+                lcd_wizard(WizState::IsFil);
+            } else {
+                lcd_commands_step = 0;
+                lcd_commands_type = LcdCommands::Idle;
+            }
         }
         }
     }
     }
 #endif //TEMP_MODEL
 #endif //TEMP_MODEL
@@ -3994,6 +3998,9 @@ void lcd_wizard(WizState state)
 			case CALIBRATION_STATUS_ASSEMBLED: state = S::Selftest; break; //run selftest
 			case CALIBRATION_STATUS_ASSEMBLED: state = S::Selftest; break; //run selftest
 			case CALIBRATION_STATUS_XYZ_CALIBRATION: state = S::Xyz; break; //run xyz cal.
 			case CALIBRATION_STATUS_XYZ_CALIBRATION: state = S::Xyz; break; //run xyz cal.
 			case CALIBRATION_STATUS_Z_CALIBRATION: state = S::Z; break; //run z cal.
 			case CALIBRATION_STATUS_Z_CALIBRATION: state = S::Z; break; //run z cal.
+#ifdef TEMP_MODEL
+			case CALIBRATION_STATUS_TEMP_MODEL_CALIBRATION: state = S::TempModel; break; //run temp model cal.
+#endif //TEMP_MODEL
 			case CALIBRATION_STATUS_LIVE_ADJUST: state = S::IsFil; break; //run live adjust
 			case CALIBRATION_STATUS_LIVE_ADJUST: state = S::IsFil; break; //run live adjust
 			case CALIBRATION_STATUS_CALIBRATED: end = true; eeprom_update_byte((uint8_t*)EEPROM_WIZARD_ACTIVE, 0); break;
 			case CALIBRATION_STATUS_CALIBRATED: end = true; eeprom_update_byte((uint8_t*)EEPROM_WIZARD_ACTIVE, 0); break;
 			default: state = S::Selftest; break; //if calibration status is unknown, run wizard from the beginning
 			default: state = S::Selftest; break; //if calibration status is unknown, run wizard from the beginning
@@ -4011,8 +4018,13 @@ void lcd_wizard(WizState state)
 		case S::Xyz:
 		case S::Xyz:
 			lcd_show_fullscreen_message_and_wait_P(_i("I will run xyz calibration now. It will take approx. 12 mins."));////MSG_WIZARD_XYZ_CAL c=20 r=8
 			lcd_show_fullscreen_message_and_wait_P(_i("I will run xyz calibration now. It will take approx. 12 mins."));////MSG_WIZARD_XYZ_CAL c=20 r=8
 			wizard_event = gcode_M45(false, 0);
 			wizard_event = gcode_M45(false, 0);
-			if (wizard_event) state = S::IsFil;
-			else end = true;
+			if (wizard_event) {
+#ifdef TEMP_MODEL
+			state = S::TempModel;
+#else
+			state = S::IsFil;
+#endif //TEMP_MODEL
+			} else end = true;
 			break;
 			break;
 		case S::Z:
 		case S::Z:
 			lcd_show_fullscreen_message_and_wait_P(_i("Please remove shipping helpers first."));////MSG_REMOVE_SHIPPING_HELPERS c=20 r=3
 			lcd_show_fullscreen_message_and_wait_P(_i("Please remove shipping helpers first."));////MSG_REMOVE_SHIPPING_HELPERS c=20 r=3
@@ -4038,6 +4050,13 @@ void lcd_wizard(WizState state)
 			}
 			}
 			else end = true;
 			else end = true;
 			break;
 			break;
+#ifdef TEMP_MODEL
+		case S::TempModel:
+			lcd_show_fullscreen_message_and_wait_P(_i("Temp model cal. takes apporx. 12 mins."));////MSG_TM_CAL c=20 r=4
+			lcd_commands_type = LcdCommands::TempModel;
+			end = true; // Leave wizard temporarily for Temp model cal.
+			break;
+#endif //TEMP_MODEL
 		case S::IsFil:
 		case S::IsFil:
 		    //start to preheat nozzle and bed to save some time later
 		    //start to preheat nozzle and bed to save some time later
 			setTargetHotend(PLA_PREHEAT_HOTEND_TEMP, 0);
 			setTargetHotend(PLA_PREHEAT_HOTEND_TEMP, 0);
@@ -4108,6 +4127,10 @@ void lcd_wizard(WizState state)
 	case S::Z: //z cal.
 	case S::Z: //z cal.
 		msg = _T(MSG_WIZARD_CALIBRATION_FAILED);
 		msg = _T(MSG_WIZARD_CALIBRATION_FAILED);
 		break;
 		break;
+#ifdef TEMP_MODEL
+	case S::TempModel: //Temp model calibration
+//		break;
+#endif //TEMP_MODEL
 	case S::Finish: //we are finished
 	case S::Finish: //we are finished
 
 
 		msg = _T(MSG_WIZARD_DONE);
 		msg = _T(MSG_WIZARD_DONE);

+ 3 - 0
Firmware/ultralcd.h

@@ -230,6 +230,9 @@ enum class WizState : uint8_t
     Selftest,       //!< self test
     Selftest,       //!< self test
     Xyz,            //!< xyz calibration
     Xyz,            //!< xyz calibration
     Z,              //!< z calibration
     Z,              //!< z calibration
+#ifdef TEMP_MODEL
+    TempModel,      //!< Temp model calibration
+#endif //TEMP_MODEL
     IsFil,          //!< Is filament loaded? First step of 1st layer calibration
     IsFil,          //!< Is filament loaded? First step of 1st layer calibration
     PreheatPla,     //!< waiting for preheat nozzle for PLA
     PreheatPla,     //!< waiting for preheat nozzle for PLA
     Preheat,        //!< Preheat for any material
     Preheat,        //!< Preheat for any material