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() {
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
@ -2657,7 +2639,7 @@ void lcd_update() {
return_to_status_ms = ms + LCD_TIMEOUT_TO_STATUS; return_to_status_ms = ms + LCD_TIMEOUT_TO_STATUS;
lcdDrawUpdate = LCDVIEW_REDRAW_NOW; lcdDrawUpdate = LCDVIEW_REDRAW_NOW;
} }
#endif //ULTIPANEL #endif // ULTIPANEL
// We arrive here every ~100ms when idling often enough. // We arrive here every ~100ms when idling often enough.
// Instead of tracking the changes simply redraw the Info Screen ~1 time a second. // Instead of tracking the changes simply redraw the Info Screen ~1 time a second.

Loading…
Cancel
Save