Przeglądaj źródła

Prep formatting for upcoming PR

Scott Lahteine 9 lat temu
rodzic
commit
422582da71
1 zmienionych plików z 28 dodań i 34 usunięć
  1. 28
    34
      Marlin/ultralcd.cpp

+ 28
- 34
Marlin/ultralcd.cpp Wyświetl plik

@@ -143,7 +143,7 @@ static void menu_action_setting_edit_callback_long5(const char* pstr, unsigned l
143 143
     _menuItemNr++;\
144 144
 } while(0)
145 145
 #ifdef ENCODER_RATE_MULTIPLIER
146
-#define MENU_MULTIPLIER_ITEM(type, label, args...) do { \
146
+  #define MENU_MULTIPLIER_ITEM(type, label, args...) do { \
147 147
     if (_menuItemNr == _lineNr) { \
148 148
       if (lcdDrawUpdate) { \
149 149
         const char* _label_pstr = PSTR(label); \
@@ -163,18 +163,18 @@ static void menu_action_setting_edit_callback_long5(const char* pstr, unsigned l
163 163
       } \
164 164
     } \
165 165
     _menuItemNr++; \
166
-} while(0)
167
-#endif
166
+  } while(0)
167
+#endif //ENCODER_RATE_MULTIPLIER
168 168
 #define MENU_ITEM_DUMMY() do { _menuItemNr++; } while(0)
169 169
 #define MENU_ITEM_EDIT(type, label, args...) MENU_ITEM(setting_edit_ ## type, label, PSTR(label) , ## args )
170 170
 #define MENU_ITEM_EDIT_CALLBACK(type, label, args...) MENU_ITEM(setting_edit_callback_ ## type, label, PSTR(label) , ## args )
171 171
 #ifdef ENCODER_RATE_MULTIPLIER
172
-#define MENU_MULTIPLIER_ITEM_EDIT(type, label, args...) MENU_MULTIPLIER_ITEM(setting_edit_ ## type, label, PSTR(label) , ## args )
173
-#define MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(type, label, args...) MENU_MULTIPLIER_ITEM(setting_edit_callback_ ## type, label, PSTR(label) , ## args )
174
-#else
175
-#define MENU_MULTIPLIER_ITEM_EDIT(type, label, args...) MENU_ITEM(setting_edit_ ## type, label, PSTR(label) , ## args )
176
-#define MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(type, label, args...) MENU_ITEM(setting_edit_callback_ ## type, label, PSTR(label) , ## args )
177
-#endif
172
+  #define MENU_MULTIPLIER_ITEM_EDIT(type, label, args...) MENU_MULTIPLIER_ITEM(setting_edit_ ## type, label, PSTR(label) , ## args )
173
+  #define MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(type, label, args...) MENU_MULTIPLIER_ITEM(setting_edit_callback_ ## type, label, PSTR(label) , ## args )
174
+#else //!ENCODER_RATE_MULTIPLIER
175
+  #define MENU_MULTIPLIER_ITEM_EDIT(type, label, args...) MENU_ITEM(setting_edit_ ## type, label, PSTR(label) , ## args )
176
+  #define MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(type, label, args...) MENU_ITEM(setting_edit_callback_ ## type, label, PSTR(label) , ## args )
177
+#endif //!ENCODER_RATE_MULTIPLIER
178 178
 #define END_MENU() \
179 179
     if (encoderPosition / ENCODER_STEPS_PER_MENU_ITEM >= _menuItemNr) encoderPosition = _menuItemNr * ENCODER_STEPS_PER_MENU_ITEM - 1; \
180 180
     if ((uint8_t)(encoderPosition / ENCODER_STEPS_PER_MENU_ITEM) >= currentMenuViewOffset + LCD_HEIGHT) { currentMenuViewOffset = (encoderPosition / ENCODER_STEPS_PER_MENU_ITEM) - LCD_HEIGHT + 1; lcdDrawUpdate = 1; _lineNr = currentMenuViewOffset - 1; _drawLineNr = -1; } \
@@ -1422,28 +1422,21 @@ void lcd_update()
1422 1422
         {
1423 1423
       int32_t encoderMultiplier = 1;
1424 1424
 
1425
-#ifdef ENCODER_RATE_MULTIPLIER
1426
-      if (encoderRateMultiplierEnabled)
1427
-      {
1428
-        int32_t encoderMovementSteps = abs(encoderDiff) / ENCODER_PULSES_PER_STEP;
1425
+  #ifdef ENCODER_RATE_MULTIPLIER
1429 1426
 
1430
-        if (lastEncoderMovementMillis != 0)
1431
-        {
1432
-          // Note that the rate is always calculated between to passes through the 
1433
-          // loop and that the abs of the encoderDiff value is tracked.
1434
-          float encoderStepRate =
1435
-            (float)(encoderMovementSteps) / ((float)(millis() - lastEncoderMovementMillis)) * 1000.0;
1436
-
1437
-          if (encoderStepRate >= ENCODER_100X_STEPS_PER_SEC)
1438
-          {
1439
-            encoderMultiplier = 100;
1440
-          }
1441
-          else if (encoderStepRate >= ENCODER_10X_STEPS_PER_SEC)
1442
-          {
1443
-            encoderMultiplier = 10;
1444
-          }
1427
+    if (encoderRateMultiplierEnabled) {
1428
+      int32_t encoderMovementSteps = abs(encoderDiff) / ENCODER_PULSES_PER_STEP;
1429
+
1430
+      if (lastEncoderMovementMillis != 0) {
1431
+        // Note that the rate is always calculated between to passes through the 
1432
+        // loop and that the abs of the encoderDiff value is tracked.
1433
+        float encoderStepRate =
1434
+          (float)(encoderMovementSteps) / ((float)(millis() - lastEncoderMovementMillis)) * 1000.0;
1445 1435
 
1446
-#ifdef ENCODER_RATE_MULTIPLIER_DEBUG
1436
+        if (encoderStepRate >= ENCODER_100X_STEPS_PER_SEC)     encoderMultiplier = 100;
1437
+        else if (encoderStepRate >= ENCODER_10X_STEPS_PER_SEC) encoderMultiplier = 10;
1438
+
1439
+        #ifdef ENCODER_RATE_MULTIPLIER_DEBUG
1447 1440
           SERIAL_ECHO_START;
1448 1441
           SERIAL_ECHO("Enc Step Rate: ");
1449 1442
           SERIAL_ECHO(encoderStepRate);
@@ -1453,12 +1446,13 @@ void lcd_update()
1453 1446
           SERIAL_ECHO(ENCODER_10X_STEPS_PER_SEC);
1454 1447
           SERIAL_ECHO("  ENCODER_100X_STEPS_PER_SEC: ");
1455 1448
           SERIAL_ECHOLN(ENCODER_100X_STEPS_PER_SEC);
1456
-#endif
1457
-        }
1458
-
1459
-        lastEncoderMovementMillis = millis();
1449
+        #endif //ENCODER_RATE_MULTIPLIER_DEBUG
1460 1450
       }
1461
-#endif
1451
+
1452
+      lastEncoderMovementMillis = millis();
1453
+    }
1454
+  #endif //ENCODER_RATE_MULTIPLIER
1455
+
1462 1456
             lcdDrawUpdate = 1;
1463 1457
             encoderPosition += (encoderDiff * encoderMultiplier) / ENCODER_PULSES_PER_STEP;
1464 1458
             encoderDiff = 0;

Ładowanie…
Anuluj
Zapisz