Browse Source

:art: Misc. code cleanup

Scott Lahteine 4 years ago
parent
commit
0c8a53e507

+ 2
- 2
Marlin/src/core/serial.h View File

210
 #define _SEP_N_P_REF()            _SEP_N_P
210
 #define _SEP_N_P_REF()            _SEP_N_P
211
 #define _SEP_1_P(s)               serialprintPGM(s);
211
 #define _SEP_1_P(s)               serialprintPGM(s);
212
 #define _SEP_2_P(s,v)             serial_echopair_PGM(s,v);
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
 #define SERIAL_ECHOPAIR_P(V...)   do{ EVAL(_SEP_N_P(TWO_ARGS(V),V)); }while(0)
214
 #define SERIAL_ECHOPAIR_P(V...)   do{ EVAL(_SEP_N_P(TWO_ARGS(V),V)); }while(0)
215
 
215
 
216
 // Print up to 20 pairs of values followed by newline. Odd elements must be PSTR pointers.
216
 // Print up to 20 pairs of values followed by newline. Odd elements must be PSTR pointers.
219
 #define _SELP_N_P_REF()           _SELP_N_P
219
 #define _SELP_N_P_REF()           _SELP_N_P
220
 #define _SELP_1_P(s)              { serialprintPGM(s); SERIAL_EOL(); }
220
 #define _SELP_1_P(s)              { serialprintPGM(s); SERIAL_EOL(); }
221
 #define _SELP_2_P(s,v)            { serial_echopair_PGM(s,v); SERIAL_EOL(); }
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
 #define SERIAL_ECHOLNPAIR_P(V...) do{ EVAL(_SELP_N_P(TWO_ARGS(V),V)); }while(0)
223
 #define SERIAL_ECHOLNPAIR_P(V...) do{ EVAL(_SELP_N_P(TWO_ARGS(V),V)); }while(0)
224
 
224
 
225
 #ifdef AllowDifferentTypeInList
225
 #ifdef AllowDifferentTypeInList

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

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
  * This will update both input register and EEPROM value
70
  * This will update both input register and EEPROM value
71
  * This will also write current Vref, PowerDown, Gain settings to EEPROM
71
  * This will also write current Vref, PowerDown, Gain settings to EEPROM
72
  */
72
  */

+ 1
- 6
Marlin/src/feature/joystick.cpp View File

164
     xyz_float_t move_dist{0};
164
     xyz_float_t move_dist{0};
165
     float hypot2 = 0;
165
     float hypot2 = 0;
166
     LOOP_XYZ(i) if (norm_jog[i]) {
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
       hypot2 += sq(move_dist[i]);
168
       hypot2 += sq(move_dist[i]);
174
     }
169
     }
175
 
170
 

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

82
       const float offs = constrain(parser.value_axis_units(Z_AXIS), -2, 2);
82
       const float offs = constrain(parser.value_axis_units(Z_AXIS), -2, 2);
83
       babystep.add_mm(Z_AXIS, offs);
83
       babystep.add_mm(Z_AXIS, offs);
84
       #if ENABLED(BABYSTEP_ZPROBE_OFFSET)
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
       #endif
86
       #endif
87
     }
87
     }
88
   #endif
88
   #endif

+ 1
- 1
Marlin/src/module/delta.cpp View File

271
   // Do this here all at once for Delta, because
271
   // Do this here all at once for Delta, because
272
   // XYZ isn't ABC. Applying this per-tower would
272
   // XYZ isn't ABC. Applying this per-tower would
273
   // give the impression that they are the same.
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
   sync_plan_position();
276
   sync_plan_position();
277
 
277
 

+ 4
- 4
Marlin/src/module/settings.cpp View File

1072
     {
1072
     {
1073
       _FIELD_TEST(tmc_stepper_current);
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
       #if HAS_TRINAMIC_CONFIG
1077
       #if HAS_TRINAMIC_CONFIG
1078
         #if AXIS_IS_TMC(X)
1078
         #if AXIS_IS_TMC(X)
1134
       _FIELD_TEST(tmc_hybrid_threshold);
1134
       _FIELD_TEST(tmc_hybrid_threshold);
1135
 
1135
 
1136
       #if ENABLED(HYBRID_THRESHOLD)
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
         #if AXIS_HAS_STEALTHCHOP(X)
1138
         #if AXIS_HAS_STEALTHCHOP(X)
1139
           tmc_hybrid_threshold.X = stepperX.get_pwm_thrs();
1139
           tmc_hybrid_threshold.X = stepperX.get_pwm_thrs();
1140
         #endif
1140
         #endif
1538
             EEPROM_READ(dummyf);
1538
             EEPROM_READ(dummyf);
1539
           #endif
1539
           #endif
1540
         #else
1540
         #else
1541
-          for (uint8_t q = 4; q--;) EEPROM_READ(dummyf);
1541
+          for (uint8_t q = XYZE; q--;) EEPROM_READ(dummyf);
1542
         #endif
1542
         #endif
1543
 
1543
 
1544
         EEPROM_READ(TERN(CLASSIC_JERK, dummyf, planner.junction_deviation_mm));
1544
         EEPROM_READ(TERN(CLASSIC_JERK, dummyf, planner.junction_deviation_mm));
2256
           const xyz_float_t &backlash_distance_mm = backlash.distance_mm;
2256
           const xyz_float_t &backlash_distance_mm = backlash.distance_mm;
2257
           const uint8_t &backlash_correction = backlash.correction;
2257
           const uint8_t &backlash_correction = backlash.correction;
2258
         #else
2258
         #else
2259
-          float backlash_distance_mm[XYZ];
2259
+          xyz_float_t backlash_distance_mm;
2260
           uint8_t backlash_correction;
2260
           uint8_t backlash_correction;
2261
         #endif
2261
         #endif
2262
         #if ENABLED(BACKLASH_GCODE) && defined(BACKLASH_SMOOTHING_MM)
2262
         #if ENABLED(BACKLASH_GCODE) && defined(BACKLASH_SMOOTHING_MM)

+ 1
- 1
Marlin/src/module/stepper.h View File

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

+ 1
- 4
Marlin/src/module/tool_change.cpp View File

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

Loading…
Cancel
Save