Browse Source

Patch MBL feedback and event handling

Scott Lahteine 9 years ago
parent
commit
3fbf67e5ce
1 changed files with 17 additions and 15 deletions
  1. 17
    15
      Marlin/ultralcd.cpp

+ 17
- 15
Marlin/ultralcd.cpp View File

@@ -342,10 +342,10 @@ inline void lcd_save_previous_menu() {
342 342
   }
343 343
 }
344 344
 
345
-static void lcd_goto_previous_menu() {
345
+static void lcd_goto_previous_menu(bool feedback=false) {
346 346
   if (menu_history_depth > 0) {
347 347
     --menu_history_depth;
348
-    lcd_goto_menu(menu_history[menu_history_depth].menu_function, true
348
+    lcd_goto_menu(menu_history[menu_history_depth].menu_function, feedback
349 349
       #if ENABLED(ULTIPANEL)
350 350
         , menu_history[menu_history_depth].encoder_position
351 351
       #endif
@@ -928,24 +928,23 @@ void lcd_cooldown() {
928 928
         mbl.set_z(ix, iy, current_position[Z_AXIS]);
929 929
         _lcd_level_bed_position++;
930 930
         if (_lcd_level_bed_position == (MESH_NUM_X_POINTS) * (MESH_NUM_Y_POINTS)) {
931
-          current_position[Z_AXIS] = MESH_HOME_SEARCH_Z;
932
-          mbl_wait_for_move = true;
933
-          line_to_current(Z_AXIS);
934
-          st_synchronize();
935
-          mbl.active = 1;
936
-          enqueue_and_echo_commands_P(PSTR("G28"));
937
-          mbl_wait_for_move = false;
938 931
           lcd_return_to_status();
939
-          #if ENABLED(NEWPANEL)
940
-            lcd_quick_feedback();
941
-          #endif
942 932
           LCD_ALERTMESSAGEPGM(MSG_LEVEL_BED_DONE);
943 933
           #if HAS_BUZZER
944 934
             buzz(200, 659);
945 935
             buzz(200, 698);
946 936
           #endif
937
+          current_position[Z_AXIS] = MESH_HOME_SEARCH_Z;
938
+          line_to_current(Z_AXIS);
939
+          st_synchronize();
940
+          mbl.active = 1;
941
+          enqueue_and_echo_commands_P(PSTR("G28"));
947 942
         }
948 943
         else {
944
+          #if ENABLED(NEWPANEL)
945
+            lcd_quick_feedback();
946
+          #endif
947
+          mbl_wait_for_move = true;
949 948
           current_position[Z_AXIS] = MESH_HOME_SEARCH_Z;
950 949
           line_to_current(Z_AXIS);
951 950
           ix = _lcd_level_bed_position % (MESH_NUM_X_POINTS);
@@ -954,6 +953,9 @@ void lcd_cooldown() {
954 953
           current_position[X_AXIS] = mbl.get_x(ix);
955 954
           current_position[Y_AXIS] = mbl.get_y(iy);
956 955
           line_to_current(manual_feedrate[X_AXIS] <= manual_feedrate[Y_AXIS] ? X_AXIS : Y_AXIS);
956
+          st_synchronize();
957
+          mbl_wait_for_move = false;
958
+          encoderPosition = 0;
957 959
         }
958 960
       }
959 961
     }
@@ -972,7 +974,7 @@ void lcd_cooldown() {
972 974
       current_position[Y_AXIS] = MESH_MIN_Y;
973 975
       line_to_current(manual_feedrate[X_AXIS] <= manual_feedrate[Y_AXIS] ? X_AXIS : Y_AXIS);
974 976
       _lcd_level_bed_position = 0;
975
-      lcd_goto_menu(_lcd_level_bed_procedure, true);
977
+      lcd_goto_menu(_lcd_level_bed_procedure);
976 978
     }
977 979
   }
978 980
 
@@ -994,7 +996,7 @@ void lcd_cooldown() {
994 996
     axis_known_position[X_AXIS] = axis_known_position[Y_AXIS] = axis_known_position[Z_AXIS] = false;
995 997
     mbl.reset();
996 998
     enqueue_and_echo_commands_P(PSTR("G28"));
997
-    lcd_goto_menu(_lcd_level_bed_homing, true);
999
+    lcd_goto_menu(_lcd_level_bed_homing);
998 1000
   }
999 1001
 
1000 1002
   /**
@@ -1759,7 +1761,7 @@ static void lcd_control_volumetric_menu() {
1759 1761
       lcd_implementation_drawedit(editLabel, _strFunc(((_type)((int32_t)encoderPosition + minEditValue)) / scale)); \
1760 1762
     if (isClicked) { \
1761 1763
       *((_type*)editValue) = ((_type)((int32_t)encoderPosition + minEditValue)) / scale; \
1762
-      lcd_goto_previous_menu(); \
1764
+      lcd_goto_previous_menu(true); \
1763 1765
     } \
1764 1766
     return isClicked; \
1765 1767
   } \

Loading…
Cancel
Save