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) #if ENABLED(REPRAPWORLD_KEYPAD)
static void reprapworld_keypad_move_z_up() { static void _reprapworld_keypad_move(AxisEnum axis, int dir) {
encoderPosition = 1;
move_menu_scale = REPRAPWORLD_KEYPAD_MOVE_STEP; move_menu_scale = REPRAPWORLD_KEYPAD_MOVE_STEP;
lcd_move_z(); 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_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
} }
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 #endif // REPRAPWORLD_KEYPAD
/** /**
* *
* Audio feedback for controller clicks * Audio feedback for controller clicks