Reduce Reprapworld Keypad move code size

This commit is contained in:
Scott Lahteine 2016-06-04 01:09:59 -07:00
parent 5d5affdfca
commit 06ac1f3bcf

View file

@ -2310,42 +2310,24 @@ void kill_screen(const char* lcd_msg) {
*
*/
#if ENABLED(REPRAPWORLD_KEYPAD)
static void reprapworld_keypad_move_z_up() {
encoderPosition = 1;
static void _reprapworld_keypad_move(AxisEnum axis, int dir) {
move_menu_scale = REPRAPWORLD_KEYPAD_MOVE_STEP;
lcd_move_z();
}
static void reprapworld_keypad_move_z_down() {
encoderPosition = -1;
move_menu_scale = REPRAPWORLD_KEYPAD_MOVE_STEP;
lcd_move_z();
}
static void reprapworld_keypad_move_x_left() {
encoderPosition = -1;
move_menu_scale = REPRAPWORLD_KEYPAD_MOVE_STEP;
lcd_move_x();
}
static void reprapworld_keypad_move_x_right() {
encoderPosition = 1;
move_menu_scale = REPRAPWORLD_KEYPAD_MOVE_STEP;
lcd_move_x();
}
static void reprapworld_keypad_move_y_down() {
encoderPosition = 1;
move_menu_scale = REPRAPWORLD_KEYPAD_MOVE_STEP;
lcd_move_y();
}
static void reprapworld_keypad_move_y_up() {
encoderPosition = -1;
move_menu_scale = REPRAPWORLD_KEYPAD_MOVE_STEP;
lcd_move_y();
}
static void reprapworld_keypad_move_home() {
enqueue_and_echo_commands_P(PSTR("G28")); // move all axes home
encoderPosition = dir;
switch (axis) {
case X_AXIS: lcd_move_x(); break;
case Y_AXIS: lcd_move_y(); break;
case Z_AXIS: lcd_move_z();
}
}
static void reprapworld_keypad_move_z_up() { _reprapworld_keypad_move(Z_AXIS, 1); }
static void reprapworld_keypad_move_z_down() { _reprapworld_keypad_move(Z_AXIS, -1); }
static void reprapworld_keypad_move_x_left() { _reprapworld_keypad_move(X_AXIS, -1); }
static void reprapworld_keypad_move_x_right() { _reprapworld_keypad_move(X_AXIS, 1); }
static void reprapworld_keypad_move_y_up() { _reprapworld_keypad_move(Y_AXIS, -1); }
static void reprapworld_keypad_move_y_down() { _reprapworld_keypad_move(Y_AXIS, 1); }
static void reprapworld_keypad_move_home() { enqueue_and_echo_commands_P(PSTR("G28")); } // move all axes home and wait
#endif // REPRAPWORLD_KEYPAD
/**
*
* Audio feedback for controller clicks
@ -2657,7 +2639,7 @@ void lcd_update() {
return_to_status_ms = ms + LCD_TIMEOUT_TO_STATUS;
lcdDrawUpdate = LCDVIEW_REDRAW_NOW;
}
#endif //ULTIPANEL
#endif // ULTIPANEL
// We arrive here every ~100ms when idling often enough.
// Instead of tracking the changes simply redraw the Info Screen ~1 time a second.