瀏覽代碼

Patch MBL feedback and event handling

Scott Lahteine 9 年之前
父節點
當前提交
3fbf67e5ce
共有 1 個檔案被更改,包括 17 行新增15 行删除
  1. 17
    15
      Marlin/ultralcd.cpp

+ 17
- 15
Marlin/ultralcd.cpp 查看文件

342
   }
342
   }
343
 }
343
 }
344
 
344
 
345
-static void lcd_goto_previous_menu() {
345
+static void lcd_goto_previous_menu(bool feedback=false) {
346
   if (menu_history_depth > 0) {
346
   if (menu_history_depth > 0) {
347
     --menu_history_depth;
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
       #if ENABLED(ULTIPANEL)
349
       #if ENABLED(ULTIPANEL)
350
         , menu_history[menu_history_depth].encoder_position
350
         , menu_history[menu_history_depth].encoder_position
351
       #endif
351
       #endif
928
         mbl.set_z(ix, iy, current_position[Z_AXIS]);
928
         mbl.set_z(ix, iy, current_position[Z_AXIS]);
929
         _lcd_level_bed_position++;
929
         _lcd_level_bed_position++;
930
         if (_lcd_level_bed_position == (MESH_NUM_X_POINTS) * (MESH_NUM_Y_POINTS)) {
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
           lcd_return_to_status();
931
           lcd_return_to_status();
939
-          #if ENABLED(NEWPANEL)
940
-            lcd_quick_feedback();
941
-          #endif
942
           LCD_ALERTMESSAGEPGM(MSG_LEVEL_BED_DONE);
932
           LCD_ALERTMESSAGEPGM(MSG_LEVEL_BED_DONE);
943
           #if HAS_BUZZER
933
           #if HAS_BUZZER
944
             buzz(200, 659);
934
             buzz(200, 659);
945
             buzz(200, 698);
935
             buzz(200, 698);
946
           #endif
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
         else {
943
         else {
944
+          #if ENABLED(NEWPANEL)
945
+            lcd_quick_feedback();
946
+          #endif
947
+          mbl_wait_for_move = true;
949
           current_position[Z_AXIS] = MESH_HOME_SEARCH_Z;
948
           current_position[Z_AXIS] = MESH_HOME_SEARCH_Z;
950
           line_to_current(Z_AXIS);
949
           line_to_current(Z_AXIS);
951
           ix = _lcd_level_bed_position % (MESH_NUM_X_POINTS);
950
           ix = _lcd_level_bed_position % (MESH_NUM_X_POINTS);
954
           current_position[X_AXIS] = mbl.get_x(ix);
953
           current_position[X_AXIS] = mbl.get_x(ix);
955
           current_position[Y_AXIS] = mbl.get_y(iy);
954
           current_position[Y_AXIS] = mbl.get_y(iy);
956
           line_to_current(manual_feedrate[X_AXIS] <= manual_feedrate[Y_AXIS] ? X_AXIS : Y_AXIS);
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
       current_position[Y_AXIS] = MESH_MIN_Y;
974
       current_position[Y_AXIS] = MESH_MIN_Y;
973
       line_to_current(manual_feedrate[X_AXIS] <= manual_feedrate[Y_AXIS] ? X_AXIS : Y_AXIS);
975
       line_to_current(manual_feedrate[X_AXIS] <= manual_feedrate[Y_AXIS] ? X_AXIS : Y_AXIS);
974
       _lcd_level_bed_position = 0;
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
     axis_known_position[X_AXIS] = axis_known_position[Y_AXIS] = axis_known_position[Z_AXIS] = false;
996
     axis_known_position[X_AXIS] = axis_known_position[Y_AXIS] = axis_known_position[Z_AXIS] = false;
995
     mbl.reset();
997
     mbl.reset();
996
     enqueue_and_echo_commands_P(PSTR("G28"));
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
       lcd_implementation_drawedit(editLabel, _strFunc(((_type)((int32_t)encoderPosition + minEditValue)) / scale)); \
1761
       lcd_implementation_drawedit(editLabel, _strFunc(((_type)((int32_t)encoderPosition + minEditValue)) / scale)); \
1760
     if (isClicked) { \
1762
     if (isClicked) { \
1761
       *((_type*)editValue) = ((_type)((int32_t)encoderPosition + minEditValue)) / scale; \
1763
       *((_type*)editValue) = ((_type)((int32_t)encoderPosition + minEditValue)) / scale; \
1762
-      lcd_goto_previous_menu(); \
1764
+      lcd_goto_previous_menu(true); \
1763
     } \
1765
     } \
1764
     return isClicked; \
1766
     return isClicked; \
1765
   } \
1767
   } \

Loading…
取消
儲存