Merge pull request #5487 from thinkyhead/rc_easier_move_axis
Rearrange Move Menu, Fix up Delta Calibration
This commit is contained in:
		
						commit
						0772c8e55f
					
				| @ -322,7 +322,8 @@ float code_value_temp_diff(); | ||||
|                delta_segments_per_second, | ||||
|                delta_diagonal_rod_trim_tower_1, | ||||
|                delta_diagonal_rod_trim_tower_2, | ||||
|                delta_diagonal_rod_trim_tower_3; | ||||
|                delta_diagonal_rod_trim_tower_3, | ||||
|                delta_clip_start_height; | ||||
|   void recalc_delta_settings(float radius, float diagonal_rod); | ||||
| #elif IS_SCARA | ||||
|   void forward_kinematics_SCARA(const float &a, const float &b); | ||||
|  | ||||
| @ -453,10 +453,7 @@ | ||||
|   #define DELTA_PRINTABLE_RADIUS 160.0 | ||||
| 
 | ||||
|   // Delta calibration menu
 | ||||
|   // uncomment to add three points calibration menu option.
 | ||||
|   // See http://minow.blogspot.com/index.html#4918805519571907051
 | ||||
|   // If needed, adjust the X, Y, Z calibration coordinates
 | ||||
|   // in ultralcd.cpp@lcd_delta_calibrate_menu()
 | ||||
|   //#define DELTA_CALIBRATION_MENU
 | ||||
| 
 | ||||
|   // After homing move down to a height where XY movement is unconstrained
 | ||||
|  | ||||
| @ -453,10 +453,7 @@ | ||||
|   #define DELTA_PRINTABLE_RADIUS 140.0 | ||||
| 
 | ||||
|   // Delta calibration menu
 | ||||
|   // uncomment to add three points calibration menu option.
 | ||||
|   // See http://minow.blogspot.com/index.html#4918805519571907051
 | ||||
|   // If needed, adjust the X, Y, Z calibration coordinates
 | ||||
|   // in ultralcd.cpp@lcd_delta_calibrate_menu()
 | ||||
|   //#define DELTA_CALIBRATION_MENU
 | ||||
| 
 | ||||
|   // After homing move down to a height where XY movement is unconstrained
 | ||||
|  | ||||
| @ -453,10 +453,7 @@ | ||||
|   #define DELTA_PRINTABLE_RADIUS 90.0 | ||||
| 
 | ||||
|   // Delta calibration menu
 | ||||
|   // uncomment to add three points calibration menu option.
 | ||||
|   // See http://minow.blogspot.com/index.html#4918805519571907051
 | ||||
|   // If needed, adjust the X, Y, Z calibration coordinates
 | ||||
|   // in ultralcd.cpp@lcd_delta_calibrate_menu()
 | ||||
|   //#define DELTA_CALIBRATION_MENU
 | ||||
| 
 | ||||
|   // After homing move down to a height where XY movement is unconstrained
 | ||||
|  | ||||
| @ -440,10 +440,7 @@ | ||||
|   #define DELTA_PRINTABLE_RADIUS 127.0 | ||||
| 
 | ||||
|   // Delta calibration menu
 | ||||
|   // uncomment to add three points calibration menu option.
 | ||||
|   // See http://minow.blogspot.com/index.html#4918805519571907051
 | ||||
|   // If needed, adjust the X, Y, Z calibration coordinates
 | ||||
|   // in ultralcd.cpp@lcd_delta_calibrate_menu()
 | ||||
|   //#define DELTA_CALIBRATION_MENU
 | ||||
| 
 | ||||
|   // After homing move down to a height where XY movement is unconstrained
 | ||||
|  | ||||
| @ -451,10 +451,7 @@ | ||||
|   #define DELTA_PRINTABLE_RADIUS 140.0 | ||||
| 
 | ||||
|   // Delta calibration menu
 | ||||
|   // uncomment to add three points calibration menu option.
 | ||||
|   // See http://minow.blogspot.com/index.html#4918805519571907051
 | ||||
|   // If needed, adjust the X, Y, Z calibration coordinates
 | ||||
|   // in ultralcd.cpp@lcd_delta_calibrate_menu()
 | ||||
|   //#define DELTA_CALIBRATION_MENU
 | ||||
| 
 | ||||
|   // After homing move down to a height where XY movement is unconstrained
 | ||||
|  | ||||
| @ -138,6 +138,12 @@ | ||||
| #ifndef MSG_LEVEL_BED | ||||
|   #define MSG_LEVEL_BED                       "Level bed" | ||||
| #endif | ||||
| #ifndef MSG_MOVING | ||||
|   #define MSG_MOVING                          "Moving..." | ||||
| #endif | ||||
| #ifndef MSG_FREE_XY | ||||
|   #define MSG_FREE_XY                         "Free XY" | ||||
| #endif | ||||
| #ifndef MSG_MOVE_X | ||||
|   #define MSG_MOVE_X                          "Move X" | ||||
| #endif | ||||
|  | ||||
| @ -390,7 +390,7 @@ uint8_t lcdDrawUpdate = LCDVIEW_CLEAR_CALL_REDRAW; // Set when the LCD needs to | ||||
|   bool screen_changed; | ||||
| 
 | ||||
|   // LCD and menu clicks
 | ||||
|   bool lcd_clicked, wait_for_unclick, defer_return_to_status; | ||||
|   bool lcd_clicked, wait_for_unclick, defer_return_to_status, no_reentrance; | ||||
| 
 | ||||
|   // Variables used when editing values.
 | ||||
|   const char* editLabel; | ||||
| @ -422,6 +422,27 @@ uint8_t lcdDrawUpdate = LCDVIEW_CLEAR_CALL_REDRAW; // Set when the LCD needs to | ||||
|     } | ||||
|   } | ||||
| 
 | ||||
|   /**
 | ||||
|    * Synchronize safely while holding the current screen | ||||
|    * This blocks all further screen or stripe updates once called | ||||
|    */ | ||||
|   inline void lcd_synchronize() { | ||||
|     lcd_implementation_drawmenu_static(LCD_HEIGHT >= 4 ? 1 : 0, PSTR(MSG_MOVING)); | ||||
|     if (no_reentrance) return; | ||||
|     no_reentrance = true; | ||||
|     screenFunc_t old_screen = currentScreen; | ||||
|     lcd_goto_screen(lcd_synchronize); | ||||
|     stepper.synchronize(); | ||||
|     no_reentrance = false; | ||||
|     lcd_goto_screen(old_screen); | ||||
|   } | ||||
| 
 | ||||
|   inline void lcd_wait_for_homing() { | ||||
|     no_reentrance = true; | ||||
|     while (!axis_homed[X_AXIS] || !axis_homed[Y_AXIS] || !axis_homed[Z_AXIS]) idle(); | ||||
|     no_reentrance = true; | ||||
|   } | ||||
| 
 | ||||
|   void lcd_return_to_status() { lcd_goto_screen(lcd_status_screen); } | ||||
| 
 | ||||
|   void lcd_save_previous_screen() { | ||||
| @ -1063,6 +1084,7 @@ void kill_screen(const char* lcd_msg) { | ||||
|     // Note: During Manual Bed Leveling the homed Z position is MESH_HOME_SEARCH_Z
 | ||||
|     // Z position will be restored with the final action, a G28
 | ||||
|     inline void _mbl_goto_xy(float x, float y) { | ||||
|       if (no_reentrance) return; | ||||
|       current_position[Z_AXIS] = LOGICAL_Z_POSITION(MESH_HOME_SEARCH_Z + Z_HOMING_HEIGHT); | ||||
|       line_to_current(Z_AXIS); | ||||
|       current_position[X_AXIS] = LOGICAL_X_POSITION(x); | ||||
| @ -1072,7 +1094,7 @@ void kill_screen(const char* lcd_msg) { | ||||
|         current_position[Z_AXIS] = LOGICAL_Z_POSITION(MESH_HOME_SEARCH_Z); | ||||
|         line_to_current(Z_AXIS); | ||||
|       #endif | ||||
|       stepper.synchronize(); | ||||
|       lcd_synchronize(); | ||||
|     } | ||||
| 
 | ||||
|     void _lcd_level_goto_next_point(); | ||||
| @ -1094,6 +1116,8 @@ void kill_screen(const char* lcd_msg) { | ||||
|     void _lcd_level_bed_get_z() { | ||||
|       ENCODER_DIRECTION_NORMAL(); | ||||
| 
 | ||||
|       if (no_reentrance) goto KeepDrawing; | ||||
| 
 | ||||
|       // Encoder wheel adjusts the Z position
 | ||||
|       if (encoderPosition) { | ||||
|         refresh_cmd_timeout(); | ||||
| @ -1121,7 +1145,7 @@ void kill_screen(const char* lcd_msg) { | ||||
| 
 | ||||
|             current_position[Z_AXIS] = MESH_HOME_SEARCH_Z + Z_HOMING_HEIGHT; | ||||
|             line_to_current(Z_AXIS); | ||||
|             stepper.synchronize(); | ||||
|             lcd_synchronize(); | ||||
| 
 | ||||
|             mbl.set_has_mesh(true); | ||||
|             enqueue_and_echo_commands_P(PSTR("G28")); | ||||
| @ -1141,6 +1165,7 @@ void kill_screen(const char* lcd_msg) { | ||||
|         debounce_click = false; | ||||
|       } | ||||
| 
 | ||||
| KeepDrawing: | ||||
|       // Update on first display, then only on updates to Z position
 | ||||
|       // Show message above on clicks instead
 | ||||
|       if (lcdDrawUpdate) { | ||||
| @ -1215,8 +1240,9 @@ void kill_screen(const char* lcd_msg) { | ||||
|           LCDVIEW_CALL_NO_REDRAW | ||||
|         #endif | ||||
|       ; | ||||
|       if (axis_homed[X_AXIS] && axis_homed[Y_AXIS] && axis_homed[Z_AXIS]) | ||||
|         lcd_goto_screen(_lcd_level_bed_homing_done); | ||||
|       if (no_reentrance) return; | ||||
|       lcd_wait_for_homing(); | ||||
|       lcd_goto_screen(_lcd_level_bed_homing_done); | ||||
|     } | ||||
| 
 | ||||
|     /**
 | ||||
| @ -1256,6 +1282,14 @@ void kill_screen(const char* lcd_msg) { | ||||
|     //
 | ||||
|     MENU_BACK(MSG_MAIN); | ||||
| 
 | ||||
|     //
 | ||||
|     // Move Axis
 | ||||
|     //
 | ||||
|     #if ENABLED(DELTA) | ||||
|       if (axis_homed[Z_AXIS]) | ||||
|     #endif | ||||
|         MENU_ITEM(submenu, MSG_MOVE_AXIS, lcd_move_menu); | ||||
| 
 | ||||
|     //
 | ||||
|     // Auto Home
 | ||||
|     //
 | ||||
| @ -1283,11 +1317,6 @@ void kill_screen(const char* lcd_msg) { | ||||
|       MENU_ITEM(submenu, MSG_LEVEL_BED, lcd_level_bed); | ||||
|     #endif | ||||
| 
 | ||||
|     //
 | ||||
|     // Move Axis
 | ||||
|     //
 | ||||
|     MENU_ITEM(submenu, MSG_MOVE_AXIS, lcd_move_menu); | ||||
| 
 | ||||
|     //
 | ||||
|     // Disable Steppers
 | ||||
|     //
 | ||||
| @ -1341,14 +1370,50 @@ void kill_screen(const char* lcd_msg) { | ||||
|     END_MENU(); | ||||
|   } | ||||
| 
 | ||||
|   float move_menu_scale; | ||||
| 
 | ||||
|   #if ENABLED(DELTA_CALIBRATION_MENU) | ||||
| 
 | ||||
|     void lcd_move_z(); | ||||
|     void lcd_delta_calibrate_menu(); | ||||
| 
 | ||||
|     void _lcd_calibrate_homing() { | ||||
|       if (lcdDrawUpdate) lcd_implementation_drawmenu_static(LCD_HEIGHT >= 4 ? 1 : 0, PSTR(MSG_LEVEL_BED_HOMING)); | ||||
|       lcdDrawUpdate = | ||||
|         #if ENABLED(DOGLCD) | ||||
|           LCDVIEW_CALL_REDRAW_NEXT | ||||
|         #else | ||||
|           LCDVIEW_CALL_NO_REDRAW | ||||
|         #endif | ||||
|       ; | ||||
|       if (axis_homed[X_AXIS] && axis_homed[Y_AXIS] && axis_homed[Z_AXIS]) | ||||
|         lcd_goto_previous_menu(); | ||||
|     } | ||||
| 
 | ||||
|     void _lcd_delta_calibrate_home() { | ||||
|       enqueue_and_echo_commands_P(PSTR("G28")); | ||||
|       lcd_goto_screen(_lcd_calibrate_homing); | ||||
|     } | ||||
| 
 | ||||
|     // Move directly to the tower position with uninterpolated moves
 | ||||
|     // If we used interpolated moves it would cause this to become re-entrant
 | ||||
|     void _goto_tower_pos(const float &a) { | ||||
|       do_blocking_move_to( | ||||
|         a < 0 ? X_HOME_POS : sin(a) * -(DELTA_PRINTABLE_RADIUS), | ||||
|         a < 0 ? Y_HOME_POS : cos(a) *  (DELTA_PRINTABLE_RADIUS), | ||||
|         4 | ||||
|       ); | ||||
|       if (no_reentrance) return; | ||||
| 
 | ||||
|       current_position[Z_AXIS] = max(Z_HOMING_HEIGHT, Z_CLEARANCE_BETWEEN_PROBES) + (DELTA_PRINTABLE_RADIUS) / 5; | ||||
|       line_to_current(Z_AXIS); | ||||
| 
 | ||||
|       current_position[X_AXIS] = a < 0 ? X_HOME_POS : sin(a) * -(DELTA_PRINTABLE_RADIUS); | ||||
|       current_position[Y_AXIS] = a < 0 ? Y_HOME_POS : cos(a) *  (DELTA_PRINTABLE_RADIUS); | ||||
|       line_to_current(Z_AXIS); | ||||
| 
 | ||||
|       current_position[Z_AXIS] = 4.0; | ||||
|       line_to_current(Z_AXIS); | ||||
| 
 | ||||
|       lcd_synchronize(); | ||||
| 
 | ||||
|       move_menu_scale = 0.1; | ||||
|       lcd_goto_screen(lcd_move_z); | ||||
|     } | ||||
| 
 | ||||
|     void _goto_tower_x() { _goto_tower_pos(RADIANS(120)); } | ||||
| @ -1359,18 +1424,18 @@ void kill_screen(const char* lcd_msg) { | ||||
|     void lcd_delta_calibrate_menu() { | ||||
|       START_MENU(); | ||||
|       MENU_BACK(MSG_MAIN); | ||||
|       MENU_ITEM(gcode, MSG_AUTO_HOME, PSTR("G28")); | ||||
|       MENU_ITEM(function, MSG_DELTA_CALIBRATE_X, _goto_tower_x); | ||||
|       MENU_ITEM(function, MSG_DELTA_CALIBRATE_Y, _goto_tower_y); | ||||
|       MENU_ITEM(function, MSG_DELTA_CALIBRATE_Z, _goto_tower_z); | ||||
|       MENU_ITEM(function, MSG_DELTA_CALIBRATE_CENTER, _goto_center); | ||||
|       MENU_ITEM(submenu, MSG_AUTO_HOME, _lcd_delta_calibrate_home); | ||||
|       if (axis_homed[Z_AXIS]) { | ||||
|         MENU_ITEM(submenu, MSG_DELTA_CALIBRATE_X, _goto_tower_x); | ||||
|         MENU_ITEM(submenu, MSG_DELTA_CALIBRATE_Y, _goto_tower_y); | ||||
|         MENU_ITEM(submenu, MSG_DELTA_CALIBRATE_Z, _goto_tower_z); | ||||
|         MENU_ITEM(submenu, MSG_DELTA_CALIBRATE_CENTER, _goto_center); | ||||
|       } | ||||
|       END_MENU(); | ||||
|     } | ||||
| 
 | ||||
|   #endif // DELTA_CALIBRATION_MENU
 | ||||
| 
 | ||||
|   float move_menu_scale; | ||||
| 
 | ||||
|   /**
 | ||||
|    * If the most recent manual move hasn't been fed to the planner yet, | ||||
|    * and the planner can accept one, send immediately | ||||
| @ -1495,58 +1560,48 @@ void kill_screen(const char* lcd_msg) { | ||||
|    * | ||||
|    */ | ||||
| 
 | ||||
|   #if IS_KINEMATIC | ||||
|     #define _MOVE_XYZ_ALLOWED (axis_homed[X_AXIS] && axis_homed[Y_AXIS] && axis_homed[Z_AXIS]) | ||||
|   #else | ||||
|     #define _MOVE_XYZ_ALLOWED true | ||||
|   #endif | ||||
|   screenFunc_t _manual_move_func_ptr; | ||||
| 
 | ||||
|   void _lcd_move_menu_axis() { | ||||
|   void lcd_move_menu_10mm() { move_menu_scale = 10.0; lcd_goto_screen(_manual_move_func_ptr); } | ||||
|   void lcd_move_menu_1mm()  { move_menu_scale =  1.0; lcd_goto_screen(_manual_move_func_ptr); } | ||||
|   void lcd_move_menu_01mm() { move_menu_scale =  0.1; lcd_goto_screen(_manual_move_func_ptr); } | ||||
| 
 | ||||
|   void _lcd_move_distance_menu(AxisEnum axis, screenFunc_t func) { | ||||
|     _manual_move_func_ptr = func; | ||||
|     START_MENU(); | ||||
|     if (LCD_HEIGHT >= 4) { | ||||
|       switch(axis) { | ||||
|         case X_AXIS: | ||||
|           STATIC_ITEM(MSG_MOVE_X, true, true); break; | ||||
|         case Y_AXIS: | ||||
|           STATIC_ITEM(MSG_MOVE_Y, true, true); break; | ||||
|         case Z_AXIS: | ||||
|           STATIC_ITEM(MSG_MOVE_Z, true, true); break; | ||||
|         default: | ||||
|           STATIC_ITEM(MSG_MOVE_E, true, true); break; | ||||
|       } | ||||
|     } | ||||
|     MENU_BACK(MSG_MOVE_AXIS); | ||||
| 
 | ||||
|     if (_MOVE_XYZ_ALLOWED) { | ||||
|       MENU_ITEM(submenu, MSG_MOVE_X, lcd_move_x); | ||||
|       MENU_ITEM(submenu, MSG_MOVE_Y, lcd_move_y); | ||||
|     } | ||||
| 
 | ||||
|     if (move_menu_scale < 10.0) { | ||||
|       if (_MOVE_XYZ_ALLOWED) MENU_ITEM(submenu, MSG_MOVE_Z, lcd_move_z); | ||||
| 
 | ||||
|       #if ENABLED(SWITCHING_EXTRUDER) | ||||
|         if (active_extruder) | ||||
|           MENU_ITEM(gcode, MSG_SELECT " " MSG_E1, PSTR("T0")); | ||||
|         else | ||||
|           MENU_ITEM(gcode, MSG_SELECT " " MSG_E2, PSTR("T1")); | ||||
|       #endif | ||||
| 
 | ||||
|       MENU_ITEM(submenu, MSG_MOVE_E, lcd_move_e); | ||||
|       #if E_MANUAL > 1 | ||||
|         MENU_ITEM(submenu, MSG_MOVE_E MSG_MOVE_E1, lcd_move_e0); | ||||
|         MENU_ITEM(submenu, MSG_MOVE_E MSG_MOVE_E2, lcd_move_e1); | ||||
|         #if E_MANUAL > 2 | ||||
|           MENU_ITEM(submenu, MSG_MOVE_E MSG_MOVE_E3, lcd_move_e2); | ||||
|           #if E_MANUAL > 3 | ||||
|             MENU_ITEM(submenu, MSG_MOVE_E MSG_MOVE_E4, lcd_move_e3); | ||||
|           #endif | ||||
|         #endif | ||||
|       #endif | ||||
|     } | ||||
|     if (axis == X_AXIS || axis == Y_AXIS) | ||||
|       MENU_ITEM(submenu, MSG_MOVE_10MM, lcd_move_menu_10mm); | ||||
|     MENU_ITEM(submenu, MSG_MOVE_1MM, lcd_move_menu_1mm); | ||||
|     MENU_ITEM(submenu, MSG_MOVE_01MM, lcd_move_menu_01mm); | ||||
|     END_MENU(); | ||||
|   } | ||||
| 
 | ||||
|   void lcd_move_menu_10mm() { | ||||
|     move_menu_scale = 10.0; | ||||
|     _lcd_move_menu_axis(); | ||||
|   } | ||||
|   void lcd_move_menu_1mm() { | ||||
|     move_menu_scale = 1.0; | ||||
|     _lcd_move_menu_axis(); | ||||
|   } | ||||
|   void lcd_move_menu_01mm() { | ||||
|     move_menu_scale = 0.1; | ||||
|     _lcd_move_menu_axis(); | ||||
|   } | ||||
|   void lcd_move_get_x_amount()        { _lcd_move_distance_menu(X_AXIS, lcd_move_x); } | ||||
|   void lcd_move_get_y_amount()        { _lcd_move_distance_menu(Y_AXIS, lcd_move_y); } | ||||
|   void lcd_move_get_z_amount()        { _lcd_move_distance_menu(Z_AXIS, lcd_move_z); } | ||||
|   void lcd_move_get_e_amount()        { _lcd_move_distance_menu(E_AXIS, lcd_move_e); } | ||||
|   #if E_MANUAL > 1 | ||||
|     void lcd_move_get_e0_amount()     { _lcd_move_distance_menu(E_AXIS, lcd_move_e0); } | ||||
|     void lcd_move_get_e1_amount()     { _lcd_move_distance_menu(E_AXIS, lcd_move_e1); } | ||||
|     #if E_MANUAL > 2 | ||||
|       void lcd_move_get_e2_amount()   { _lcd_move_distance_menu(E_AXIS, lcd_move_e2); } | ||||
|       #if E_MANUAL > 3 | ||||
|         void lcd_move_get_e3_amount() { _lcd_move_distance_menu(E_AXIS, lcd_move_e3); } | ||||
|       #endif | ||||
|     #endif | ||||
|   #endif | ||||
| 
 | ||||
|   /**
 | ||||
|    * | ||||
| @ -1554,16 +1609,63 @@ void kill_screen(const char* lcd_msg) { | ||||
|    * | ||||
|    */ | ||||
| 
 | ||||
|   #if IS_KINEMATIC | ||||
|     #define _MOVE_XYZ_ALLOWED (axis_homed[X_AXIS] && axis_homed[Y_AXIS] && axis_homed[Z_AXIS]) | ||||
|     #if ENABLED(DELTA) | ||||
|       #define _MOVE_XY_ALLOWED (current_position[Z_AXIS] <= delta_clip_start_height) | ||||
|       void lcd_lower_z_to_clip_height() { | ||||
|         if (!no_reentrance) { | ||||
|           current_position[Z_AXIS] = delta_clip_start_height; | ||||
|           line_to_current(Z_AXIS); | ||||
|           lcd_synchronize(); | ||||
|         } | ||||
|       } | ||||
|     #else | ||||
|       #define _MOVE_XY_ALLOWED true | ||||
|     #endif | ||||
|   #else | ||||
|     #define _MOVE_XYZ_ALLOWED true | ||||
|     #define _MOVE_XY_ALLOWED true | ||||
|   #endif | ||||
| 
 | ||||
|   void lcd_move_menu() { | ||||
|     START_MENU(); | ||||
|     MENU_BACK(MSG_PREPARE); | ||||
| 
 | ||||
|     if (_MOVE_XYZ_ALLOWED) | ||||
|       MENU_ITEM(submenu, MSG_MOVE_10MM, lcd_move_menu_10mm); | ||||
|     if (_MOVE_XYZ_ALLOWED) { | ||||
|       if (_MOVE_XY_ALLOWED) { | ||||
|         MENU_ITEM(submenu, MSG_MOVE_X, lcd_move_get_x_amount); | ||||
|         MENU_ITEM(submenu, MSG_MOVE_Y, lcd_move_get_y_amount); | ||||
|       } | ||||
|       #if ENABLED(DELTA) | ||||
|         else | ||||
|           MENU_ITEM(function, MSG_FREE_XY, lcd_lower_z_to_clip_height); | ||||
|       #endif | ||||
| 
 | ||||
|       MENU_ITEM(submenu, MSG_MOVE_Z, lcd_move_get_z_amount); | ||||
|     } | ||||
|     else | ||||
|       MENU_ITEM(gcode, MSG_AUTO_HOME, PSTR("G28")); | ||||
| 
 | ||||
|     #if ENABLED(SWITCHING_EXTRUDER) | ||||
|       if (active_extruder) | ||||
|         MENU_ITEM(gcode, MSG_SELECT " " MSG_E1, PSTR("T0")); | ||||
|       else | ||||
|         MENU_ITEM(gcode, MSG_SELECT " " MSG_E2, PSTR("T1")); | ||||
|     #endif | ||||
| 
 | ||||
|     MENU_ITEM(submenu, MSG_MOVE_E, lcd_move_get_e_amount); | ||||
|     #if E_MANUAL > 1 | ||||
|       MENU_ITEM(submenu, MSG_MOVE_E MSG_MOVE_E1, lcd_move_get_e0_amount); | ||||
|       MENU_ITEM(submenu, MSG_MOVE_E MSG_MOVE_E2, lcd_move_get_e1_amount); | ||||
|       #if E_MANUAL > 2 | ||||
|         MENU_ITEM(submenu, MSG_MOVE_E MSG_MOVE_E3, lcd_move_get_e2_amount); | ||||
|         #if E_MANUAL > 3 | ||||
|           MENU_ITEM(submenu, MSG_MOVE_E MSG_MOVE_E4, lcd_move_get_e3_amount); | ||||
|         #endif | ||||
|       #endif | ||||
|     #endif | ||||
| 
 | ||||
|     MENU_ITEM(submenu, MSG_MOVE_1MM, lcd_move_menu_1mm); | ||||
|     MENU_ITEM(submenu, MSG_MOVE_01MM, lcd_move_menu_01mm); | ||||
|     //TODO:X,Y,Z,E
 | ||||
|     END_MENU(); | ||||
|   } | ||||
| 
 | ||||
| @ -2502,6 +2604,39 @@ void kill_screen(const char* lcd_msg) { | ||||
|     void reprapworld_keypad_move_y_down()  { _reprapworld_keypad_move(Y_AXIS,  1); } | ||||
|     void reprapworld_keypad_move_home()    { enqueue_and_echo_commands_P(PSTR("G28")); } // move all axes home and wait
 | ||||
|     void reprapworld_keypad_move_menu()    { lcd_goto_screen(lcd_move_menu); } | ||||
| 
 | ||||
|     inline void handle_reprapworld_keypad() { | ||||
| 
 | ||||
|       static uint8_t keypad_debounce = 0; | ||||
| 
 | ||||
|       if (!REPRAPWORLD_KEYPAD_PRESSED) { | ||||
|         if (keypad_debounce > 0) keypad_debounce--; | ||||
|       } | ||||
|       else if (!keypad_debounce) { | ||||
|         keypad_debounce = 2; | ||||
| 
 | ||||
|         if (REPRAPWORLD_KEYPAD_MOVE_MENU)       reprapworld_keypad_move_menu(); | ||||
| 
 | ||||
|         #if DISABLED(DELTA) && Z_HOME_DIR == -1 | ||||
|           if (REPRAPWORLD_KEYPAD_MOVE_Z_UP)     reprapworld_keypad_move_z_up(); | ||||
|         #endif | ||||
| 
 | ||||
|         if (axis_homed[X_AXIS] && axis_homed[Y_AXIS] && axis_homed[Z_AXIS]) { | ||||
|           #if ENABLED(DELTA) || Z_HOME_DIR != -1 | ||||
|             if (REPRAPWORLD_KEYPAD_MOVE_Z_UP)   reprapworld_keypad_move_z_up(); | ||||
|           #endif | ||||
|           if (REPRAPWORLD_KEYPAD_MOVE_Z_DOWN)   reprapworld_keypad_move_z_down(); | ||||
|           if (REPRAPWORLD_KEYPAD_MOVE_X_LEFT)   reprapworld_keypad_move_x_left(); | ||||
|           if (REPRAPWORLD_KEYPAD_MOVE_X_RIGHT)  reprapworld_keypad_move_x_right(); | ||||
|           if (REPRAPWORLD_KEYPAD_MOVE_Y_DOWN)   reprapworld_keypad_move_y_down(); | ||||
|           if (REPRAPWORLD_KEYPAD_MOVE_Y_UP)     reprapworld_keypad_move_y_up(); | ||||
|         } | ||||
|         else { | ||||
|           if (REPRAPWORLD_KEYPAD_MOVE_HOME)     reprapworld_keypad_move_home(); | ||||
|         } | ||||
|       } | ||||
|     } | ||||
| 
 | ||||
|   #endif // REPRAPWORLD_KEYPAD
 | ||||
| 
 | ||||
|   /**
 | ||||
| @ -2773,36 +2908,8 @@ void lcd_update() { | ||||
|       #endif | ||||
| 
 | ||||
|       #if ENABLED(REPRAPWORLD_KEYPAD) | ||||
| 
 | ||||
|         static uint8_t keypad_debounce = 0; | ||||
| 
 | ||||
|         if (!REPRAPWORLD_KEYPAD_PRESSED) { | ||||
|           if (keypad_debounce > 0) keypad_debounce--; | ||||
|         } | ||||
|         else if (!keypad_debounce) { | ||||
|           keypad_debounce = 2; | ||||
| 
 | ||||
|           if (REPRAPWORLD_KEYPAD_MOVE_MENU)       reprapworld_keypad_move_menu(); | ||||
| 
 | ||||
|           #if DISABLED(DELTA) && Z_HOME_DIR == -1 | ||||
|             if (REPRAPWORLD_KEYPAD_MOVE_Z_UP)     reprapworld_keypad_move_z_up(); | ||||
|           #endif | ||||
| 
 | ||||
|           if (axis_homed[X_AXIS] && axis_homed[Y_AXIS] && axis_homed[Z_AXIS]) { | ||||
|             #if ENABLED(DELTA) || Z_HOME_DIR != -1 | ||||
|               if (REPRAPWORLD_KEYPAD_MOVE_Z_UP)   reprapworld_keypad_move_z_up(); | ||||
|             #endif | ||||
|             if (REPRAPWORLD_KEYPAD_MOVE_Z_DOWN)   reprapworld_keypad_move_z_down(); | ||||
|             if (REPRAPWORLD_KEYPAD_MOVE_X_LEFT)   reprapworld_keypad_move_x_left(); | ||||
|             if (REPRAPWORLD_KEYPAD_MOVE_X_RIGHT)  reprapworld_keypad_move_x_right(); | ||||
|             if (REPRAPWORLD_KEYPAD_MOVE_Y_DOWN)   reprapworld_keypad_move_y_down(); | ||||
|             if (REPRAPWORLD_KEYPAD_MOVE_Y_UP)     reprapworld_keypad_move_y_up(); | ||||
|           } | ||||
|           else { | ||||
|             if (REPRAPWORLD_KEYPAD_MOVE_HOME)     reprapworld_keypad_move_home(); | ||||
|           } | ||||
|         } | ||||
|       #endif // REPRAPWORLD_KEYPAD
 | ||||
|         handle_reprapworld_keypad(); | ||||
|       #endif | ||||
| 
 | ||||
|       bool encoderPastThreshold = (abs(encoderDiff) >= ENCODER_PULSES_PER_STEP); | ||||
|       if (encoderPastThreshold || lcd_clicked) { | ||||
|  | ||||
| @ -656,34 +656,30 @@ static void lcd_implementation_status_screen() { | ||||
|     u8g.setPrintPos((START_COL) * (DOG_CHAR_WIDTH), row_y2); | ||||
|   } | ||||
| 
 | ||||
|   #if ENABLED(LCD_INFO_MENU) || ENABLED(FILAMENT_CHANGE_FEATURE) | ||||
|   // Draw a static line of text in the same idiom as a menu item
 | ||||
|   static void lcd_implementation_drawmenu_static(const uint8_t row, const char* pstr, const bool center=true, const bool invert=false, const char* valstr=NULL) { | ||||
| 
 | ||||
|     // Draw a static line of text in the same idiom as a menu item
 | ||||
|     static void lcd_implementation_drawmenu_static(const uint8_t row, const char* pstr, const bool center=true, const bool invert=false, const char* valstr=NULL) { | ||||
|     lcd_implementation_mark_as_selected(row, invert); | ||||
| 
 | ||||
|       lcd_implementation_mark_as_selected(row, invert); | ||||
|     if (!PAGE_CONTAINS(row_y1, row_y2)) return; | ||||
| 
 | ||||
|       if (!PAGE_CONTAINS(row_y1, row_y2)) return; | ||||
|     char c; | ||||
|     int8_t n = LCD_WIDTH - (START_COL); | ||||
| 
 | ||||
|       char c; | ||||
|       int8_t n = LCD_WIDTH - (START_COL); | ||||
| 
 | ||||
|       if (center && !valstr) { | ||||
|         int8_t pad = (LCD_WIDTH - lcd_strlen_P(pstr)) / 2; | ||||
|         while (--pad >= 0) { u8g.print(' '); n--; } | ||||
|       } | ||||
|       while (n > 0 && (c = pgm_read_byte(pstr))) { | ||||
|         n -= lcd_print_and_count(c); | ||||
|         pstr++; | ||||
|       } | ||||
|       if (valstr) while (n > 0 && (c = *valstr)) { | ||||
|         n -= lcd_print_and_count(c); | ||||
|         valstr++; | ||||
|       } | ||||
|       while (n-- > 0) u8g.print(' '); | ||||
|     if (center && !valstr) { | ||||
|       int8_t pad = (LCD_WIDTH - lcd_strlen_P(pstr)) / 2; | ||||
|       while (--pad >= 0) { u8g.print(' '); n--; } | ||||
|     } | ||||
| 
 | ||||
|   #endif // LCD_INFO_MENU || FILAMENT_CHANGE_FEATURE
 | ||||
|     while (n > 0 && (c = pgm_read_byte(pstr))) { | ||||
|       n -= lcd_print_and_count(c); | ||||
|       pstr++; | ||||
|     } | ||||
|     if (valstr) while (n > 0 && (c = *valstr)) { | ||||
|       n -= lcd_print_and_count(c); | ||||
|       valstr++; | ||||
|     } | ||||
|     while (n-- > 0) u8g.print(' '); | ||||
|   } | ||||
| 
 | ||||
|   // Draw a generic menu item
 | ||||
|   static void lcd_implementation_drawmenu_generic(const bool isSelected, const uint8_t row, const char* pstr, const char pre_char, const char post_char) { | ||||
|  | ||||
| @ -792,29 +792,25 @@ static void lcd_implementation_status_screen() { | ||||
| 
 | ||||
| #if ENABLED(ULTIPANEL) | ||||
| 
 | ||||
|   #if ENABLED(LCD_INFO_MENU) || ENABLED(FILAMENT_CHANGE_FEATURE) | ||||
| 
 | ||||
|     static void lcd_implementation_drawmenu_static(const uint8_t row, const char* pstr, const bool center=true, const bool invert=false, const char *valstr=NULL) { | ||||
|       UNUSED(invert); | ||||
|       char c; | ||||
|       int8_t n = LCD_WIDTH; | ||||
|       lcd.setCursor(0, row); | ||||
|       if (center && !valstr) { | ||||
|         int8_t pad = (LCD_WIDTH - lcd_strlen_P(pstr)) / 2; | ||||
|         while (--pad >= 0) { lcd.print(' '); n--; } | ||||
|       } | ||||
|       while (n > 0 && (c = pgm_read_byte(pstr))) { | ||||
|         n -= charset_mapper(c); | ||||
|         pstr++; | ||||
|       } | ||||
|       if (valstr) while (n > 0 && (c = *valstr)) { | ||||
|         n -= charset_mapper(c); | ||||
|         valstr++; | ||||
|       } | ||||
|       while (n-- > 0) lcd.print(' '); | ||||
|   static void lcd_implementation_drawmenu_static(const uint8_t row, const char* pstr, const bool center=true, const bool invert=false, const char *valstr=NULL) { | ||||
|     UNUSED(invert); | ||||
|     char c; | ||||
|     int8_t n = LCD_WIDTH; | ||||
|     lcd.setCursor(0, row); | ||||
|     if (center && !valstr) { | ||||
|       int8_t pad = (LCD_WIDTH - lcd_strlen_P(pstr)) / 2; | ||||
|       while (--pad >= 0) { lcd.print(' '); n--; } | ||||
|     } | ||||
| 
 | ||||
|   #endif // LCD_INFO_MENU || FILAMENT_CHANGE_FEATURE
 | ||||
|     while (n > 0 && (c = pgm_read_byte(pstr))) { | ||||
|       n -= charset_mapper(c); | ||||
|       pstr++; | ||||
|     } | ||||
|     if (valstr) while (n > 0 && (c = *valstr)) { | ||||
|       n -= charset_mapper(c); | ||||
|       valstr++; | ||||
|     } | ||||
|     while (n-- > 0) lcd.print(' '); | ||||
|   } | ||||
| 
 | ||||
|   static void lcd_implementation_drawmenu_generic(const bool sel, const uint8_t row, const char* pstr, const char pre_char, const char post_char) { | ||||
|     char c; | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user