Browse Source

Reset live adjust on XYZ calibration.
Disable timeouts in the XYZ/Z calibration.
Don't modify feed rate multiplier during the XYZ/Z calibration.
Support multi screen messages in the XYZ/Z calibration - "move the Z carriages up" step.
Support up to three lines in the XYZ/Z calibration messages.
Added a new message "Measuring reference height of calibration point xx of 9".
Changed the "move the Z carriages up" message to suggest rotating the knob.
Changed the "live adjust not set" message to reference the manual chapter and section.
Remove debugging serial line output on Z calibration.

bubnikv 8 years ago
parent
commit
b470e103dc
5 changed files with 81 additions and 36 deletions
  1. 1 1
      Firmware/Configuration.h
  2. 3 7
      Firmware/Marlin_main.cpp
  3. 32 10
      Firmware/mesh_bed_calibration.cpp
  4. 41 17
      Firmware/ultralcd.cpp
  5. 4 1
      Firmware/ultralcd.h

+ 1 - 1
Firmware/Configuration.h

@@ -5,7 +5,7 @@
 #include "Configuration_prusa.h"
 
 // Firmware version
-#define FW_version "3.0.7"
+#define FW_version "3.0.8-alpha"
 
 #define FW_PRUSA3D_MAGIC "PRUSA3DFW"
 #define FW_PRUSA3D_MAGIC_LEN 10

+ 3 - 7
Firmware/Marlin_main.cpp

@@ -1053,7 +1053,7 @@ void setup()
       // Show the message.
       lcd_show_fullscreen_message_and_wait_P(MSG_BABYSTEP_Z_NOT_SET);
       lcd_update_enable(true);
-      lcd_implementation_clear();
+      // lcd_implementation_clear();
   }
 
   // Store the currently running firmware into an eeprom,
@@ -2961,6 +2961,8 @@ void process_commands()
                 bool result = sample_mesh_and_store_reference();
                 // if (result) babystep_apply();
             } else {
+                // Reset the baby step value.
+                eeprom_write_byte((unsigned char*)EEPROM_BABYSTEP_Z_SET, 0xFF);
                 // Complete XYZ calibration.
                 BedSkewOffsetDetectionResultType result = find_bed_offset_and_skew(verbosity_level);
                 uint8_t point_too_far_mask = 0;
@@ -2991,9 +2993,6 @@ void process_commands()
             // Timeouted.
         }
         lcd_update_enable(true);
-        lcd_implementation_clear();
-        // lcd_return_to_status();
-        lcd_update();
         break;
     }
 
@@ -3057,9 +3056,6 @@ void process_commands()
         plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS],current_position[Z_AXIS] , current_position[E_AXIS], homing_feedrate[Z_AXIS]/40, active_extruder);
         st_synchronize();
         lcd_update_enable(true);
-        lcd_implementation_clear();
-        // lcd_return_to_status();
-        lcd_update();
         break;
     }
 #endif

+ 32 - 10
Firmware/mesh_bed_calibration.cpp

@@ -1547,8 +1547,10 @@ BedSkewOffsetDetectionResultType find_bed_offset_and_skew(int8_t verbosity_level
 //    SERIAL_ECHOPGM("");
 
 #ifdef MESH_BED_CALIBRATION_SHOW_LCD
-    lcd_implementation_clear();
-    lcd_print_at_PGM(0, 0, MSG_FIND_BED_OFFSET_AND_SKEW_LINE1);
+    uint8_t next_line;
+    lcd_display_message_fullscreen_P(MSG_FIND_BED_OFFSET_AND_SKEW_LINE1, next_line);
+    if (next_line > 3)
+        next_line = 3;
 #endif /* MESH_BED_CALIBRATION_SHOW_LCD */
 
     // Collect the rear 2x3 points.
@@ -1557,9 +1559,8 @@ BedSkewOffsetDetectionResultType find_bed_offset_and_skew(int8_t verbosity_level
         // Don't let the manage_inactivity() function remove power from the motors.
         refresh_cmd_timeout();
 #ifdef MESH_BED_CALIBRATION_SHOW_LCD
-        lcd_print_at_PGM(0, 1, MSG_FIND_BED_OFFSET_AND_SKEW_LINE2);
-        lcd_implementation_print_at(0, 2, k+1);
-        lcd_printPGM(MSG_FIND_BED_OFFSET_AND_SKEW_LINE3);
+        lcd_implementation_print_at(0, next_line, k+1);
+        lcd_printPGM(MSG_FIND_BED_OFFSET_AND_SKEW_LINE2);
 #endif /* MESH_BED_CALIBRATION_SHOW_LCD */
         float *pt = pts + k * 2;
         // Go up to z_initial.
@@ -1705,8 +1706,10 @@ BedSkewOffsetDetectionResultType improve_bed_offset_and_skew(int8_t method, int8
     bool endstop_z_enabled = enable_z_endstop(false);
 
 #ifdef MESH_BED_CALIBRATION_SHOW_LCD
-    lcd_implementation_clear();
-    lcd_print_at_PGM(0, 0, MSG_IMPROVE_BED_OFFSET_AND_SKEW_LINE1);
+    uint8_t next_line;
+    lcd_display_message_fullscreen_P(MSG_IMPROVE_BED_OFFSET_AND_SKEW_LINE1, next_line);
+    if (next_line > 3)
+        next_line = 3;
 #endif /* MESH_BED_CALIBRATION_SHOW_LCD */
 
     // Collect a matrix of 9x9 points.
@@ -1716,9 +1719,8 @@ BedSkewOffsetDetectionResultType improve_bed_offset_and_skew(int8_t method, int8
         refresh_cmd_timeout();
         // Print the decrasing ID of the measurement point.
 #ifdef MESH_BED_CALIBRATION_SHOW_LCD
-        lcd_print_at_PGM(0, 1, MSG_IMPROVE_BED_OFFSET_AND_SKEW_LINE2);
-        lcd_implementation_print_at(0, 2, mesh_point+1);
-        lcd_printPGM(MSG_IMPROVE_BED_OFFSET_AND_SKEW_LINE3);
+        lcd_implementation_print_at(0, next_line, mesh_point+1);
+        lcd_printPGM(MSG_IMPROVE_BED_OFFSET_AND_SKEW_LINE2);
 #endif /* MESH_BED_CALIBRATION_SHOW_LCD */
 
         // Move up.
@@ -1963,6 +1965,16 @@ bool sample_mesh_and_store_reference()
     // Don't let the manage_inactivity() function remove power from the motors.
     refresh_cmd_timeout();
 
+#ifdef MESH_BED_CALIBRATION_SHOW_LCD
+    uint8_t next_line;
+    lcd_display_message_fullscreen_P(MSG_MEASURE_BED_REFERENCE_HEIGHT_LINE1, next_line);
+    if (next_line > 3)
+        next_line = 3;
+    // display "point xx of yy"
+    lcd_implementation_print_at(0, next_line, 1);
+    lcd_printPGM(MSG_MEASURE_BED_REFERENCE_HEIGHT_LINE2);
+#endif /* MESH_BED_CALIBRATION_SHOW_LCD */
+
     // Sample Z heights for the mesh bed leveling.
     // In addition, store the results into an eeprom, to be used later for verification of the bed leveling process.
     {
@@ -1981,12 +1993,20 @@ bool sample_mesh_and_store_reference()
         mbl.set_z(0, 0, current_position[Z_AXIS]);
     }
     for (int8_t mesh_point = 1; mesh_point != MESH_MEAS_NUM_X_POINTS * MESH_MEAS_NUM_Y_POINTS; ++ mesh_point) {
+        // Don't let the manage_inactivity() function remove power from the motors.
+        refresh_cmd_timeout();
+        // Print the decrasing ID of the measurement point.
         current_position[Z_AXIS] = MESH_HOME_Z_SEARCH;
         go_to_current(homing_feedrate[Z_AXIS]/60);
         current_position[X_AXIS] = pgm_read_float(bed_ref_points+2*mesh_point);
         current_position[Y_AXIS] = pgm_read_float(bed_ref_points+2*mesh_point+1);
         world2machine_clamp(current_position[X_AXIS], current_position[Y_AXIS]);
         go_to_current(homing_feedrate[X_AXIS]/60);
+#ifdef MESH_BED_CALIBRATION_SHOW_LCD
+        // display "point xx of yy"
+        lcd_implementation_print_at(0, next_line, mesh_point+1);
+        lcd_printPGM(MSG_MEASURE_BED_REFERENCE_HEIGHT_LINE2);
+#endif /* MESH_BED_CALIBRATION_SHOW_LCD */
         find_bed_induction_sensor_point_z();
         // Get cords of measuring point
         int8_t ix = mesh_point % MESH_MEAS_NUM_X_POINTS;
@@ -2023,6 +2043,7 @@ bool sample_mesh_and_store_reference()
                 float dif = mbl.z_values[j][i] - mbl.z_values[0][0];
                 int16_t dif_quantized = int16_t(floor(dif * 100.f + 0.5f));
                 eeprom_update_word((uint16_t*)addr, *reinterpret_cast<uint16_t*>(&dif_quantized));
+                #if 0
                 {
                     uint16_t z_offset_u = eeprom_read_word((uint16_t*)addr);
                     float dif2 = *reinterpret_cast<int16_t*>(&z_offset_u) * 0.01;
@@ -2037,6 +2058,7 @@ bool sample_mesh_and_store_reference()
                     MYSERIAL.print(dif2, 5);
                     SERIAL_ECHOLNPGM("");
                 }
+                #endif
                 addr += 2;
             }
     }

+ 41 - 17
Firmware/ultralcd.cpp

@@ -1441,17 +1441,16 @@ bool lcd_calibrate_z_end_stop_manual(bool only_z)
     // Until confirmed by the confirmation dialog.
     for (;;) {
         unsigned long previous_millis_cmd = millis();
-        if (only_z) {
-            lcd_display_message_fullscreen_P(MSG_MOVE_CARRIAGE_TO_THE_TOP_Z);
-        }else{
-            lcd_display_message_fullscreen_P(MSG_MOVE_CARRIAGE_TO_THE_TOP);
-        }
+        const char   *msg                 = only_z ? MSG_MOVE_CARRIAGE_TO_THE_TOP_Z : MSG_MOVE_CARRIAGE_TO_THE_TOP;
+        const char   *msg_next            = lcd_display_message_fullscreen_P(msg);
+        const bool    multi_screen        = msg_next != NULL;
+        unsigned long previous_millis_msg = millis();
         // Until the user finishes the z up movement.
         encoderDiff = 0;
         encoderPosition = 0;
         for (;;) {
-            if (millis() - previous_millis_cmd > LCD_TIMEOUT_TO_STATUS)
-                goto canceled;
+//          if (millis() - previous_millis_cmd > LCD_TIMEOUT_TO_STATUS)
+//             goto canceled;
             manage_heater();
             manage_inactivity(true);
             if (abs(encoderDiff) >= ENCODER_PULSES_PER_STEP) {
@@ -1474,6 +1473,12 @@ bool lcd_calibrate_z_end_stop_manual(bool only_z)
                 while (lcd_clicked()) ;
                 break;
             }
+            if (multi_screen && millis() - previous_millis_msg > 5000) {
+                if (msg_next == NULL)
+                    msg_next = msg;
+                msg_next = lcd_display_message_fullscreen_P(msg_next);
+                previous_millis_msg = millis();
+            }
         }
 
         if (! clean_nozzle_asked) {
@@ -1482,7 +1487,7 @@ bool lcd_calibrate_z_end_stop_manual(bool only_z)
         }
 
         // Let the user confirm, that the Z carriage is at the top end stoppers.
-        int8_t result = lcd_show_fullscreen_message_yes_no_and_wait_P(MSG_CONFIRM_CARRIAGE_AT_THE_TOP);
+        int8_t result = lcd_show_fullscreen_message_yes_no_and_wait_P(MSG_CONFIRM_CARRIAGE_AT_THE_TOP, false);
         if (result == -1)
             goto canceled;
         else if (result == 1)
@@ -1513,14 +1518,15 @@ static inline bool pgm_is_interpunction(const char *c_addr)
     return c == '.' || c == ',' || c == ':'|| c == ';' || c == '?' || c == '!' || c == '/';
 }
 
-const char* lcd_display_message_fullscreen_P(const char *msg)
+const char* lcd_display_message_fullscreen_P(const char *msg, uint8_t &nlines)
 {
     // Disable update of the screen by the usual lcd_update() routine. 
     lcd_update_enable(false);
     lcd_implementation_clear();
     lcd.setCursor(0, 0);
     const char *msgend = msg;
-    for (int8_t row = 0; row < 4; ++ row) {
+    uint8_t row = 0;
+    for (; row < 4; ++ row) {
         while (pgm_is_whitespace(msg))
             ++ msg;
         if (pgm_read_byte(msg) == 0)
@@ -1545,6 +1551,7 @@ const char* lcd_display_message_fullscreen_P(const char *msg)
         }
     }
 
+    nlines = row;
     return (pgm_read_byte(msgend) == 0) ? NULL : msgend;
 }
 
@@ -3290,10 +3297,28 @@ void lcd_init()
 //#include <avr/pgmspace.h>
 
 static volatile bool lcd_update_enabled = true;
+static unsigned long lcd_timeoutToStatus = 0;
 
 void lcd_update_enable(bool enabled)
 {
-    lcd_update_enabled = enabled;
+    if (lcd_update_enabled != enabled) {
+        lcd_update_enabled = enabled;
+        if (enabled) {
+            // Reset encoder position. This is equivalent to re-entering a menu.
+            encoderPosition = 0;
+            encoderDiff = 0;
+            // Enabling the normal LCD update procedure.
+            // Reset the timeout interval.
+            lcd_timeoutToStatus = millis() + LCD_TIMEOUT_TO_STATUS;
+            // Force the keypad update now.
+            lcd_next_update_millis = millis() - 1;
+            // Full update.
+            lcd_implementation_clear();
+            lcd_update(2);
+        } else {
+            // Clear the LCD always, or let it to the caller?
+        }
+    }
 }
 
 void lcd_update(uint8_t lcdDrawUpdateOverride)
@@ -3301,8 +3326,6 @@ void lcd_update(uint8_t lcdDrawUpdateOverride)
   if (lcdDrawUpdate < lcdDrawUpdateOverride)
     lcdDrawUpdate = lcdDrawUpdateOverride;
 
-	static unsigned long timeoutToStatus = 0;
-
   if (! lcd_update_enabled)
       return;
 
@@ -3364,13 +3387,14 @@ void lcd_update(uint8_t lcdDrawUpdateOverride)
 #endif
 	  if (abs(encoderDiff) >= ENCODER_PULSES_PER_STEP)
 	  {
-		  lcdDrawUpdate = 1;
+      if (lcdDrawUpdate == 0)
+		    lcdDrawUpdate = 1;
 		  encoderPosition += encoderDiff / ENCODER_PULSES_PER_STEP;
 		  encoderDiff = 0;
-		  timeoutToStatus = millis() + LCD_TIMEOUT_TO_STATUS;
+		  lcd_timeoutToStatus = millis() + LCD_TIMEOUT_TO_STATUS;
 	  }
 	  if (LCD_CLICKED)
-		  timeoutToStatus = millis() + LCD_TIMEOUT_TO_STATUS;
+		  lcd_timeoutToStatus = millis() + LCD_TIMEOUT_TO_STATUS;
 #endif//ULTIPANEL
 
 #ifdef DOGLCD        // Changes due to different driver architecture of the DOGM display
@@ -3395,7 +3419,7 @@ void lcd_update(uint8_t lcdDrawUpdateOverride)
 #endif
 
 #ifdef ULTIPANEL
-	  if (timeoutToStatus < millis() && currentMenu != lcd_status_screen)
+	  if (lcd_timeoutToStatus < millis() && currentMenu != lcd_status_screen)
 	  {
       // Exiting a menu. Let's call the menu function the last time with menuExiting flag set to true
       // to give it a chance to save its state.

+ 4 - 1
Firmware/ultralcd.h

@@ -40,7 +40,10 @@ void lcd_mylang();
   static void lcd_selftest_error(int _error_no, const char *_error_1, const char *_error_2);
   static void lcd_menu_statistics();
 
-  extern const char* lcd_display_message_fullscreen_P(const char *msg);
+  extern const char* lcd_display_message_fullscreen_P(const char *msg, uint8_t &nlines);
+  inline const char* lcd_display_message_fullscreen_P(const char *msg) 
+    { uint8_t nlines; return lcd_display_message_fullscreen_P(msg, nlines); }
+
   extern void lcd_wait_for_click();
   extern void lcd_show_fullscreen_message_and_wait_P(const char *msg);
   // 0: no, 1: yes, -1: timeouted