Pārlūkot izejas kodu

Merge pull request #4264 from thinkyhead/rc_ultralcd_encoder_pos

Remove extraneous conditions for encoder position
Scott Lahteine 9 gadus atpakaļ
vecāks
revīzija
973a669aa3
1 mainītis faili ar 10 papildinājumiem un 15 dzēšanām
  1. 10
    15
      Marlin/ultralcd.cpp

+ 10
- 15
Marlin/ultralcd.cpp Parādīt failu

@@ -398,11 +398,8 @@ uint8_t lcdDrawUpdate = LCDVIEW_CLEAR_CALL_REDRAW; // Set when the LCD needs to
398 398
     if (currentScreen != screen) {
399 399
       currentScreen = screen;
400 400
       lcdDrawUpdate = LCDVIEW_CLEAR_CALL_REDRAW;
401
-      encoderTopLine = 0;
402
-      #if ENABLED(NEWPANEL)
403
-        encoderPosition = encoder;
404
-        if (feedback) lcd_quick_feedback();
405
-      #endif
401
+      encoderPosition = encoder;
402
+      if (feedback) lcd_quick_feedback();
406 403
       if (screen == lcd_status_screen) {
407 404
         defer_return_to_status = false;
408 405
         screen_history_depth = 0;
@@ -419,9 +416,7 @@ uint8_t lcdDrawUpdate = LCDVIEW_CLEAR_CALL_REDRAW; // Set when the LCD needs to
419 416
   inline void lcd_save_previous_menu() {
420 417
     if (screen_history_depth < COUNT(screen_history)) {
421 418
       screen_history[screen_history_depth].menu_function = currentScreen;
422
-      #if ENABLED(ULTIPANEL)
423
-        screen_history[screen_history_depth].encoder_position = encoderPosition;
424
-      #endif
419
+      screen_history[screen_history_depth].encoder_position = encoderPosition;
425 420
       ++screen_history_depth;
426 421
     }
427 422
   }
@@ -429,10 +424,10 @@ uint8_t lcdDrawUpdate = LCDVIEW_CLEAR_CALL_REDRAW; // Set when the LCD needs to
429 424
   static void lcd_goto_previous_menu(bool feedback=false) {
430 425
     if (screen_history_depth > 0) {
431 426
       --screen_history_depth;
432
-      lcd_goto_screen(screen_history[screen_history_depth].menu_function, feedback
433
-        #if ENABLED(ULTIPANEL)
434
-          , screen_history[screen_history_depth].encoder_position
435
-        #endif
427
+      lcd_goto_screen(
428
+        screen_history[screen_history_depth].menu_function,
429
+        feedback,
430
+        screen_history[screen_history_depth].encoder_position
436 431
       );
437 432
     }
438 433
     else
@@ -2444,7 +2439,7 @@ void lcd_init() {
2444 2439
       SET_INPUT(BTN_RT);
2445 2440
     #endif
2446 2441
 
2447
-  #else  // Not NEWPANEL
2442
+  #else // !NEWPANEL
2448 2443
 
2449 2444
     #if ENABLED(SR_LCD_2W_NL) // Non latching 2 wire shift register
2450 2445
       pinMode(SR_DATA_PIN, OUTPUT);
@@ -2459,7 +2454,7 @@ void lcd_init() {
2459 2454
       WRITE(SHIFT_EN, LOW);
2460 2455
     #endif // SR_LCD_2W_NL
2461 2456
 
2462
-  #endif//!NEWPANEL
2457
+  #endif // !NEWPANEL
2463 2458
 
2464 2459
   #if ENABLED(SDSUPPORT) && PIN_EXISTS(SD_DETECT)
2465 2460
     SET_INPUT(SD_DETECT_PIN);
@@ -2875,6 +2870,7 @@ void lcd_reset_alert_level() { lcd_status_message_level = 0; }
2875 2870
       GET_BUTTON_STATES(buttons);
2876 2871
     #endif //!NEWPANEL
2877 2872
 
2873
+    // Manage encoder rotation
2878 2874
     #if ENABLED(REVERSE_MENU_DIRECTION) && ENABLED(REVERSE_ENCODER_DIRECTION)
2879 2875
       #define ENCODER_DIFF_CW  (encoderDiff -= encoderDirection)
2880 2876
       #define ENCODER_DIFF_CCW (encoderDiff += encoderDirection)
@@ -2890,7 +2886,6 @@ void lcd_reset_alert_level() { lcd_status_message_level = 0; }
2890 2886
     #endif
2891 2887
     #define ENCODER_SPIN(_E1, _E2) switch (lastEncoderBits) { case _E1: ENCODER_DIFF_CW; break; case _E2: ENCODER_DIFF_CCW; }
2892 2888
 
2893
-    //manage encoder rotation
2894 2889
     uint8_t enc = 0;
2895 2890
     if (buttons & EN_A) enc |= B01;
2896 2891
     if (buttons & EN_B) enc |= B10;

Notiek ielāde…
Atcelt
Saglabāt