Browse Source

Extend stack_overflow_protection for lcd_move_e and _lcd_level_bed

Extend stack_overflow_protection for lcd_move_e() and _lcd_level_bed() with
a refined method of 3050.
Blue-Marlin 9 years ago
parent
commit
c73f1b2471
1 changed files with 5 additions and 9 deletions
  1. 5
    9
      Marlin/ultralcd.cpp

+ 5
- 9
Marlin/ultralcd.cpp View File

828
 static void lcd_move_menu_axis();
828
 static void lcd_move_menu_axis();
829
 
829
 
830
 static void _lcd_move(const char* name, AxisEnum axis, int min, int max) {
830
 static void _lcd_move(const char* name, AxisEnum axis, int min, int max) {
831
-  if (encoderPosition != 0) {
831
+  if ((encoderPosition != 0) && (movesplanned() <= 3)) {
832
     refresh_cmd_timeout();
832
     refresh_cmd_timeout();
833
     current_position[axis] += float((int)encoderPosition) * move_menu_scale;
833
     current_position[axis] += float((int)encoderPosition) * move_menu_scale;
834
     if (min_software_endstops) NOLESS(current_position[axis], min);
834
     if (min_software_endstops) NOLESS(current_position[axis], min);
835
     if (max_software_endstops) NOMORE(current_position[axis], max);
835
     if (max_software_endstops) NOMORE(current_position[axis], max);
836
     encoderPosition = 0;
836
     encoderPosition = 0;
837
-    if (movesplanned() <= 3)
838
-      line_to_current(axis);
837
+    line_to_current(axis);
839
     lcdDrawUpdate = 1;
838
     lcdDrawUpdate = 1;
840
   }
839
   }
841
   if (lcdDrawUpdate) lcd_implementation_drawedit(name, ftostr31(current_position[axis]));
840
   if (lcdDrawUpdate) lcd_implementation_drawedit(name, ftostr31(current_position[axis]));
842
-  if (LCD_CLICKED) {
843
-      line_to_current(axis);
844
-      lcd_goto_previous_menu();
845
-  }
841
+  if (LCD_CLICKED) lcd_goto_previous_menu();
846
 }
842
 }
847
 #if ENABLED(DELTA)
843
 #if ENABLED(DELTA)
848
   static float delta_clip_radius_2 =  DELTA_PRINTABLE_RADIUS * DELTA_PRINTABLE_RADIUS;
844
   static float delta_clip_radius_2 =  DELTA_PRINTABLE_RADIUS * DELTA_PRINTABLE_RADIUS;
863
     unsigned short original_active_extruder = active_extruder;
859
     unsigned short original_active_extruder = active_extruder;
864
     active_extruder = e;
860
     active_extruder = e;
865
   #endif
861
   #endif
866
-  if (encoderPosition != 0) {
862
+  if ((encoderPosition != 0) && (movesplanned() <= 3)) {
867
     current_position[E_AXIS] += float((int)encoderPosition) * move_menu_scale;
863
     current_position[E_AXIS] += float((int)encoderPosition) * move_menu_scale;
868
     encoderPosition = 0;
864
     encoderPosition = 0;
869
     line_to_current(E_AXIS);
865
     line_to_current(E_AXIS);
2246
    *   - Click saves the Z and goes to the next mesh point
2242
    *   - Click saves the Z and goes to the next mesh point
2247
    */
2243
    */
2248
   static void _lcd_level_bed() {
2244
   static void _lcd_level_bed() {
2249
-    if (encoderPosition != 0) {
2245
+    if ((encoderPosition != 0) && (movesplanned() <= 3)) {
2250
       refresh_cmd_timeout();
2246
       refresh_cmd_timeout();
2251
       current_position[Z_AXIS] += float((int)encoderPosition) * MBL_Z_STEP;
2247
       current_position[Z_AXIS] += float((int)encoderPosition) * MBL_Z_STEP;
2252
       if (min_software_endstops) NOLESS(current_position[Z_AXIS], Z_MIN_POS);
2248
       if (min_software_endstops) NOLESS(current_position[Z_AXIS], Z_MIN_POS);

Loading…
Cancel
Save