瀏覽代碼

:art: Misc. code cleanup

Scott Lahteine 4 年之前
父節點
當前提交
0c8a53e507

+ 2
- 2
Marlin/src/core/serial.h 查看文件

@@ -210,7 +210,7 @@ void serialprintPGM(PGM_P str);
210 210
 #define _SEP_N_P_REF()            _SEP_N_P
211 211
 #define _SEP_1_P(s)               serialprintPGM(s);
212 212
 #define _SEP_2_P(s,v)             serial_echopair_PGM(s,v);
213
-#define _SEP_3_P(s,v,V...)        _SEP_2_P(s,v); DEFER(_SEP_N_P_REF)()(TWO_ARGS(V),V);
213
+#define _SEP_3_P(s,v,V...)        _SEP_2_P(s,v); DEFER2(_SEP_N_P_REF)()(TWO_ARGS(V),V);
214 214
 #define SERIAL_ECHOPAIR_P(V...)   do{ EVAL(_SEP_N_P(TWO_ARGS(V),V)); }while(0)
215 215
 
216 216
 // Print up to 20 pairs of values followed by newline. Odd elements must be PSTR pointers.
@@ -219,7 +219,7 @@ void serialprintPGM(PGM_P str);
219 219
 #define _SELP_N_P_REF()           _SELP_N_P
220 220
 #define _SELP_1_P(s)              { serialprintPGM(s); SERIAL_EOL(); }
221 221
 #define _SELP_2_P(s,v)            { serial_echopair_PGM(s,v); SERIAL_EOL(); }
222
-#define _SELP_3_P(s,v,V...)       { _SEP_2_P(s,v); DEFER(_SELP_N_P_REF)()(TWO_ARGS(V),V); }
222
+#define _SELP_3_P(s,v,V...)       { _SEP_2_P(s,v); DEFER2(_SELP_N_P_REF)()(TWO_ARGS(V),V); }
223 223
 #define SERIAL_ECHOLNPAIR_P(V...) do{ EVAL(_SELP_N_P(TWO_ARGS(V),V)); }while(0)
224 224
 
225 225
 #ifdef AllowDifferentTypeInList

+ 1
- 1
Marlin/src/feature/dac/dac_mcp4728.cpp 查看文件

@@ -66,7 +66,7 @@ uint8_t MCP4728::analogWrite(const uint8_t channel, const uint16_t value) {
66 66
 }
67 67
 
68 68
 /**
69
- * Write all input resistor values to EEPROM using SequencialWrite method.
69
+ * Write all input resistor values to EEPROM using SequentialWrite method.
70 70
  * This will update both input register and EEPROM value
71 71
  * This will also write current Vref, PowerDown, Gain settings to EEPROM
72 72
  */

+ 1
- 6
Marlin/src/feature/joystick.cpp 查看文件

@@ -164,12 +164,7 @@ Joystick joystick;
164 164
     xyz_float_t move_dist{0};
165 165
     float hypot2 = 0;
166 166
     LOOP_XYZ(i) if (norm_jog[i]) {
167
-      move_dist[i] = seg_time * norm_jog[i] *
168
-        #if ENABLED(EXTENSIBLE_UI)
169
-          manual_feedrate_mm_s[i];
170
-        #else
171
-          planner.settings.max_feedrate_mm_s[i];
172
-        #endif
167
+      move_dist[i] = seg_time * norm_jog[i] * TERN(EXTENSIBLE_UI, manual_feedrate_mm_s, planner.settings.max_feedrate_mm_s)[i];
173 168
       hypot2 += sq(move_dist[i]);
174 169
     }
175 170
 

+ 1
- 1
Marlin/src/gcode/motion/M290.cpp 查看文件

@@ -82,7 +82,7 @@ void GcodeSuite::M290() {
82 82
       const float offs = constrain(parser.value_axis_units(Z_AXIS), -2, 2);
83 83
       babystep.add_mm(Z_AXIS, offs);
84 84
       #if ENABLED(BABYSTEP_ZPROBE_OFFSET)
85
-        if (!parser.seen('P') || parser.value_bool()) mod_probe_offset(offs);
85
+        if (parser.boolval('P', true)) mod_probe_offset(offs);
86 86
       #endif
87 87
     }
88 88
   #endif

+ 1
- 1
Marlin/src/module/delta.cpp 查看文件

@@ -271,7 +271,7 @@ void home_delta() {
271 271
   // Do this here all at once for Delta, because
272 272
   // XYZ isn't ABC. Applying this per-tower would
273 273
   // give the impression that they are the same.
274
-  LOOP_XYZ(i) set_axis_is_at_home((AxisEnum)i);
274
+  LOOP_ABC(i) set_axis_is_at_home((AxisEnum)i);
275 275
 
276 276
   sync_plan_position();
277 277
 

+ 4
- 4
Marlin/src/module/settings.cpp 查看文件

@@ -1072,7 +1072,7 @@ void MarlinSettings::postprocess() {
1072 1072
     {
1073 1073
       _FIELD_TEST(tmc_stepper_current);
1074 1074
 
1075
-      tmc_stepper_current_t tmc_stepper_current = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
1075
+      tmc_stepper_current_t tmc_stepper_current{0};
1076 1076
 
1077 1077
       #if HAS_TRINAMIC_CONFIG
1078 1078
         #if AXIS_IS_TMC(X)
@@ -1134,7 +1134,7 @@ void MarlinSettings::postprocess() {
1134 1134
       _FIELD_TEST(tmc_hybrid_threshold);
1135 1135
 
1136 1136
       #if ENABLED(HYBRID_THRESHOLD)
1137
-       tmc_hybrid_threshold_t tmc_hybrid_threshold = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
1137
+        tmc_hybrid_threshold_t tmc_hybrid_threshold{0};
1138 1138
         #if AXIS_HAS_STEALTHCHOP(X)
1139 1139
           tmc_hybrid_threshold.X = stepperX.get_pwm_thrs();
1140 1140
         #endif
@@ -1538,7 +1538,7 @@ void MarlinSettings::postprocess() {
1538 1538
             EEPROM_READ(dummyf);
1539 1539
           #endif
1540 1540
         #else
1541
-          for (uint8_t q = 4; q--;) EEPROM_READ(dummyf);
1541
+          for (uint8_t q = XYZE; q--;) EEPROM_READ(dummyf);
1542 1542
         #endif
1543 1543
 
1544 1544
         EEPROM_READ(TERN(CLASSIC_JERK, dummyf, planner.junction_deviation_mm));
@@ -2256,7 +2256,7 @@ void MarlinSettings::postprocess() {
2256 2256
           const xyz_float_t &backlash_distance_mm = backlash.distance_mm;
2257 2257
           const uint8_t &backlash_correction = backlash.correction;
2258 2258
         #else
2259
-          float backlash_distance_mm[XYZ];
2259
+          xyz_float_t backlash_distance_mm;
2260 2260
           uint8_t backlash_correction;
2261 2261
         #endif
2262 2262
         #if ENABLED(BACKLASH_GCODE) && defined(BACKLASH_SMOOTHING_MM)

+ 1
- 1
Marlin/src/module/stepper.h 查看文件

@@ -250,7 +250,7 @@ class Stepper {
250 250
         #ifndef PWM_MOTOR_CURRENT
251 251
           #define PWM_MOTOR_CURRENT DEFAULT_PWM_MOTOR_CURRENT
252 252
         #endif
253
-        #define MOTOR_CURRENT_COUNT 3
253
+        #define MOTOR_CURRENT_COUNT XYZ
254 254
       #elif HAS_MOTOR_CURRENT_SPI
255 255
         static constexpr uint32_t digipot_count[] = DIGIPOT_MOTOR_CURRENT;
256 256
         #define MOTOR_CURRENT_COUNT COUNT(Stepper::digipot_count)

+ 1
- 4
Marlin/src/module/tool_change.cpp 查看文件

@@ -113,10 +113,7 @@
113 113
 
114 114
   void move_extruder_servo(const uint8_t e) {
115 115
     planner.synchronize();
116
-    #if EXTRUDERS & 1
117
-      if (e < EXTRUDERS - 1)
118
-    #endif
119
-    {
116
+    if ((EXTRUDERS & 1) && e < EXTRUDERS - 1) {
120 117
       MOVE_SERVO(_SERVO_NR(e), servo_angles[_SERVO_NR(e)][e & 1]);
121 118
       safe_delay(500);
122 119
     }

Loading…
取消
儲存