Remove extraneous conditions for encoder position

This commit is contained in:
Scott Lahteine 2016-07-10 17:28:58 -07:00
parent 0554b65d22
commit e9f62d8fdb

View file

@ -398,11 +398,8 @@ uint8_t lcdDrawUpdate = LCDVIEW_CLEAR_CALL_REDRAW; // Set when the LCD needs to
if (currentScreen != screen) { if (currentScreen != screen) {
currentScreen = screen; currentScreen = screen;
lcdDrawUpdate = LCDVIEW_CLEAR_CALL_REDRAW; lcdDrawUpdate = LCDVIEW_CLEAR_CALL_REDRAW;
encoderTopLine = 0;
#if ENABLED(NEWPANEL)
encoderPosition = encoder; encoderPosition = encoder;
if (feedback) lcd_quick_feedback(); if (feedback) lcd_quick_feedback();
#endif
if (screen == lcd_status_screen) { if (screen == lcd_status_screen) {
defer_return_to_status = false; defer_return_to_status = false;
screen_history_depth = 0; screen_history_depth = 0;
@ -419,9 +416,7 @@ uint8_t lcdDrawUpdate = LCDVIEW_CLEAR_CALL_REDRAW; // Set when the LCD needs to
inline void lcd_save_previous_menu() { inline void lcd_save_previous_menu() {
if (screen_history_depth < COUNT(screen_history)) { if (screen_history_depth < COUNT(screen_history)) {
screen_history[screen_history_depth].menu_function = currentScreen; screen_history[screen_history_depth].menu_function = currentScreen;
#if ENABLED(ULTIPANEL)
screen_history[screen_history_depth].encoder_position = encoderPosition; screen_history[screen_history_depth].encoder_position = encoderPosition;
#endif
++screen_history_depth; ++screen_history_depth;
} }
} }
@ -429,10 +424,10 @@ uint8_t lcdDrawUpdate = LCDVIEW_CLEAR_CALL_REDRAW; // Set when the LCD needs to
static void lcd_goto_previous_menu(bool feedback=false) { static void lcd_goto_previous_menu(bool feedback=false) {
if (screen_history_depth > 0) { if (screen_history_depth > 0) {
--screen_history_depth; --screen_history_depth;
lcd_goto_screen(screen_history[screen_history_depth].menu_function, feedback lcd_goto_screen(
#if ENABLED(ULTIPANEL) screen_history[screen_history_depth].menu_function,
, screen_history[screen_history_depth].encoder_position feedback,
#endif screen_history[screen_history_depth].encoder_position
); );
} }
else else
@ -2444,7 +2439,7 @@ void lcd_init() {
SET_INPUT(BTN_RT); SET_INPUT(BTN_RT);
#endif #endif
#else // Not NEWPANEL #else // !NEWPANEL
#if ENABLED(SR_LCD_2W_NL) // Non latching 2 wire shift register #if ENABLED(SR_LCD_2W_NL) // Non latching 2 wire shift register
pinMode(SR_DATA_PIN, OUTPUT); pinMode(SR_DATA_PIN, OUTPUT);
@ -2875,6 +2870,7 @@ void lcd_reset_alert_level() { lcd_status_message_level = 0; }
GET_BUTTON_STATES(buttons); GET_BUTTON_STATES(buttons);
#endif //!NEWPANEL #endif //!NEWPANEL
// Manage encoder rotation
#if ENABLED(REVERSE_MENU_DIRECTION) && ENABLED(REVERSE_ENCODER_DIRECTION) #if ENABLED(REVERSE_MENU_DIRECTION) && ENABLED(REVERSE_ENCODER_DIRECTION)
#define ENCODER_DIFF_CW (encoderDiff -= encoderDirection) #define ENCODER_DIFF_CW (encoderDiff -= encoderDirection)
#define ENCODER_DIFF_CCW (encoderDiff += encoderDirection) #define ENCODER_DIFF_CCW (encoderDiff += encoderDirection)
@ -2890,7 +2886,6 @@ void lcd_reset_alert_level() { lcd_status_message_level = 0; }
#endif #endif
#define ENCODER_SPIN(_E1, _E2) switch (lastEncoderBits) { case _E1: ENCODER_DIFF_CW; break; case _E2: ENCODER_DIFF_CCW; } #define ENCODER_SPIN(_E1, _E2) switch (lastEncoderBits) { case _E1: ENCODER_DIFF_CW; break; case _E2: ENCODER_DIFF_CCW; }
//manage encoder rotation
uint8_t enc = 0; uint8_t enc = 0;
if (buttons & EN_A) enc |= B01; if (buttons & EN_A) enc |= B01;
if (buttons & EN_B) enc |= B10; if (buttons & EN_B) enc |= B10;