ソースを参照

Parenthesize some menu defines for safety

Scott Lahteine 8年前
コミット
4d4745c0eb
1個のファイルの変更7行の追加7行の削除
  1. 7
    7
      Marlin/ultralcd.cpp

+ 7
- 7
Marlin/ultralcd.cpp ファイルの表示

238
     encoderRateMultiplierEnabled = false; \
238
     encoderRateMultiplierEnabled = false; \
239
     if (encoderPosition > 0x8000) encoderPosition = 0; \
239
     if (encoderPosition > 0x8000) encoderPosition = 0; \
240
     static int8_t _countedItems = 0; \
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
       encoderPosition = encoderLine * (ENCODER_STEPS_PER_MENU_ITEM); \
244
       encoderPosition = encoderLine * (ENCODER_STEPS_PER_MENU_ITEM); \
245
     }
245
     }
246
 
246
 
247
   #define SCREEN_OR_MENU_LOOP() \
247
   #define SCREEN_OR_MENU_LOOP() \
248
     int8_t _menuLineNr = encoderTopLine, _thisItemNr; \
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
       _thisItemNr = 0
250
       _thisItemNr = 0
251
 
251
 
252
   /**
252
   /**
257
    *               Scroll as-needed to keep the selected line in view.
257
    *               Scroll as-needed to keep the selected line in view.
258
    */
258
    */
259
   #define START_SCREEN() \
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
     encoderTopLine = encoderLine; \
261
     encoderTopLine = encoderLine; \
262
     bool _skipStatic = false; \
262
     bool _skipStatic = false; \
263
     SCREEN_OR_MENU_LOOP()
263
     SCREEN_OR_MENU_LOOP()
266
     START_SCREEN_OR_MENU(1); \
266
     START_SCREEN_OR_MENU(1); \
267
     screen_changed = false; \
267
     screen_changed = false; \
268
     NOMORE(encoderTopLine, encoderLine); \
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
     bool _skipStatic = true; \
272
     bool _skipStatic = true; \
273
     SCREEN_OR_MENU_LOOP()
273
     SCREEN_OR_MENU_LOOP()

読み込み中…
キャンセル
保存