Browse Source

Limit LCD move_to_x/y coordinates for deltas

Related to MarlinFirmware/MarlinDev#270
Scott Lahteine 8 years ago
parent
commit
f18d3f451a
1 changed files with 9 additions and 2 deletions
  1. 9
    2
      Marlin/ultralcd.cpp

+ 9
- 2
Marlin/ultralcd.cpp View File

840
       lcd_goto_menu(lcd_move_menu_axis);
840
       lcd_goto_menu(lcd_move_menu_axis);
841
   }
841
   }
842
 }
842
 }
843
-static void lcd_move_x() { _lcd_move(PSTR(MSG_MOVE_X), X_AXIS, X_MIN_POS, X_MAX_POS); }
844
-static void lcd_move_y() { _lcd_move(PSTR(MSG_MOVE_Y), Y_AXIS, Y_MIN_POS, Y_MAX_POS); }
843
+#if ENABLED(DELTA)
844
+  static float delta_clip_radius_2 =  DELTA_PRINTABLE_RADIUS * DELTA_PRINTABLE_RADIUS;
845
+  static int delta_clip( float a ) { return sqrt(delta_clip_radius_2 - a*a); }
846
+  static void lcd_move_x() { int clip = delta_clip(current_position[Y_AXIS]); _lcd_move(PSTR(MSG_MOVE_X), X_AXIS, max(X_MIN_POS, -clip), min(X_MAX_POS, clip)); }
847
+  static void lcd_move_y() { int clip = delta_clip(current_position[X_AXIS]); _lcd_move(PSTR(MSG_MOVE_X), X_AXIS, max(X_MIN_POS, -clip), min(X_MAX_POS, clip)); }
848
+#else
849
+  static void lcd_move_x() { _lcd_move(PSTR(MSG_MOVE_X), X_AXIS, X_MIN_POS, X_MAX_POS); }
850
+  static void lcd_move_y() { _lcd_move(PSTR(MSG_MOVE_Y), Y_AXIS, Y_MIN_POS, Y_MAX_POS); }
851
+#endif
845
 static void lcd_move_z() { _lcd_move(PSTR(MSG_MOVE_Z), Z_AXIS, Z_MIN_POS, Z_MAX_POS); }
852
 static void lcd_move_z() { _lcd_move(PSTR(MSG_MOVE_Z), Z_AXIS, Z_MIN_POS, Z_MAX_POS); }
846
 static void lcd_move_e(
853
 static void lcd_move_e(
847
   #if EXTRUDERS > 1
854
   #if EXTRUDERS > 1

Loading…
Cancel
Save