瀏覽代碼

More comprehensive NO_LCD_MENUS (#12367)

Scott Lahteine 6 年之前
父節點
當前提交
4ed6397e5d
No account linked to committer's email address

+ 1
- 7
Marlin/src/inc/Conditionals_LCD.h 查看文件

296
   #define ULTIPANEL
296
   #define ULTIPANEL
297
 #endif
297
 #endif
298
 
298
 
299
-#if ENABLED(NO_LCD_MENUS)
300
-  #undef ULTIPANEL
301
-#endif
302
-
303
 #define HAS_GRAPHICAL_LCD ENABLED(DOGLCD)
299
 #define HAS_GRAPHICAL_LCD ENABLED(DOGLCD)
304
 
300
 
305
 #if HAS_GRAPHICAL_LCD
301
 #if HAS_GRAPHICAL_LCD
336
 // Aliases for LCD features
332
 // Aliases for LCD features
337
 #define HAS_SPI_LCD          ENABLED(ULTRA_LCD)
333
 #define HAS_SPI_LCD          ENABLED(ULTRA_LCD)
338
 #define HAS_CHARACTER_LCD   (ENABLED(ULTRA_LCD) && DISABLED(DOGLCD))
334
 #define HAS_CHARACTER_LCD   (ENABLED(ULTRA_LCD) && DISABLED(DOGLCD))
339
-#define HAS_DIGITAL_ENCODER (HAS_SPI_LCD && ENABLED(NEWPANEL))
340
-#define HAS_LCD_MENU         ENABLED(ULTIPANEL)
341
-#define HAS_DEBUG_MENU      (HAS_LCD_MENU && ENABLED(LCD_PROGRESS_BAR_TEST))
335
+#define HAS_LCD_MENU        (ENABLED(ULTIPANEL) && DISABLED(NO_LCD_MENUS))
342
 
336
 
343
 #if HAS_GRAPHICAL_LCD
337
 #if HAS_GRAPHICAL_LCD
344
   /* Custom characters defined in font Marlin_symbols.fon which was merged to ISO10646-0-3.bdf */
338
   /* Custom characters defined in font Marlin_symbols.fon which was merged to ISO10646-0-3.bdf */

+ 27
- 24
Marlin/src/lcd/HD44780/ultralcd_impl_HD44780.cpp 查看文件

27
 /**
27
 /**
28
  * ultralcd_impl_HD44780.cpp
28
  * ultralcd_impl_HD44780.cpp
29
  *
29
  *
30
- * Implementation of the LCD display routines for a Hitachi HD44780 display.
30
+ * LCD display implementations for Hitachi HD44780.
31
  * These are the most common LCD character displays.
31
  * These are the most common LCD character displays.
32
  */
32
  */
33
 
33
 
44
   #include "../../feature/bedlevel/ubl/ubl.h"
44
   #include "../../feature/bedlevel/ubl/ubl.h"
45
 #endif
45
 #endif
46
 
46
 
47
-////////////////////////////////////
48
-// Create LCD class instance and chipset-specific information
47
+//
48
+// Create LCD instance and chipset-specific information
49
+//
50
+
49
 #if ENABLED(LCD_I2C_TYPE_PCF8575)
51
 #if ENABLED(LCD_I2C_TYPE_PCF8575)
52
+
50
   LCD_CLASS lcd(LCD_I2C_ADDRESS, LCD_I2C_PIN_EN, LCD_I2C_PIN_RW, LCD_I2C_PIN_RS, LCD_I2C_PIN_D4, LCD_I2C_PIN_D5, LCD_I2C_PIN_D6, LCD_I2C_PIN_D7);
53
   LCD_CLASS lcd(LCD_I2C_ADDRESS, LCD_I2C_PIN_EN, LCD_I2C_PIN_RW, LCD_I2C_PIN_RS, LCD_I2C_PIN_D4, LCD_I2C_PIN_D5, LCD_I2C_PIN_D6, LCD_I2C_PIN_D7);
51
 
54
 
52
-#elif ENABLED(LCD_I2C_TYPE_MCP23017)
53
-  #if ENABLED(DETECT_DEVICE)
54
-    LCD_CLASS lcd(LCD_I2C_ADDRESS, 1);
55
-  #else
56
-    LCD_CLASS lcd(LCD_I2C_ADDRESS);
57
-  #endif
55
+#elif ENABLED(LCD_I2C_TYPE_MCP23017) || ENABLED(LCD_I2C_TYPE_MCP23008)
58
 
56
 
59
-#elif ENABLED(LCD_I2C_TYPE_MCP23008)
60
-  #if ENABLED(DETECT_DEVICE)
61
-    LCD_CLASS lcd(LCD_I2C_ADDRESS, 1);
62
-  #else
63
-    LCD_CLASS lcd(LCD_I2C_ADDRESS);
64
-  #endif
57
+  LCD_CLASS lcd(LCD_I2C_ADDRESS
58
+    #ifdef DETECT_DEVICE
59
+      , 1
60
+    #endif
61
+  );
65
 
62
 
66
 #elif ENABLED(LCD_I2C_TYPE_PCA8574)
63
 #elif ENABLED(LCD_I2C_TYPE_PCA8574)
64
+
67
   LCD_CLASS lcd(LCD_I2C_ADDRESS, LCD_WIDTH, LCD_HEIGHT);
65
   LCD_CLASS lcd(LCD_I2C_ADDRESS, LCD_WIDTH, LCD_HEIGHT);
68
 
66
 
69
-// 2 wire Non-latching LCD SR from:
70
-// https://bitbucket.org/fmalpartida/new-liquidcrystal/wiki/schematics#!shiftregister-connection
71
 #elif ENABLED(SR_LCD_2W_NL)
67
 #elif ENABLED(SR_LCD_2W_NL)
72
-  #if PIN_EXISTS(SR_STROBE)
73
-    LCD_CLASS lcd(SR_DATA_PIN, SR_CLK_PIN, SR_STROBE_PIN);
74
-  #else
75
-    LCD_CLASS lcd(SR_DATA_PIN, SR_CLK_PIN);
76
-  #endif
68
+
69
+  // 2 wire Non-latching LCD SR from:
70
+  // https://bitbucket.org/fmalpartida/new-liquidcrystal/wiki/schematics#!shiftregister-connection
71
+
72
+  LCD_CLASS lcd(SR_DATA_PIN, SR_CLK_PIN
73
+    #if PIN_EXISTS(SR_STROBE)
74
+      , SR_STROBE_PIN
75
+    #endif
76
+  );
77
 
77
 
78
 #elif ENABLED(LCM1602)
78
 #elif ENABLED(LCM1602)
79
+
79
   LCD_CLASS lcd(0x27, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE);
80
   LCD_CLASS lcd(0x27, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE);
80
 
81
 
81
 #else
82
 #else
82
-  // Standard directly connected LCD implementations
83
-  LCD_CLASS lcd(LCD_PINS_RS, LCD_PINS_ENABLE, LCD_PINS_D4, LCD_PINS_D5, LCD_PINS_D6, LCD_PINS_D7); //RS,Enable,D4,D5,D6,D7
83
+
84
+  // Standard direct-connected LCD implementations
85
+  LCD_CLASS lcd(LCD_PINS_RS, LCD_PINS_ENABLE, LCD_PINS_D4, LCD_PINS_D5, LCD_PINS_D6, LCD_PINS_D7);
86
+
84
 #endif
87
 #endif
85
 
88
 
86
 #if ENABLED(LCD_HAS_STATUS_INDICATORS)
89
 #if ENABLED(LCD_HAS_STATUS_INDICATORS)

+ 2
- 4
Marlin/src/lcd/menu/menu.h 查看文件

24
 #include "../ultralcd.h"
24
 #include "../ultralcd.h"
25
 #include "../../inc/MarlinConfig.h"
25
 #include "../../inc/MarlinConfig.h"
26
 
26
 
27
-extern uint32_t encoderPosition;
28
 extern int8_t encoderLine, encoderTopLine, screen_items;
27
 extern int8_t encoderLine, encoderTopLine, screen_items;
29
-extern millis_t lastEncoderMovementMillis;
30
 extern bool screen_changed;
28
 extern bool screen_changed;
31
 
29
 
32
 constexpr int16_t heater_maxtemp[HOTENDS] = ARRAY_BY_HOTENDS(HEATER_0_MAXTEMP, HEATER_1_MAXTEMP, HEATER_2_MAXTEMP, HEATER_3_MAXTEMP, HEATER_4_MAXTEMP);
30
 constexpr int16_t heater_maxtemp[HOTENDS] = ARRAY_BY_HOTENDS(HEATER_0_MAXTEMP, HEATER_1_MAXTEMP, HEATER_2_MAXTEMP, HEATER_3_MAXTEMP, HEATER_4_MAXTEMP);
279
 #endif
277
 #endif
280
 
278
 
281
 #if ENABLED(ENCODER_RATE_MULTIPLIER)
279
 #if ENABLED(ENCODER_RATE_MULTIPLIER)
282
-
280
+  extern millis_t lastEncoderMovementMillis;
283
   extern bool encoderRateMultiplierEnabled;
281
   extern bool encoderRateMultiplierEnabled;
284
   #define ENCODER_RATE_MULTIPLY(F) (encoderRateMultiplierEnabled = F)
282
   #define ENCODER_RATE_MULTIPLY(F) (encoderRateMultiplierEnabled = F)
285
-  #define _MENU_ITEM_MULTIPLIER_CHECK(USE_MULTIPLIER) if(USE_MULTIPLIER) {encoderRateMultiplierEnabled = true; lastEncoderMovementMillis = 0;}
283
+  #define _MENU_ITEM_MULTIPLIER_CHECK(USE_MULTIPLIER) if (USE_MULTIPLIER) { encoderRateMultiplierEnabled = true; lastEncoderMovementMillis = 0; }
286
   //#define ENCODER_RATE_MULTIPLIER_DEBUG  // If defined, output the encoder steps per second value
284
   //#define ENCODER_RATE_MULTIPLIER_DEBUG  // If defined, output the encoder steps per second value
287
 #else // !ENCODER_RATE_MULTIPLIER
285
 #else // !ENCODER_RATE_MULTIPLIER
288
   #define ENCODER_RATE_MULTIPLY(F) NOOP
286
   #define ENCODER_RATE_MULTIPLY(F) NOOP

+ 2
- 0
Marlin/src/lcd/menu/menu_configuration.cpp 查看文件

36
   #include "../../feature/runout.h"
36
   #include "../../feature/runout.h"
37
 #endif
37
 #endif
38
 
38
 
39
+#define HAS_DEBUG_MENU ENABLED(LCD_PROGRESS_BAR_TEST)
40
+
39
 void menu_advanced_settings();
41
 void menu_advanced_settings();
40
 void menu_delta_calibrate();
42
 void menu_delta_calibrate();
41
 
43
 

+ 118
- 79
Marlin/src/lcd/ultralcd.cpp 查看文件

114
   bool drawing_screen, first_page; // = false
114
   bool drawing_screen, first_page; // = false
115
 #endif
115
 #endif
116
 
116
 
117
-#if ENABLED(ENCODER_RATE_MULTIPLIER)
118
-  bool encoderRateMultiplierEnabled;
119
-#endif
120
-
121
-#if ENABLED(REVERSE_MENU_DIRECTION)
122
-  int8_t encoderDirection = 1;
117
+// Encoder Handling
118
+#if HAS_ENCODER_ACTION
119
+  uint32_t encoderPosition;
120
+  volatile int8_t encoderDiff; // Updated in lcd_buttons_update, added to encoderPosition every LCD update
121
+  #if ENABLED(ENCODER_RATE_MULTIPLIER)
122
+    bool encoderRateMultiplierEnabled;
123
+  #endif
124
+  #if ENABLED(REVERSE_MENU_DIRECTION)
125
+    int8_t encoderDirection = 1;
126
+  #endif
123
 #endif
127
 #endif
124
 
128
 
125
 #if HAS_LCD_MENU
129
 #if HAS_LCD_MENU
127
 
131
 
128
   screenFunc_t currentScreen = lcd_status_screen;
132
   screenFunc_t currentScreen = lcd_status_screen;
129
 
133
 
130
-  // Encoder Handling
131
-  volatile int8_t encoderDiff; // Updated in lcd_buttons_update, added to encoderPosition every LCD update
132
-  uint32_t encoderPosition;
133
-  millis_t lastEncoderMovementMillis = 0;
134
+  #if ENABLED(ENCODER_RATE_MULTIPLIER)
135
+    millis_t lastEncoderMovementMillis = 0;
136
+  #endif
137
+
134
   bool lcd_clicked, wait_for_unclick;
138
   bool lcd_clicked, wait_for_unclick;
135
   float move_menu_scale;
139
   float move_menu_scale;
136
 
140
 
139
     lcd_clicked = false;
143
     lcd_clicked = false;
140
     return click;
144
     return click;
141
   }
145
   }
146
+
147
+#else
148
+
149
+  constexpr bool lcd_clicked = false;
150
+
142
 #endif
151
 #endif
143
 
152
 
144
 void lcd_init() {
153
 void lcd_init() {
200
 
209
 
201
   lcd_buttons_update();
210
   lcd_buttons_update();
202
 
211
 
203
-  #if HAS_LCD_MENU
212
+  #if HAS_ENCODER_ACTION
204
     encoderDiff = 0;
213
     encoderDiff = 0;
205
   #endif
214
   #endif
206
 }
215
 }
229
   inline bool handle_adc_keypad() {
238
   inline bool handle_adc_keypad() {
230
     #define ADC_MIN_KEY_DELAY 100
239
     #define ADC_MIN_KEY_DELAY 100
231
     if (buttons_reprapworld_keypad) {
240
     if (buttons_reprapworld_keypad) {
232
-      lcdDrawUpdate = LCDVIEW_REDRAW_NOW;
233
-      if (encoderDirection == -1) { // side effect which signals we are inside a menu
234
-        if      (RRK(EN_REPRAPWORLD_KEYPAD_DOWN))   encoderPosition -= ENCODER_STEPS_PER_MENU_ITEM;
235
-        else if (RRK(EN_REPRAPWORLD_KEYPAD_UP))     encoderPosition += ENCODER_STEPS_PER_MENU_ITEM;
236
-        else if (RRK(EN_REPRAPWORLD_KEYPAD_LEFT))   { menu_action_back();     lcd_quick_feedback(true); }
237
-        else if (RRK(EN_REPRAPWORLD_KEYPAD_RIGHT))  { lcd_return_to_status(); lcd_quick_feedback(true); }
238
-      }
239
-      else if (RRK(EN_REPRAPWORLD_KEYPAD_DOWN))     encoderPosition += ENCODER_PULSES_PER_STEP;
240
-      else if (RRK(EN_REPRAPWORLD_KEYPAD_UP))       encoderPosition -= ENCODER_PULSES_PER_STEP;
241
-      else if (RRK(EN_REPRAPWORLD_KEYPAD_RIGHT))    encoderPosition = 0;
242
-
241
+      #if HAS_ENCODER_ACTION
242
+        lcdDrawUpdate = LCDVIEW_REDRAW_NOW;
243
+        if (encoderDirection == -1) { // side effect which signals we are inside a menu
244
+          #if HAS_LCD_MENU
245
+            if      (RRK(EN_REPRAPWORLD_KEYPAD_DOWN))   encoderPosition -= ENCODER_STEPS_PER_MENU_ITEM;
246
+            else if (RRK(EN_REPRAPWORLD_KEYPAD_UP))     encoderPosition += ENCODER_STEPS_PER_MENU_ITEM;
247
+            else if (RRK(EN_REPRAPWORLD_KEYPAD_LEFT))   { menu_item_back::action(); lcd_quick_feedback(true); }
248
+            else if (RRK(EN_REPRAPWORLD_KEYPAD_RIGHT))  { lcd_return_to_status(); lcd_quick_feedback(true); }
249
+          #endif
250
+        }
251
+        else if (RRK(EN_REPRAPWORLD_KEYPAD_DOWN))     encoderPosition += ENCODER_PULSES_PER_STEP;
252
+        else if (RRK(EN_REPRAPWORLD_KEYPAD_UP))       encoderPosition -= ENCODER_PULSES_PER_STEP;
253
+        else if (RRK(EN_REPRAPWORLD_KEYPAD_RIGHT))    encoderPosition = 0;
254
+      #endif
243
       next_button_update_ms = millis() + ADC_MIN_KEY_DELAY;
255
       next_button_update_ms = millis() + ADC_MIN_KEY_DELAY;
244
       return true;
256
       return true;
245
     }
257
     }
249
 
261
 
250
 #elif ENABLED(REPRAPWORLD_KEYPAD)
262
 #elif ENABLED(REPRAPWORLD_KEYPAD)
251
 
263
 
252
-  void lcd_move_x();
253
-  void lcd_move_y();
254
-  void lcd_move_z();
255
-
256
-  void _reprapworld_keypad_move(const AxisEnum axis, const int16_t dir) {
257
-    move_menu_scale = REPRAPWORLD_KEYPAD_MOVE_STEP;
258
-    encoderPosition = dir;
259
-    switch (axis) {
260
-      case X_AXIS: lcd_move_x(); break;
261
-      case Y_AXIS: lcd_move_y(); break;
262
-      case Z_AXIS: lcd_move_z();
263
-      default: break;
264
+  #if HAS_LCD_MENU
265
+
266
+    void lcd_move_x();
267
+    void lcd_move_y();
268
+    void lcd_move_z();
269
+
270
+    void _reprapworld_keypad_move(const AxisEnum axis, const int16_t dir) {
271
+      move_menu_scale = REPRAPWORLD_KEYPAD_MOVE_STEP;
272
+      encoderPosition = dir;
273
+      switch (axis) {
274
+        case X_AXIS: lcd_move_x(); break;
275
+        case Y_AXIS: lcd_move_y(); break;
276
+        case Z_AXIS: lcd_move_z();
277
+        default: break;
278
+      }
264
     }
279
     }
265
-  }
280
+
281
+  #endif
266
 
282
 
267
   inline void handle_reprapworld_keypad() {
283
   inline void handle_reprapworld_keypad() {
268
 
284
 
278
     else if (!keypad_debounce) {
294
     else if (!keypad_debounce) {
279
       keypad_debounce = 2;
295
       keypad_debounce = 2;
280
 
296
 
281
-      if (RRK(EN_REPRAPWORLD_KEYPAD_MIDDLE))  lcd_goto_screen(menu_move);
297
+      const bool homed = all_axes_homed();
282
 
298
 
283
-      #if DISABLED(DELTA) && Z_HOME_DIR == -1
284
-        if (RRK(EN_REPRAPWORLD_KEYPAD_F2))    _reprapworld_keypad_move(Z_AXIS,  1);
285
-      #endif
299
+      #if HAS_LCD_MENU
286
 
300
 
287
-      if (all_axes_homed()) {
288
-        #if ENABLED(DELTA) || Z_HOME_DIR != -1
289
-          if (RRK(EN_REPRAPWORLD_KEYPAD_F2))  _reprapworld_keypad_move(Z_AXIS,  1);
301
+        if (RRK(EN_REPRAPWORLD_KEYPAD_MIDDLE))  lcd_goto_screen(menu_move);
302
+
303
+        #if DISABLED(DELTA) && Z_HOME_DIR == -1
304
+          if (RRK(EN_REPRAPWORLD_KEYPAD_F2))    _reprapworld_keypad_move(Z_AXIS,  1);
290
         #endif
305
         #endif
291
-        if (RRK(EN_REPRAPWORLD_KEYPAD_F3))    _reprapworld_keypad_move(Z_AXIS, -1);
292
-        if (RRK(EN_REPRAPWORLD_KEYPAD_LEFT))  _reprapworld_keypad_move(X_AXIS, -1);
293
-        if (RRK(EN_REPRAPWORLD_KEYPAD_RIGHT)) _reprapworld_keypad_move(X_AXIS,  1);
294
-        if (RRK(EN_REPRAPWORLD_KEYPAD_DOWN))  _reprapworld_keypad_move(Y_AXIS,  1);
295
-        if (RRK(EN_REPRAPWORLD_KEYPAD_UP))    _reprapworld_keypad_move(Y_AXIS, -1);
296
-      }
297
-      else if (RRK(EN_REPRAPWORLD_KEYPAD_F1)) enqueue_and_echo_commands_P(PSTR("G28"));
306
+
307
+        if (homed) {
308
+          #if ENABLED(DELTA) || Z_HOME_DIR != -1
309
+            if (RRK(EN_REPRAPWORLD_KEYPAD_F2))  _reprapworld_keypad_move(Z_AXIS,  1);
310
+          #endif
311
+          if (RRK(EN_REPRAPWORLD_KEYPAD_F3))    _reprapworld_keypad_move(Z_AXIS, -1);
312
+          if (RRK(EN_REPRAPWORLD_KEYPAD_LEFT))  _reprapworld_keypad_move(X_AXIS, -1);
313
+          if (RRK(EN_REPRAPWORLD_KEYPAD_RIGHT)) _reprapworld_keypad_move(X_AXIS,  1);
314
+          if (RRK(EN_REPRAPWORLD_KEYPAD_DOWN))  _reprapworld_keypad_move(Y_AXIS,  1);
315
+          if (RRK(EN_REPRAPWORLD_KEYPAD_UP))    _reprapworld_keypad_move(Y_AXIS, -1);
316
+        }
317
+
318
+      #endif // HAS_LCD_MENU
319
+
320
+      if (!homed && RRK(EN_REPRAPWORLD_KEYPAD_F1)) enqueue_and_echo_commands_P(PSTR("G28"));
298
     }
321
     }
299
   }
322
   }
300
 
323
 
387
       return;
410
       return;
388
     }
411
     }
389
 
412
 
390
-    #if ENABLED(ULTIPANEL_FEEDMULTIPLY)
391
-      const int16_t new_frm = feedrate_percentage + (int32_t)encoderPosition;
392
-      // Dead zone at 100% feedrate
393
-      if ((feedrate_percentage < 100 && new_frm > 100) || (feedrate_percentage > 100 && new_frm < 100)) {
394
-        feedrate_percentage = 100;
413
+  #endif // HAS_LCD_MENU
414
+
415
+  #if ENABLED(ULTIPANEL_FEEDMULTIPLY)
416
+
417
+    const int16_t new_frm = feedrate_percentage + (int32_t)encoderPosition;
418
+    // Dead zone at 100% feedrate
419
+    if ((feedrate_percentage < 100 && new_frm > 100) || (feedrate_percentage > 100 && new_frm < 100)) {
420
+      feedrate_percentage = 100;
421
+      encoderPosition = 0;
422
+    }
423
+    else if (feedrate_percentage == 100) {
424
+      if ((int32_t)encoderPosition > ENCODER_FEEDRATE_DEADZONE) {
425
+        feedrate_percentage += (int32_t)encoderPosition - (ENCODER_FEEDRATE_DEADZONE);
395
         encoderPosition = 0;
426
         encoderPosition = 0;
396
       }
427
       }
397
-      else if (feedrate_percentage == 100) {
398
-        if ((int32_t)encoderPosition > ENCODER_FEEDRATE_DEADZONE) {
399
-          feedrate_percentage += (int32_t)encoderPosition - (ENCODER_FEEDRATE_DEADZONE);
400
-          encoderPosition = 0;
401
-        }
402
-        else if ((int32_t)encoderPosition < -(ENCODER_FEEDRATE_DEADZONE)) {
403
-          feedrate_percentage += (int32_t)encoderPosition + ENCODER_FEEDRATE_DEADZONE;
404
-          encoderPosition = 0;
405
-        }
406
-      }
407
-      else {
408
-        feedrate_percentage = new_frm;
428
+      else if ((int32_t)encoderPosition < -(ENCODER_FEEDRATE_DEADZONE)) {
429
+        feedrate_percentage += (int32_t)encoderPosition + ENCODER_FEEDRATE_DEADZONE;
409
         encoderPosition = 0;
430
         encoderPosition = 0;
410
       }
431
       }
411
-    #endif // ULTIPANEL_FEEDMULTIPLY
432
+    }
433
+    else {
434
+      feedrate_percentage = new_frm;
435
+      encoderPosition = 0;
436
+    }
412
 
437
 
413
     feedrate_percentage = constrain(feedrate_percentage, 10, 999);
438
     feedrate_percentage = constrain(feedrate_percentage, 10, 999);
414
 
439
 
415
-  #endif // HAS_LCD_MENU
440
+  #endif // ULTIPANEL_FEEDMULTIPLY
416
 
441
 
417
   #if LCD_INFO_SCREEN_STYLE == 0
442
   #if LCD_INFO_SCREEN_STYLE == 0
418
     lcd_impl_status_screen_0();
443
     lcd_impl_status_screen_0();
594
   volatile uint8_t slow_buttons;
619
   volatile uint8_t slow_buttons;
595
 #endif
620
 #endif
596
 
621
 
622
+bool lcd_detected() {
623
+  return
624
+    #if (ENABLED(LCD_I2C_TYPE_MCP23017) || ENABLED(LCD_I2C_TYPE_MCP23008)) && defined(DETECT_DEVICE)
625
+      lcd.LcdDetected() == 1
626
+    #else
627
+      true
628
+    #endif
629
+  ;
630
+}
631
+
597
 void lcd_update() {
632
 void lcd_update() {
598
 
633
 
599
   static uint16_t max_display_update_time = 0;
634
   static uint16_t max_display_update_time = 0;
693
         slow_buttons = lcd_implementation_read_slow_buttons(); // buttons which take too long to read in interrupt context
728
         slow_buttons = lcd_implementation_read_slow_buttons(); // buttons which take too long to read in interrupt context
694
       #endif
729
       #endif
695
 
730
 
731
+    #endif // HAS_LCD_MENU
732
+
733
+    #if HAS_ENCODER_ACTION
734
+
696
       #if ENABLED(ADC_KEYPAD)
735
       #if ENABLED(ADC_KEYPAD)
697
 
736
 
698
         if (handle_adc_keypad()) {
737
         if (handle_adc_keypad()) {
699
-          #if LCD_TIMEOUT_TO_STATUS
738
+          #if HAS_LCD_MENU && LCD_TIMEOUT_TO_STATUS
700
             return_to_status_ms = ms + LCD_TIMEOUT_TO_STATUS;
739
             return_to_status_ms = ms + LCD_TIMEOUT_TO_STATUS;
701
           #endif
740
           #endif
702
         }
741
         }
710
       const bool encoderPastThreshold = (ABS(encoderDiff) >= ENCODER_PULSES_PER_STEP);
749
       const bool encoderPastThreshold = (ABS(encoderDiff) >= ENCODER_PULSES_PER_STEP);
711
       if (encoderPastThreshold || lcd_clicked) {
750
       if (encoderPastThreshold || lcd_clicked) {
712
         if (encoderPastThreshold) {
751
         if (encoderPastThreshold) {
713
-          int32_t encoderMultiplier = 1;
714
 
752
 
715
-          #if ENABLED(ENCODER_RATE_MULTIPLIER)
753
+          #if HAS_LCD_MENU && ENABLED(ENCODER_RATE_MULTIPLIER)
754
+
755
+            int32_t encoderMultiplier = 1;
716
 
756
 
717
             if (encoderRateMultiplierEnabled) {
757
             if (encoderRateMultiplierEnabled) {
718
               int32_t encoderMovementSteps = ABS(encoderDiff) / ENCODER_PULSES_PER_STEP;
758
               int32_t encoderMovementSteps = ABS(encoderDiff) / ENCODER_PULSES_PER_STEP;
737
 
777
 
738
               lastEncoderMovementMillis = ms;
778
               lastEncoderMovementMillis = ms;
739
             } // encoderRateMultiplierEnabled
779
             } // encoderRateMultiplierEnabled
780
+
781
+          #else
782
+
783
+            constexpr int32_t encoderMultiplier = 1;
784
+
740
           #endif // ENCODER_RATE_MULTIPLIER
785
           #endif // ENCODER_RATE_MULTIPLIER
741
 
786
 
742
           encoderPosition += (encoderDiff * encoderMultiplier) / ENCODER_PULSES_PER_STEP;
787
           encoderPosition += (encoderDiff * encoderMultiplier) / ENCODER_PULSES_PER_STEP;
743
           encoderDiff = 0;
788
           encoderDiff = 0;
744
         }
789
         }
745
-        #if LCD_TIMEOUT_TO_STATUS
790
+        #if HAS_LCD_MENU && LCD_TIMEOUT_TO_STATUS
746
           return_to_status_ms = ms + LCD_TIMEOUT_TO_STATUS;
791
           return_to_status_ms = ms + LCD_TIMEOUT_TO_STATUS;
747
         #endif
792
         #endif
748
         lcdDrawUpdate = LCDVIEW_REDRAW_NOW;
793
         lcdDrawUpdate = LCDVIEW_REDRAW_NOW;
749
       }
794
       }
750
 
795
 
751
-    #endif // HAS_LCD_MENU
796
+    #endif
752
 
797
 
753
     // This runs every ~100ms when idling often enough.
798
     // This runs every ~100ms when idling often enough.
754
     // Instead of tracking changes just redraw the Status Screen once per second.
799
     // Instead of tracking changes just redraw the Status Screen once per second.
1039
     } \
1084
     } \
1040
     DST = ~new_##DST; //invert it, because a pressed switch produces a logical 0
1085
     DST = ~new_##DST; //invert it, because a pressed switch produces a logical 0
1041
 
1086
 
1042
-  #if (ENABLED(LCD_I2C_TYPE_MCP23017) || ENABLED(LCD_I2C_TYPE_MCP23008)) && ENABLED(DETECT_DEVICE)
1043
-    bool lcd_detected() { return lcd.LcdDetected() == 1; }
1044
-  #else
1045
-    bool lcd_detected() { return true; }
1046
-  #endif
1047
-
1048
   #if ENABLED(G26_MESH_VALIDATION)
1087
   #if ENABLED(G26_MESH_VALIDATION)
1049
     void lcd_chirp() {
1088
     void lcd_chirp() {
1050
       lcd_buzz(LCD_FEEDBACK_FREQUENCY_DURATION_MS, LCD_FEEDBACK_FREQUENCY_HZ);
1089
       lcd_buzz(LCD_FEEDBACK_FREQUENCY_DURATION_MS, LCD_FEEDBACK_FREQUENCY_HZ);

+ 25
- 17
Marlin/src/lcd/ultralcd.h 查看文件

198
   inline void lcd_setalertstatusPGM(PGM_P message) { UNUSED(message); }
198
   inline void lcd_setalertstatusPGM(PGM_P message) { UNUSED(message); }
199
 #endif
199
 #endif
200
 
200
 
201
+#define HAS_ENCODER_ACTION (HAS_LCD_MENU || ENABLED(ULTIPANEL_FEEDMULTIPLY))
202
+
203
+#if HAS_ENCODER_ACTION
204
+  extern uint32_t encoderPosition;
205
+#endif
206
+
201
 #if HAS_SPI_LCD
207
 #if HAS_SPI_LCD
202
 
208
 
203
   #include "../Marlin.h"
209
   #include "../Marlin.h"
375
 
381
 
376
 #endif
382
 #endif
377
 
383
 
378
-#if HAS_LCD_MENU
384
+#define HAS_DIGITAL_ENCODER (HAS_SPI_LCD && ENABLED(NEWPANEL))
379
 
385
 
380
-  #if HAS_DIGITAL_ENCODER
386
+#if HAS_DIGITAL_ENCODER
381
 
387
 
382
-    // Wheel spin pins where BA is 00, 10, 11, 01 (1 bit always changes)
383
-    #define BLEN_A 0
384
-    #define BLEN_B 1
388
+  // Wheel spin pins where BA is 00, 10, 11, 01 (1 bit always changes)
389
+  #define BLEN_A 0
390
+  #define BLEN_B 1
385
 
391
 
386
-    #define EN_A _BV(BLEN_A)
387
-    #define EN_B _BV(BLEN_B)
392
+  #define EN_A _BV(BLEN_A)
393
+  #define EN_B _BV(BLEN_B)
388
 
394
 
389
-    #if BUTTON_EXISTS(ENC)
390
-      #define BLEN_C 2
391
-      #define EN_C _BV(BLEN_C)
392
-    #endif
395
+  #if BUTTON_EXISTS(ENC)
396
+    #define BLEN_C 2
397
+    #define EN_C _BV(BLEN_C)
398
+  #endif
393
 
399
 
394
-    #if BUTTON_EXISTS(BACK)
395
-      #define BLEN_D 3
396
-      #define EN_D _BV(BLEN_D)
397
-      #define LCD_BACK_CLICKED (buttons & EN_D)
398
-    #endif
400
+  #if BUTTON_EXISTS(BACK)
401
+    #define BLEN_D 3
402
+    #define EN_D _BV(BLEN_D)
403
+    #define LCD_BACK_CLICKED (buttons & EN_D)
404
+  #endif
399
 
405
 
400
-  #endif // NEWPANEL
406
+#endif // HAS_DIGITAL_ENCODER
407
+
408
+#if HAS_LCD_MENU
401
 
409
 
402
   extern volatile uint8_t buttons;  // The last-checked buttons in a bit array.
410
   extern volatile uint8_t buttons;  // The last-checked buttons in a bit array.
403
   void lcd_buttons_update();
411
   void lcd_buttons_update();

+ 7
- 6
Marlin/src/pins/pins_SANGUINOLOLU_11.h 查看文件

153
 //
153
 //
154
 // LCD / Controller
154
 // LCD / Controller
155
 //
155
 //
156
-#if ENABLED(ULTRA_LCD) && ENABLED(NEWPANEL)
156
+#if ENABLED(ULTRA_LCD)
157
 
157
 
158
   #if ENABLED(DOGLCD)
158
   #if ENABLED(DOGLCD)
159
 
159
 
217
 
217
 
218
   #endif // !DOGLCD
218
   #endif // !DOGLCD
219
 
219
 
220
-  #define BTN_EN1               11
221
-  #define BTN_EN2               10
222
-
223
   #if ENABLED(LCD_I2C_PANELOLU2)
220
   #if ENABLED(LCD_I2C_PANELOLU2)
224
 
221
 
225
     #if ENABLED(IS_MELZI)
222
     #if ENABLED(IS_MELZI)
258
     #define LCD_PINS_D7         17
255
     #define LCD_PINS_D7         17
259
     #define ADC_KEYPAD_PIN       1
256
     #define ADC_KEYPAD_PIN       1
260
 
257
 
261
-    // Not used
262
     #define BTN_EN1             -1
258
     #define BTN_EN1             -1
263
     #define BTN_EN2             -1
259
     #define BTN_EN2             -1
264
 
260
 
269
 
265
 
270
   #endif
266
   #endif
271
 
267
 
268
+  #if ENABLED(NEWPANEL) && !defined(BTN_EN1)
269
+    #define BTN_EN1             11
270
+    #define BTN_EN2             10
271
+  #endif
272
+
272
   #define SD_DETECT_PIN         -1
273
   #define SD_DETECT_PIN         -1
273
 
274
 
274
-#endif // ULTRA_LCD && NEWPANEL
275
+#endif // ULTRA_LCD
275
 
276
 
276
 //
277
 //
277
 // M3/M4/M5 - Spindle/Laser Control
278
 // M3/M4/M5 - Spindle/Laser Control

+ 1
- 1
buildroot/share/tests/STM32F1_tests 查看文件

13
            PAREN_COMMENTS GCODE_MOTION_MODES SINGLENOZZLE TOOLCHANGE_FILAMENT_SWAP TOOLCHANGE_PARK
13
            PAREN_COMMENTS GCODE_MOTION_MODES SINGLENOZZLE TOOLCHANGE_FILAMENT_SWAP TOOLCHANGE_PARK
14
 exec_test $1 $2 "STM32F1R EEPROM_SETTINGS EEPROM_CHITCHAT REPRAP_DISCOUNT_SMART_CONTROLLER SDSUPPORT PAREN_COMMENTS GCODE_MOTION_MODES"
14
 exec_test $1 $2 "STM32F1R EEPROM_SETTINGS EEPROM_CHITCHAT REPRAP_DISCOUNT_SMART_CONTROLLER SDSUPPORT PAREN_COMMENTS GCODE_MOTION_MODES"
15
 
15
 
16
-opt_enable SPINDLE_LASER_ENABLE
16
+opt_enable SPINDLE_LASER_ENABLE NO_LCD_MENUS
17
 exec_test $1 $2 "STM32F1R SPINDLE_LASER_ENABLE"
17
 exec_test $1 $2 "STM32F1R SPINDLE_LASER_ENABLE"
18
 
18
 
19
 # cleanup
19
 # cleanup

Loading…
取消
儲存