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

Merge branch 'MK3' into flashair_display_ip

odaki пре 4 година
родитељ
комит
c0070506fb
5 измењених фајлова са 46 додато и 13 уклоњено
  1. 2 2
      Firmware/Configuration.h
  2. 1 1
      Firmware/messages.c
  3. 1 0
      Firmware/messages.h
  4. 22 8
      Firmware/ultralcd.cpp
  5. 20 2
      Firmware/xyzcal.cpp

+ 2 - 2
Firmware/Configuration.h

@@ -16,8 +16,8 @@ extern uint16_t nPrinterType;
 extern PGM_P sPrinterName;
 
 // Firmware version
-#define FW_VERSION "3.9.1"
-#define FW_COMMIT_NR 3518
+#define FW_VERSION "3.9.2"
+#define FW_COMMIT_NR 3524
 // FW_VERSION_UNKNOWN means this is an unofficial build.
 // The firmware should only be checked into github with this symbol.
 #define FW_DEV_VERSION FW_VERSION_UNKNOWN

+ 1 - 1
Firmware/messages.c

@@ -176,4 +176,4 @@ const char MSG_FANCHECK_PRINT[] PROGMEM_N1 = "Err: PRINT FAN ERROR"; ////c=20
 const char MSG_M112_KILL[] PROGMEM_N1 = "M112 called. Emergency Stop."; ////c=20
 const char MSG_ADVANCE_K[] PROGMEM_N1 = "Advance K:"; ////c=13
 const char MSG_POWERPANIC_DETECTED[] PROGMEM_N1 = "POWER PANIC DETECTED"; ////c=20
-
+const char MSG_LCD_STATUS_CHANGED[] PROGMEM_N1 = "LCD status changed";

+ 1 - 0
Firmware/messages.h

@@ -176,6 +176,7 @@ extern const char MSG_FANCHECK_PRINT[];
 extern const char MSG_M112_KILL[];
 extern const char MSG_ADVANCE_K[];
 extern const char MSG_POWERPANIC_DETECTED[];
+extern const char MSG_LCD_STATUS_CHANGED[];
 
 #if defined(__cplusplus)
 }

+ 22 - 8
Firmware/ultralcd.cpp

@@ -8787,22 +8787,35 @@ static void lcd_selftest_screen_step(int _row, int _col, int _state, const char
 
 static bool check_file(const char* filename) {
 	if (farm_mode) return true;
-	bool result = false;
-	uint32_t filesize;
 	card.openFile((char*)filename, true);
-	filesize = card.getFileSize();
+	bool result = false;
+	const uint32_t filesize = card.getFileSize();
+	uint32_t startPos = 0;
+	const uint16_t bytesToCheck = min(END_FILE_SECTION, filesize);
+	uint8_t blocksPrinted = 0;
 	if (filesize > END_FILE_SECTION) {
-		card.setIndex(filesize - END_FILE_SECTION);
-		
+		startPos = filesize - END_FILE_SECTION;
+		card.setIndex(startPos);
 	}
-	
-		while (!card.eof() && !result) {
+
+	lcd_clear();
+	lcd_puts_at_P(0, 1, _i("Checking file"));////c=20 r=1
+	lcd_set_cursor(0, 2);
+	while (!card.eof() && !result) {
+		for (; blocksPrinted < (((card.get_sdpos() - startPos) * LCD_WIDTH) / bytesToCheck); blocksPrinted++)
+			lcd_print('\xFF'); //simple progress bar
+
 		card.sdprinting = true;
 		get_command();
 		result = check_commands();
-		
 	}
+
+	for (; blocksPrinted < LCD_WIDTH; blocksPrinted++)
+		lcd_print('\xFF'); //simple progress bar
+	_delay(100); //for the user to see the end of the progress bar.
+
 	card.printingHasFinished();
+
 	strncpy_P(lcd_status_message, _T(WELCOME_MSG), LCD_WIDTH);
 	lcd_finishstatus();
 	return result;
@@ -8974,6 +8987,7 @@ void lcd_ignore_click(bool b)
 }
 
 void lcd_finishstatus() {
+  SERIAL_PROTOCOLLNRPGM(MSG_LCD_STATUS_CHANGED);
   int len = strlen(lcd_status_message);
   if (len > 0) {
     while (len < LCD_WIDTH) {

+ 20 - 2
Firmware/xyzcal.cpp

@@ -478,7 +478,7 @@ int16_t xyzcal_find_pattern_12x12_in_32x32(uint8_t* pixels, uint16_t* pattern, u
 
 #define MAX_DIAMETR 600
 #define XYZCAL_FIND_CENTER_DIAGONAL
-
+int8_t xyzcal_find_point_center2A(int16_t x0, int16_t y0, int16_t z0, uint16_t delay_us);
 int8_t xyzcal_find_point_center2(uint16_t delay_us)
 {
 	printf_P(PSTR("xyzcal_find_point_center2\n"));
@@ -494,7 +494,25 @@ int8_t xyzcal_find_point_center2(uint16_t delay_us)
 	xyzcal_lineXYZ_to(_X, _Y, z0 + 400, 500, -1);
 	xyzcal_lineXYZ_to(_X, _Y, z0 - 400, 500, 1);
 
-	z0 = _Z - 20;
+    if (has_temperature_compensation()){
+	    z0 = _Z - 20; // normal PINDA
+        return xyzcal_find_point_center2A(x0, y0, z0, delay_us);
+    } else {
+        // try searching harder, each PINDA is different
+        for(z0 = _Z - 20; z0 <= _Z + 140; z0 += 20 ){ // alternate PINDA
+            int8_t rv = xyzcal_find_point_center2A(x0, y0, z0, delay_us);
+            printf_P(PSTR(" z0=%d"), z0);
+            if( rv != 0 ){
+                printf_P(PSTR("ok\n"));
+                return rv;
+            } else {
+                printf_P(PSTR("fail\n"));
+            }
+        }
+    }
+}
+
+int8_t xyzcal_find_point_center2A(int16_t x0, int16_t y0, int16_t z0, uint16_t delay_us){
 	xyzcal_lineXYZ_to(_X, _Y, z0, 500, 0);
 
 //	xyzcal_lineXYZ_to(x0, y0, z0 - 100, 500, 1);