Browse Source

🎨 Apply shorthand and cleanups

Scott Lahteine 4 years ago
parent
commit
d71b35c24f

+ 2
- 6
Marlin/src/feature/caselight.cpp View File

44
   LEDColor CaseLight::color = { init_case_light[0], init_case_light[1], init_case_light[2], TERN_(HAS_WHITE_LED, init_case_light[3]) };
44
   LEDColor CaseLight::color = { init_case_light[0], init_case_light[1], init_case_light[2], TERN_(HAS_WHITE_LED, init_case_light[3]) };
45
 #endif
45
 #endif
46
 
46
 
47
-#ifndef INVERT_CASE_LIGHT
48
-  #define INVERT_CASE_LIGHT false
49
-#endif
50
-
51
 void CaseLight::update(const bool sflag) {
47
 void CaseLight::update(const bool sflag) {
52
   #if CASELIGHT_USES_BRIGHTNESS
48
   #if CASELIGHT_USES_BRIGHTNESS
53
     /**
49
     /**
64
     if (sflag && on)
60
     if (sflag && on)
65
       brightness = brightness_sav;  // Restore last brightness for M355 S1
61
       brightness = brightness_sav;  // Restore last brightness for M355 S1
66
 
62
 
67
-    const uint8_t i = on ? brightness : 0, n10ct = INVERT_CASE_LIGHT ? 255 - i : i;
63
+    const uint8_t i = on ? brightness : 0, n10ct = ENABLED(INVERT_CASE_LIGHT) ? 255 - i : i;
68
     UNUSED(n10ct);
64
     UNUSED(n10ct);
69
   #endif
65
   #endif
70
 
66
 
86
       else
82
       else
87
     #endif
83
     #endif
88
       {
84
       {
89
-        const bool s = on ? !INVERT_CASE_LIGHT : INVERT_CASE_LIGHT;
85
+        const bool s = on ? TERN(INVERT_CASE_LIGHT, LOW, HIGH) : TERN(INVERT_CASE_LIGHT, HIGH, LOW);
90
         WRITE(CASE_LIGHT_PIN, s ? HIGH : LOW);
86
         WRITE(CASE_LIGHT_PIN, s ? HIGH : LOW);
91
       }
87
       }
92
 
88
 

+ 1
- 1
Marlin/src/feature/dac/stepper_dac.cpp View File

51
   mcp4728.setVref_all(DAC_STEPPER_VREF);
51
   mcp4728.setVref_all(DAC_STEPPER_VREF);
52
   mcp4728.setGain_all(DAC_STEPPER_GAIN);
52
   mcp4728.setGain_all(DAC_STEPPER_GAIN);
53
 
53
 
54
-  if (mcp4728.getDrvPct(0) < 1 || mcp4728.getDrvPct(1) < 1 || mcp4728.getDrvPct(2) < 1 || mcp4728.getDrvPct(3) < 1 ) {
54
+  if (mcp4728.getDrvPct(0) < 1 || mcp4728.getDrvPct(1) < 1 || mcp4728.getDrvPct(2) < 1 || mcp4728.getDrvPct(3) < 1) {
55
     mcp4728.setDrvPct(dac_channel_pct);
55
     mcp4728.setDrvPct(dac_channel_pct);
56
     mcp4728.eepromWrite();
56
     mcp4728.eepromWrite();
57
   }
57
   }

+ 1
- 1
Marlin/src/gcode/gcode.cpp View File

566
       #endif
566
       #endif
567
 
567
 
568
       #if ENABLED(AUTO_REPORT_POSITION)
568
       #if ENABLED(AUTO_REPORT_POSITION)
569
-        case 154: M154(); break;                                  // M155: Set position auto-report interval
569
+        case 154: M154(); break;                                  // M154: Set position auto-report interval
570
       #endif
570
       #endif
571
 
571
 
572
       #if BOTH(AUTO_REPORT_TEMPERATURES, HAS_TEMP_SENSOR)
572
       #if BOTH(AUTO_REPORT_TEMPERATURES, HAS_TEMP_SENSOR)

+ 3
- 18
Marlin/src/libs/L64XX/L64XX_Marlin.cpp View File

445
       position_min = X_center - displacement;
445
       position_min = X_center - displacement;
446
       position_max = X_center + displacement;
446
       position_max = X_center + displacement;
447
       echo_min_max('X', position_min, position_max);
447
       echo_min_max('X', position_min, position_max);
448
-      if (false
449
-        #if HAS_ENDSTOPS
450
-          || position_min < (X_MIN_POS)
451
-          || position_max > (X_MAX_POS)
452
-        #endif
453
-      ) {
448
+      if (TERN0(HAS_ENDSTOPS, position_min < (X_MIN_POS) || position_max > (X_MAX_POS))) {
454
         err_out_of_bounds();
449
         err_out_of_bounds();
455
         return true;
450
         return true;
456
       }
451
       }
460
       position_min = Y_center - displacement;
455
       position_min = Y_center - displacement;
461
       position_max = Y_center + displacement;
456
       position_max = Y_center + displacement;
462
       echo_min_max('Y', position_min, position_max);
457
       echo_min_max('Y', position_min, position_max);
463
-      if (false
464
-        #if HAS_ENDSTOPS
465
-          || position_min < (Y_MIN_POS)
466
-          || position_max > (Y_MAX_POS)
467
-        #endif
468
-      ) {
458
+      if (TERN0(HAS_ENDSTOPS, position_min < (Y_MIN_POS) || position_max > (Y_MAX_POS))) {
469
         err_out_of_bounds();
459
         err_out_of_bounds();
470
         return true;
460
         return true;
471
       }
461
       }
475
       position_min = Z_center - displacement;
465
       position_min = Z_center - displacement;
476
       position_max = Z_center + displacement;
466
       position_max = Z_center + displacement;
477
       echo_min_max('Z', position_min, position_max);
467
       echo_min_max('Z', position_min, position_max);
478
-      if (false
479
-        #if HAS_ENDSTOPS
480
-          || position_min < (Z_MIN_POS)
481
-          || position_max > (Z_MAX_POS)
482
-        #endif
483
-      ) {
468
+      if (TERN0(HAS_ENDSTOPS, position_min < (Z_MIN_POS) || position_max > (Z_MAX_POS))) {
484
         err_out_of_bounds();
469
         err_out_of_bounds();
485
         return true;
470
         return true;
486
       }
471
       }

+ 3
- 3
Marlin/src/module/planner.h View File

491
     #if HAS_CLASSIC_JERK
491
     #if HAS_CLASSIC_JERK
492
       static void set_max_jerk(const AxisEnum axis, float inMaxJerkMMS);
492
       static void set_max_jerk(const AxisEnum axis, float inMaxJerkMMS);
493
     #else
493
     #else
494
-      static inline void set_max_jerk(const AxisEnum, const_float_t ) {}
494
+      static inline void set_max_jerk(const AxisEnum, const_float_t) {}
495
     #endif
495
     #endif
496
 
496
 
497
     #if HAS_EXTRUDERS
497
     #if HAS_EXTRUDERS
592
 
592
 
593
     #else
593
     #else
594
 
594
 
595
-      FORCE_INLINE static float fade_scaling_factor_for_z(const_float_t ) { return 1; }
595
+      FORCE_INLINE static float fade_scaling_factor_for_z(const_float_t) { return 1; }
596
 
596
 
597
-      FORCE_INLINE static bool leveling_active_at_z(const_float_t ) { return true; }
597
+      FORCE_INLINE static bool leveling_active_at_z(const_float_t) { return true; }
598
 
598
 
599
     #endif
599
     #endif
600
 
600
 

Loading…
Cancel
Save