Reduce Reprapworld Keypad move code size

master
Scott Lahteine 9 years ago
parent 5d5affdfca
commit 06ac1f3bcf

@ -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) {
static void reprapworld_keypad_move_z_down() { case X_AXIS: lcd_move_x(); break;
encoderPosition = -1; case Y_AXIS: lcd_move_y(); break;
move_menu_scale = REPRAPWORLD_KEYPAD_MOVE_STEP; case Z_AXIS: lcd_move_z();
lcd_move_z(); }
} }
static void reprapworld_keypad_move_x_left() { static void reprapworld_keypad_move_z_up() { _reprapworld_keypad_move(Z_AXIS, 1); }
encoderPosition = -1; static void reprapworld_keypad_move_z_down() { _reprapworld_keypad_move(Z_AXIS, -1); }
move_menu_scale = REPRAPWORLD_KEYPAD_MOVE_STEP; static void reprapworld_keypad_move_x_left() { _reprapworld_keypad_move(X_AXIS, -1); }
lcd_move_x(); 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_x_right() { static void reprapworld_keypad_move_y_down() { _reprapworld_keypad_move(Y_AXIS, 1); }
encoderPosition = 1; static void reprapworld_keypad_move_home() { enqueue_and_echo_commands_P(PSTR("G28")); } // move all axes home and wait
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
}
#endif // REPRAPWORLD_KEYPAD #endif // REPRAPWORLD_KEYPAD
/** /**
* *
* Audio feedback for controller clicks * Audio feedback for controller clicks

Loading…
Cancel
Save