Sfoglia il codice sorgente

Parenthesize some menu defines for safety

Scott Lahteine 7 anni fa
parent
commit
4d4745c0eb
1 ha cambiato i file con 7 aggiunte e 7 eliminazioni
  1. 7
    7
      Marlin/ultralcd.cpp

+ 7
- 7
Marlin/ultralcd.cpp Vedi File

@@ -238,15 +238,15 @@ uint16_t max_display_update_time = 0;
238 238
     encoderRateMultiplierEnabled = false; \
239 239
     if (encoderPosition > 0x8000) encoderPosition = 0; \
240 240
     static int8_t _countedItems = 0; \
241
-    int8_t encoderLine = encoderPosition / ENCODER_STEPS_PER_MENU_ITEM; \
242
-    if (_countedItems > 0 && encoderLine >= _countedItems - LIMIT) { \
243
-      encoderLine = max(0, _countedItems - LIMIT); \
241
+    int8_t encoderLine = encoderPosition / (ENCODER_STEPS_PER_MENU_ITEM); \
242
+    if (_countedItems > 0 && encoderLine >= _countedItems - (LIMIT)) { \
243
+      encoderLine = max(0, _countedItems - (LIMIT)); \
244 244
       encoderPosition = encoderLine * (ENCODER_STEPS_PER_MENU_ITEM); \
245 245
     }
246 246
 
247 247
   #define SCREEN_OR_MENU_LOOP() \
248 248
     int8_t _menuLineNr = encoderTopLine, _thisItemNr; \
249
-    for (int8_t _lcdLineNr = 0; _lcdLineNr < LCD_HEIGHT - TALL_FONT_CORRECTION; _lcdLineNr++, _menuLineNr++) { \
249
+    for (int8_t _lcdLineNr = 0; _lcdLineNr < LCD_HEIGHT - (TALL_FONT_CORRECTION); _lcdLineNr++, _menuLineNr++) { \
250 250
       _thisItemNr = 0
251 251
 
252 252
   /**
@@ -257,7 +257,7 @@ uint16_t max_display_update_time = 0;
257 257
    *               Scroll as-needed to keep the selected line in view.
258 258
    */
259 259
   #define START_SCREEN() \
260
-    START_SCREEN_OR_MENU(LCD_HEIGHT - TALL_FONT_CORRECTION); \
260
+    START_SCREEN_OR_MENU(LCD_HEIGHT - (TALL_FONT_CORRECTION)); \
261 261
     encoderTopLine = encoderLine; \
262 262
     bool _skipStatic = false; \
263 263
     SCREEN_OR_MENU_LOOP()
@@ -266,8 +266,8 @@ uint16_t max_display_update_time = 0;
266 266
     START_SCREEN_OR_MENU(1); \
267 267
     screen_changed = false; \
268 268
     NOMORE(encoderTopLine, encoderLine); \
269
-    if (encoderLine >= encoderTopLine + LCD_HEIGHT - TALL_FONT_CORRECTION) { \
270
-      encoderTopLine = encoderLine - (LCD_HEIGHT - TALL_FONT_CORRECTION - 1); \
269
+    if (encoderLine >= encoderTopLine + LCD_HEIGHT - (TALL_FONT_CORRECTION)) { \
270
+      encoderTopLine = encoderLine - (LCD_HEIGHT - (TALL_FONT_CORRECTION) - 1); \
271 271
     } \
272 272
     bool _skipStatic = true; \
273 273
     SCREEN_OR_MENU_LOOP()

Loading…
Annulla
Salva