Browse Source

🎨 Misc code and spacing cleanup

Scott Lahteine 2 years ago
parent
commit
536cf287a6

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

@@ -88,7 +88,7 @@ extern uint8_t marlin_debug_flags;
88 88
 #if HAS_MULTI_SERIAL
89 89
   #define _PORT_REDIRECT(n,p) REMEMBER(n,multiSerial.portMask,p)
90 90
   #define _PORT_RESTORE(n,p)  RESTORE(n)
91
-  #define SERIAL_ASSERT(P)    if(multiSerial.portMask!=(P)){ debugger(); }
91
+  #define SERIAL_ASSERT(P)    if (multiSerial.portMask!=(P)) { debugger(); }
92 92
   // If we have a catchall, use that directly
93 93
   #ifdef SERIAL_CATCHALL
94 94
     #define _SERIAL_LEAF_2 SERIAL_CATCHALL

+ 6
- 8
Marlin/src/feature/mixing.cpp View File

@@ -169,14 +169,12 @@ void Mixer::refresh_collector(const float proportion/*=1.0*/, const uint8_t t/*=
169 169
   #include "../module/planner.h"
170 170
 
171 171
   gradient_t Mixer::gradient = {
172
-    false,    // enabled
173
-    {0},      // color (array)
174
-    0, 0,     // start_z, end_z
175
-    0, 1,     // start_vtool, end_vtool
176
-    {0}, {0}  // start_mix[], end_mix[]
177
-    #if ENABLED(GRADIENT_VTOOL)
178
-      , -1    // vtool_index
179
-    #endif
172
+    false,                      // enabled
173
+    {0},                        // color (array)
174
+    0, 0,                       // start_z, end_z
175
+    0, 1,                       // start_vtool, end_vtool
176
+    {0}, {0}                    // start_mix[], end_mix[]
177
+    OPTARG(GRADIENT_VTOOL, -1)  // vtool_index
180 178
   };
181 179
 
182 180
   float Mixer::prev_z; // = 0

+ 5
- 4
Marlin/src/feature/pause.cpp View File

@@ -191,13 +191,14 @@ bool load_filament(const_float_t slow_load_length/*=0*/, const_float_t fast_load
191 191
 
192 192
     KEEPALIVE_STATE(PAUSED_FOR_USER);
193 193
     wait_for_user = true;    // LCD click or M108 will clear this
194
+
195
+    TERN_(EXTENSIBLE_UI, ExtUI::onUserConfirmRequired_P(PSTR("Load Filament")));
196
+
194 197
     #if ENABLED(HOST_PROMPT_SUPPORT)
195 198
       const char tool = '0' + TERN0(MULTI_FILAMENT_SENSOR, active_extruder);
196 199
       host_prompt_do(PROMPT_USER_CONTINUE, PSTR("Load Filament T"), tool, CONTINUE_STR);
197 200
     #endif
198 201
 
199
-    TERN_(EXTENSIBLE_UI, ExtUI::onUserConfirmRequired_P(PSTR("Load Filament")));
200
-
201 202
     while (wait_for_user) {
202 203
       impatient_beep(max_beep_count);
203 204
       idle_no_sleep();
@@ -237,8 +238,8 @@ bool load_filament(const_float_t slow_load_length/*=0*/, const_float_t fast_load
237 238
 
238 239
     if (show_lcd) ui.pause_show_message(PAUSE_MESSAGE_PURGE);
239 240
 
240
-    TERN_(HOST_PROMPT_SUPPORT, host_prompt_do(PROMPT_USER_CONTINUE, PSTR("Filament Purging..."), CONTINUE_STR));
241 241
     TERN_(EXTENSIBLE_UI, ExtUI::onUserConfirmRequired_P(PSTR("Filament Purging...")));
242
+    TERN_(HOST_PROMPT_SUPPORT, host_prompt_do(PROMPT_USER_CONTINUE, PSTR("Filament Purging..."), CONTINUE_STR));
242 243
     wait_for_user = true; // A click or M108 breaks the purge_length loop
243 244
     for (float purge_count = purge_length; purge_count > 0 && wait_for_user; --purge_count)
244 245
       unscaled_e_move(1, ADVANCED_PAUSE_PURGE_FEEDRATE);
@@ -272,7 +273,7 @@ bool load_filament(const_float_t slow_load_length/*=0*/, const_float_t fast_load
272 273
       #endif
273 274
 
274 275
       // Keep looping if "Purge More" was selected
275
-    } while (TERN0(M600_PURGE_MORE_RESUMABLE, show_lcd && pause_menu_response == PAUSE_RESPONSE_EXTRUDE_MORE));
276
+    } while (TERN0(M600_PURGE_MORE_RESUMABLE, pause_menu_response == PAUSE_RESPONSE_EXTRUDE_MORE));
276 277
 
277 278
   #endif
278 279
   TERN_(HOST_PROMPT_SUPPORT, host_action_prompt_end());

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

@@ -38,16 +38,12 @@ int16_t ProbeTempComp::z_offsets_probe[cali_info_init[TSI_PROBE].measurements],
38 38
 
39 39
 int16_t *ProbeTempComp::sensor_z_offsets[TSI_COUNT] = {
40 40
   ProbeTempComp::z_offsets_probe, ProbeTempComp::z_offsets_bed
41
-  #if ENABLED(USE_TEMP_EXT_COMPENSATION)
42
-    , ProbeTempComp::z_offsets_ext
43
-  #endif
41
+  OPTARG(USE_TEMP_EXT_COMPENSATION, ProbeTempComp::z_offsets_ext)
44 42
 };
45 43
 
46 44
 const temp_calib_t ProbeTempComp::cali_info[TSI_COUNT] = {
47 45
   cali_info_init[TSI_PROBE], cali_info_init[TSI_BED]
48
-  #if ENABLED(USE_TEMP_EXT_COMPENSATION)
49
-    , cali_info_init[TSI_EXT]
50
-  #endif
46
+  OPTARG(USE_TEMP_EXT_COMPENSATION, cali_info_init[TSI_EXT])
51 47
 };
52 48
 
53 49
 constexpr xyz_pos_t ProbeTempComp::park_point;

+ 1
- 3
Marlin/src/gcode/bedlevel/abl/G29.cpp View File

@@ -878,9 +878,7 @@ G29_TYPE GcodeSuite::G29() {
878 878
   // Sync the planner from the current_position
879 879
   if (planner.leveling_active) sync_plan_position();
880 880
 
881
-  #if HAS_BED_PROBE
882
-    probe.move_z_after_probing();
883
-  #endif
881
+  TERN_(HAS_BED_PROBE, probe.move_z_after_probing());
884 882
 
885 883
   #ifdef Z_PROBE_END_SCRIPT
886 884
     if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPAIR("Z Probe End Script: ", Z_PROBE_END_SCRIPT);

+ 2
- 11
Marlin/src/gcode/feature/camera/M240.cpp View File

@@ -135,17 +135,8 @@ void GcodeSuite::M240() {
135 135
     };
136 136
 
137 137
     #ifdef PHOTO_RETRACT_MM
138
-      const float rval = parser.seenval('R') ? parser.value_linear_units() : _PHOTO_RETRACT_MM;
139
-      feedRate_t sval = (
140
-        #if ENABLED(ADVANCED_PAUSE_FEATURE)
141
-          PAUSE_PARK_RETRACT_FEEDRATE
142
-        #elif ENABLED(FWRETRACT)
143
-          RETRACT_FEEDRATE
144
-        #else
145
-          45
146
-        #endif
147
-      );
148
-      if (parser.seenval('S')) sval = parser.value_feedrate();
138
+      const float rval = parser.linearval('R', _PHOTO_RETRACT_MM);
139
+      const feedRate_t sval = parser.feedrateval('S', TERN(ADVANCED_PAUSE_FEATURE, PAUSE_PARK_RETRACT_FEEDRATE, TERN(FWRETRACT, RETRACT_FEEDRATE, 45)));
149 140
       e_move_m240(-rval, sval);
150 141
     #endif
151 142
 

+ 1
- 10
Marlin/src/gcode/feature/fwretract/G10_G11.cpp View File

@@ -32,16 +32,7 @@
32 32
  * G10 - Retract filament according to settings of M207
33 33
  *       TODO: Handle 'G10 P' for tool settings and 'G10 L' for workspace settings
34 34
  */
35
-void GcodeSuite::G10() {
36
-  #if HAS_MULTI_EXTRUDER
37
-    const bool rs = parser.boolval('S');
38
-  #endif
39
-  fwretract.retract(true
40
-    #if HAS_MULTI_EXTRUDER
41
-      , rs
42
-    #endif
43
-  );
44
-}
35
+void GcodeSuite::G10() { fwretract.retract(true OPTARG(HAS_MULTI_EXTRUDER, parser.boolval('S'))); }
45 36
 
46 37
 /**
47 38
  * G11 - Recover filament according to settings of M208

+ 1
- 3
Marlin/src/gcode/feature/pause/M701_M702.cpp View File

@@ -114,9 +114,7 @@ void GcodeSuite::M701() {
114 114
       true,                                           // show_lcd
115 115
       thermalManager.still_heating(target_extruder),  // pause_for_user
116 116
       PAUSE_MODE_LOAD_FILAMENT                        // pause_mode
117
-      #if ENABLED(DUAL_X_CARRIAGE)
118
-        , target_extruder                             // Dual X target
119
-      #endif
117
+      OPTARG(DUAL_X_CARRIAGE, target_extruder)        // Dual X target
120 118
     );
121 119
   #endif
122 120
 

+ 2
- 1
Marlin/src/gcode/parser.h View File

@@ -416,7 +416,8 @@ public:
416 416
   static inline float     linearval(const char c, const float dval=0)    { return seenval(c) ? value_linear_units() : dval; }
417 417
   static inline float     axisunitsval(const char c, const AxisEnum a, const float dval=0)
418 418
                                                                          { return seenval(c) ? value_axis_units(a)  : dval; }
419
-  static inline celsius_t celsiusval(const char c, const float dval=0)   { return seenval(c) ? value_celsius()      : dval; }
419
+  static inline celsius_t celsiusval(const char c, const celsius_t dval=0)    { return seenval(c) ? value_celsius() : dval; }
420
+  static inline feedRate_t feedrateval(const char c, const feedRate_t dval=0) { return seenval(c) ? value_feedrate() : dval; }
420 421
 
421 422
   #if ENABLED(MARLIN_DEV_MODE)
422 423
 

+ 2
- 10
Marlin/src/gcode/queue.cpp View File

@@ -118,11 +118,7 @@ bool GCodeQueue::RingBuffer::enqueue(const char *cmd, bool skip_ok/*=true*/
118 118
 ) {
119 119
   if (*cmd == ';' || length >= BUFSIZE) return false;
120 120
   strcpy(commands[index_w].buffer, cmd);
121
-  commit_command(skip_ok
122
-    #if HAS_MULTI_SERIAL
123
-      , serial_ind
124
-    #endif
125
-  );
121
+  commit_command(skip_ok OPTARG(HAS_MULTI_SERIAL, serial_ind));
126 122
   return true;
127 123
 }
128 124
 
@@ -538,11 +534,7 @@ void GCodeQueue::get_serial_commands() {
538 534
         #endif
539 535
 
540 536
         // Add the command to the queue
541
-        ring_buffer.enqueue(serial.line_buffer, false
542
-          #if HAS_MULTI_SERIAL
543
-            , p
544
-          #endif
545
-        );
537
+        ring_buffer.enqueue(serial.line_buffer, false OPTARG(HAS_MULTI_SERIAL, p));
546 538
       }
547 539
       else
548 540
         process_stream_char(serial_char, serial.input_state, serial.line_buffer, serial.count);

+ 6
- 6
Marlin/src/inc/Version.h View File

@@ -105,18 +105,18 @@
105 105
  * Currently only supported by DUE platform
106 106
  */
107 107
 #ifndef USB_DEVICE_VENDOR_ID
108
-  #define  USB_DEVICE_VENDOR_ID           0x03EB /* ATMEL VID */
108
+  #define USB_DEVICE_VENDOR_ID            0x03EB /* ATMEL VID */
109 109
 #endif
110 110
 #ifndef USB_DEVICE_PRODUCT_ID
111
-  #define  USB_DEVICE_PRODUCT_ID          0x2424 /* MSC / CDC */
111
+  #define USB_DEVICE_PRODUCT_ID           0x2424 /* MSC / CDC */
112 112
 #endif
113 113
 //! USB Device string definitions (Optional)
114 114
 #ifndef USB_DEVICE_MANUFACTURE_NAME
115
-  #define  USB_DEVICE_MANUFACTURE_NAME    WEBSITE_URL
115
+  #define USB_DEVICE_MANUFACTURE_NAME     WEBSITE_URL
116 116
 #endif
117 117
 #ifdef CUSTOM_MACHINE_NAME
118
-  #define  USB_DEVICE_PRODUCT_NAME        CUSTOM_MACHINE_NAME
118
+  #define USB_DEVICE_PRODUCT_NAME         CUSTOM_MACHINE_NAME
119 119
 #else
120
-  #define  USB_DEVICE_PRODUCT_NAME        MACHINE_NAME
120
+  #define USB_DEVICE_PRODUCT_NAME         MACHINE_NAME
121 121
 #endif
122
-#define  USB_DEVICE_SERIAL_NAME           "123985739853"
122
+#define USB_DEVICE_SERIAL_NAME            "123985739853"

+ 1
- 3
Marlin/src/lcd/dogm/u8g_dev_tft_upscale_from_128x64.cpp View File

@@ -390,9 +390,7 @@ uint8_t u8g_dev_tft_320x240_upscale_from_128x64_fn(u8g_t *u8g, u8g_dev_t *dev, u
390 390
 
391 391
       LOOP_L_N(y, PAGE_HEIGHT) {
392 392
         uint32_t k = 0;
393
-        #if HAS_LCD_IO
394
-          buffer = (y & 1) ? bufferB : bufferA;
395
-        #endif
393
+        TERN_(HAS_LCD_IO, buffer = (y & 1) ? bufferB : bufferA);
396 394
         for (uint16_t i = 0; i < (uint32_t)pb->width; i++) {
397 395
           const uint8_t b = *(((uint8_t *)pb->buf) + i);
398 396
           const uint16_t c = TEST(b, y) ? TFT_MARLINUI_COLOR : TFT_MARLINBG_COLOR;

+ 1
- 1
Marlin/src/lcd/extui/dgus/dgus_extui.cpp View File

@@ -64,7 +64,7 @@ namespace ExtUI {
64 64
       ScreenHandler.SetupConfirmAction(setUserConfirmed);
65 65
       ScreenHandler.GotoScreen(DGUSLCD_SCREEN_POPUP);
66 66
     }
67
-    else if (ScreenHandler.getCurrentScreen() == DGUSLCD_SCREEN_POPUP ) {
67
+    else if (ScreenHandler.getCurrentScreen() == DGUSLCD_SCREEN_POPUP) {
68 68
       ScreenHandler.SetupConfirmAction(nullptr);
69 69
       ScreenHandler.PopToOldScreen();
70 70
     }

+ 1
- 3
Marlin/src/lcd/menu/menu_advanced.cpp View File

@@ -569,9 +569,7 @@ void menu_advanced_settings() {
569 569
       SUBMENU(MSG_JERK, menu_advanced_jerk);
570 570
     #elif HAS_JUNCTION_DEVIATION
571 571
       EDIT_ITEM(float43, MSG_JUNCTION_DEVIATION, &planner.junction_deviation_mm, 0.001f, 0.3f
572
-        #if ENABLED(LIN_ADVANCE)
573
-          , planner.recalculate_max_e_jerk
574
-        #endif
572
+        OPTARG(LIN_ADVANCE, planner.recalculate_max_e_jerk)
575 573
       );
576 574
     #endif
577 575
 

+ 1
- 3
Marlin/src/lcd/menu/menu_ubl.cpp View File

@@ -192,9 +192,7 @@ void _lcd_ubl_edit_mesh() {
192 192
     char ubl_lcd_gcode[20];
193 193
     sprintf_P(ubl_lcd_gcode, PSTR("G28\nG26CPH%" PRIi16 TERN_(HAS_HEATED_BED, "B%" PRIi16))
194 194
       , custom_hotend_temp
195
-      #if HAS_HEATED_BED
196
-        , custom_bed_temp
197
-      #endif
195
+      OPTARG(HAS_HEATED_BED, custom_bed_temp)
198 196
     );
199 197
     queue.inject(ubl_lcd_gcode);
200 198
   }

+ 10
- 34
Marlin/src/module/planner.cpp View File

@@ -1388,9 +1388,7 @@ void Planner::check_axes_activity() {
1388 1388
   // Update Fan speeds
1389 1389
   // Only if synchronous M106/M107 is disabled
1390 1390
   //
1391
-  #if HAS_TAIL_FAN_SPEED
1392
-    sync_fan_speeds(tail_fan_speed);
1393
-  #endif
1391
+  TERN_(HAS_TAIL_FAN_SPEED, sync_fan_speeds(tail_fan_speed));
1394 1392
 
1395 1393
   TERN_(AUTOTEMP, autotemp_task());
1396 1394
 
@@ -1585,11 +1583,7 @@ void Planner::check_axes_activity() {
1585 1583
 
1586 1584
       raw.z += (
1587 1585
         #if ENABLED(MESH_BED_LEVELING)
1588
-          mbl.get_z(raw
1589
-            #if ENABLED(ENABLE_LEVELING_FADE_HEIGHT)
1590
-              , fade_scaling_factor
1591
-            #endif
1592
-          )
1586
+          mbl.get_z(raw OPTARG(ENABLE_LEVELING_FADE_HEIGHT, fade_scaling_factor))
1593 1587
         #elif ENABLED(AUTO_BED_LEVELING_UBL)
1594 1588
           fade_scaling_factor ? fade_scaling_factor * ubl.get_z_correction(raw) : 0.0
1595 1589
         #elif ENABLED(AUTO_BED_LEVELING_BILINEAR)
@@ -1622,11 +1616,7 @@ void Planner::check_axes_activity() {
1622 1616
 
1623 1617
         raw.z -= (
1624 1618
           #if ENABLED(MESH_BED_LEVELING)
1625
-            mbl.get_z(raw
1626
-              #if ENABLED(ENABLE_LEVELING_FADE_HEIGHT)
1627
-                , fade_scaling_factor
1628
-              #endif
1629
-            )
1619
+            mbl.get_z(raw OPTARG(ENABLE_LEVELING_FADE_HEIGHT, fade_scaling_factor))
1630 1620
           #elif ENABLED(AUTO_BED_LEVELING_UBL)
1631 1621
             fade_scaling_factor ? fade_scaling_factor * ubl.get_z_correction(raw) : 0.0
1632 1622
           #elif ENABLED(AUTO_BED_LEVELING_BILINEAR)
@@ -1811,12 +1801,8 @@ bool Planner::_buffer_steps(const xyze_long_t &target
1811 1801
 
1812 1802
   // Fill the block with the specified movement
1813 1803
   if (!_populate_block(block, false, target
1814
-    #if HAS_POSITION_FLOAT
1815
-      , target_float
1816
-    #endif
1817
-    #if HAS_DIST_MM_ARG
1818
-      , cart_dist_mm
1819
-    #endif
1804
+    OPTARG(HAS_POSITION_FLOAT, target_float)
1805
+    OPTARG(HAS_DIST_MM_ARG, cart_dist_mm)
1820 1806
     , fr_mm_s, extruder, millimeters
1821 1807
   )) {
1822 1808
     // Movement was not queued, probably because it was too short.
@@ -1975,9 +1961,7 @@ bool Planner::_populate_block(block_t * const block, bool split_move,
1975 1961
     #endif
1976 1962
   #endif
1977 1963
 
1978
-  #if HAS_EXTRUDERS
1979
-    if (de < 0) SBI(dm, E_AXIS);
1980
-  #endif
1964
+  TERN_(HAS_EXTRUDERS, if (de < 0) SBI(dm, E_AXIS));
1981 1965
 
1982 1966
   #if HAS_EXTRUDERS
1983 1967
     const float esteps_float = de * e_factor[extruder];
@@ -2075,9 +2059,7 @@ bool Planner::_populate_block(block_t * const block, bool split_move,
2075 2059
     );
2076 2060
   #endif
2077 2061
 
2078
-  #if HAS_EXTRUDERS
2079
-    steps_dist_mm.e = esteps_float * steps_to_mm[E_AXIS_N(extruder)];
2080
-  #endif
2062
+  TERN_(HAS_EXTRUDERS, steps_dist_mm.e = esteps_float * steps_to_mm[E_AXIS_N(extruder)]);
2081 2063
 
2082 2064
   TERN_(LCD_SHOW_E_TOTAL, e_move_accumulator += steps_dist_mm.e);
2083 2065
 
@@ -2162,9 +2144,7 @@ bool Planner::_populate_block(block_t * const block, bool split_move,
2162 2144
     block->e_to_p_pressure = baricuda_e_to_p_pressure;
2163 2145
   #endif
2164 2146
 
2165
-  #if HAS_MULTI_EXTRUDER
2166
-    block->extruder = extruder;
2167
-  #endif
2147
+  TERN_(HAS_MULTI_EXTRUDER, block->extruder = extruder);
2168 2148
 
2169 2149
   #if ENABLED(AUTO_POWER_CONTROL)
2170 2150
     if (LINEAR_AXIS_GANG(
@@ -2986,12 +2966,8 @@ bool Planner::buffer_segment(const abce_pos_t &abce
2986 2966
 
2987 2967
   // Queue the movement. Return 'false' if the move was not queued.
2988 2968
   if (!_buffer_steps(target
2989
-      #if HAS_POSITION_FLOAT
2990
-        , target_float
2991
-      #endif
2992
-      #if HAS_DIST_MM_ARG
2993
-        , cart_dist_mm
2994
-      #endif
2969
+      OPTARG(HAS_POSITION_FLOAT, target_float)
2970
+      OPTARG(HAS_DIST_MM_ARG, cart_dist_mm)
2995 2971
       , fr_mm_s, extruder, millimeters)
2996 2972
   ) return false;
2997 2973
 

+ 2
- 6
Marlin/src/module/settings.cpp View File

@@ -2555,9 +2555,7 @@ void MarlinSettings::reset() {
2555 2555
     TERN_(HAS_CLASSIC_E_JERK, planner.max_jerk.e = DEFAULT_EJERK);
2556 2556
   #endif
2557 2557
 
2558
-  #if HAS_JUNCTION_DEVIATION
2559
-    planner.junction_deviation_mm = float(JUNCTION_DEVIATION_MM);
2560
-  #endif
2558
+  TERN_(HAS_JUNCTION_DEVIATION, planner.junction_deviation_mm = float(JUNCTION_DEVIATION_MM));
2561 2559
 
2562 2560
   #if HAS_SCARA_OFFSET
2563 2561
     scara_home_offset.reset();
@@ -3151,9 +3149,7 @@ void MarlinSettings::reset() {
3151 3149
 
3152 3150
     CONFIG_ECHO_HEADING(
3153 3151
       "Advanced: B<min_segment_time_us> S<min_feedrate> T<min_travel_feedrate>"
3154
-      #if HAS_JUNCTION_DEVIATION
3155
-        " J<junc_dev>"
3156
-      #endif
3152
+      TERN_(HAS_JUNCTION_DEVIATION, " J<junc_dev>")
3157 3153
       #if HAS_CLASSIC_JERK
3158 3154
         " X<max_x_jerk> Y<max_y_jerk> Z<max_z_jerk>"
3159 3155
         TERN_(HAS_CLASSIC_E_JERK, " E<max_e_jerk>")

+ 3
- 7
Marlin/src/module/stepper.cpp View File

@@ -1428,14 +1428,10 @@ void Stepper::isr() {
1428 1428
 
1429 1429
     // Get the interval to the next ISR call
1430 1430
     const uint32_t interval = _MIN(
1431
+      uint32_t(HAL_TIMER_TYPE_MAX),                     // Come back in a very long time
1431 1432
       nextMainISR                                       // Time until the next Pulse / Block phase
1432
-      #if ENABLED(LIN_ADVANCE)
1433
-        , nextAdvanceISR                                // Come back early for Linear Advance?
1434
-      #endif
1435
-      #if ENABLED(INTEGRATED_BABYSTEPPING)
1436
-        , nextBabystepISR                               // Come back early for Babystepping?
1437
-      #endif
1438
-      , uint32_t(HAL_TIMER_TYPE_MAX)                    // Come back in a very long time
1433
+      OPTARG(LIN_ADVANCE, nextAdvanceISR)               // Come back early for Linear Advance?
1434
+      OPTARG(INTEGRATED_BABYSTEPPING, nextBabystepISR)  // Come back early for Babystepping?
1439 1435
     );
1440 1436
 
1441 1437
     //

+ 15
- 15
Marlin/src/module/stepper/trinamic.h View File

@@ -121,7 +121,7 @@ void reset_trinamic_drivers();
121 121
     #define X_ENABLE_READ() stepperX.isEnabled()
122 122
   #endif
123 123
   #if AXIS_HAS_SQUARE_WAVE(X)
124
-    #define X_STEP_WRITE(STATE) do{ if(STATE) TOGGLE(X_STEP_PIN); }while(0)
124
+    #define X_STEP_WRITE(STATE) do{ if (STATE) TOGGLE(X_STEP_PIN); }while(0)
125 125
   #endif
126 126
 #endif
127 127
 
@@ -149,7 +149,7 @@ void reset_trinamic_drivers();
149 149
     #define Z_ENABLE_READ() stepperZ.isEnabled()
150 150
   #endif
151 151
   #if AXIS_HAS_SQUARE_WAVE(Z)
152
-    #define Z_STEP_WRITE(STATE) do{ if(STATE) TOGGLE(Z_STEP_PIN); }while(0)
152
+    #define Z_STEP_WRITE(STATE) do{ if (STATE) TOGGLE(Z_STEP_PIN); }while(0)
153 153
   #endif
154 154
 #endif
155 155
 
@@ -166,7 +166,7 @@ void reset_trinamic_drivers();
166 166
     #define X2_ENABLE_READ() stepperX2.isEnabled()
167 167
   #endif
168 168
   #if AXIS_HAS_SQUARE_WAVE(X2)
169
-    #define X2_STEP_WRITE(STATE) do{ if(STATE) TOGGLE(X2_STEP_PIN); }while(0)
169
+    #define X2_STEP_WRITE(STATE) do{ if (STATE) TOGGLE(X2_STEP_PIN); }while(0)
170 170
   #endif
171 171
 #endif
172 172
 
@@ -183,7 +183,7 @@ void reset_trinamic_drivers();
183 183
     #define Y2_ENABLE_READ() stepperY2.isEnabled()
184 184
   #endif
185 185
   #if AXIS_HAS_SQUARE_WAVE(Y2)
186
-    #define Y2_STEP_WRITE(STATE) do{ if(STATE) TOGGLE(Y2_STEP_PIN); }while(0)
186
+    #define Y2_STEP_WRITE(STATE) do{ if (STATE) TOGGLE(Y2_STEP_PIN); }while(0)
187 187
   #endif
188 188
 #endif
189 189
 
@@ -200,7 +200,7 @@ void reset_trinamic_drivers();
200 200
     #define Z2_ENABLE_READ() stepperZ2.isEnabled()
201 201
   #endif
202 202
   #if AXIS_HAS_SQUARE_WAVE(Z2)
203
-    #define Z2_STEP_WRITE(STATE) do{ if(STATE) TOGGLE(Z2_STEP_PIN); }while(0)
203
+    #define Z2_STEP_WRITE(STATE) do{ if (STATE) TOGGLE(Z2_STEP_PIN); }while(0)
204 204
   #endif
205 205
 #endif
206 206
 
@@ -217,7 +217,7 @@ void reset_trinamic_drivers();
217 217
     #define Z3_ENABLE_READ() stepperZ3.isEnabled()
218 218
   #endif
219 219
   #if AXIS_HAS_SQUARE_WAVE(Z3)
220
-    #define Z3_STEP_WRITE(STATE) do{ if(STATE) TOGGLE(Z3_STEP_PIN); }while(0)
220
+    #define Z3_STEP_WRITE(STATE) do{ if (STATE) TOGGLE(Z3_STEP_PIN); }while(0)
221 221
   #endif
222 222
 #endif
223 223
 
@@ -234,7 +234,7 @@ void reset_trinamic_drivers();
234 234
     #define Z4_ENABLE_READ() stepperZ4.isEnabled()
235 235
   #endif
236 236
   #if AXIS_HAS_SQUARE_WAVE(Z4)
237
-    #define Z4_STEP_WRITE(STATE) do{ if(STATE) TOGGLE(Z4_STEP_PIN); }while(0)
237
+    #define Z4_STEP_WRITE(STATE) do{ if (STATE) TOGGLE(Z4_STEP_PIN); }while(0)
238 238
   #endif
239 239
 #endif
240 240
 
@@ -293,7 +293,7 @@ void reset_trinamic_drivers();
293 293
     #define E0_ENABLE_READ() stepperE0.isEnabled()
294 294
   #endif
295 295
   #if AXIS_HAS_SQUARE_WAVE(E0)
296
-    #define E0_STEP_WRITE(STATE) do{ if(STATE) TOGGLE(E0_STEP_PIN); }while(0)
296
+    #define E0_STEP_WRITE(STATE) do{ if (STATE) TOGGLE(E0_STEP_PIN); }while(0)
297 297
   #endif
298 298
 #endif
299 299
 
@@ -310,7 +310,7 @@ void reset_trinamic_drivers();
310 310
     #define E1_ENABLE_READ() stepperE1.isEnabled()
311 311
   #endif
312 312
   #if AXIS_HAS_SQUARE_WAVE(E1)
313
-    #define E1_STEP_WRITE(STATE) do{ if(STATE) TOGGLE(E1_STEP_PIN); }while(0)
313
+    #define E1_STEP_WRITE(STATE) do{ if (STATE) TOGGLE(E1_STEP_PIN); }while(0)
314 314
   #endif
315 315
 #endif
316 316
 
@@ -327,7 +327,7 @@ void reset_trinamic_drivers();
327 327
     #define E2_ENABLE_READ() stepperE2.isEnabled()
328 328
   #endif
329 329
   #if AXIS_HAS_SQUARE_WAVE(E2)
330
-    #define E2_STEP_WRITE(STATE) do{ if(STATE) TOGGLE(E2_STEP_PIN); }while(0)
330
+    #define E2_STEP_WRITE(STATE) do{ if (STATE) TOGGLE(E2_STEP_PIN); }while(0)
331 331
   #endif
332 332
 #endif
333 333
 
@@ -344,7 +344,7 @@ void reset_trinamic_drivers();
344 344
     #define E3_ENABLE_READ() stepperE3.isEnabled()
345 345
   #endif
346 346
   #if AXIS_HAS_SQUARE_WAVE(E3)
347
-    #define E3_STEP_WRITE(STATE) do{ if(STATE) TOGGLE(E3_STEP_PIN); }while(0)
347
+    #define E3_STEP_WRITE(STATE) do{ if (STATE) TOGGLE(E3_STEP_PIN); }while(0)
348 348
   #endif
349 349
 #endif
350 350
 
@@ -361,7 +361,7 @@ void reset_trinamic_drivers();
361 361
     #define E4_ENABLE_READ() stepperE4.isEnabled()
362 362
   #endif
363 363
   #if AXIS_HAS_SQUARE_WAVE(E4)
364
-    #define E4_STEP_WRITE(STATE) do{ if(STATE) TOGGLE(E4_STEP_PIN); }while(0)
364
+    #define E4_STEP_WRITE(STATE) do{ if (STATE) TOGGLE(E4_STEP_PIN); }while(0)
365 365
   #endif
366 366
 #endif
367 367
 
@@ -378,7 +378,7 @@ void reset_trinamic_drivers();
378 378
     #define E5_ENABLE_READ() stepperE5.isEnabled()
379 379
   #endif
380 380
   #if AXIS_HAS_SQUARE_WAVE(E5)
381
-    #define E5_STEP_WRITE(STATE) do{ if(STATE) TOGGLE(E5_STEP_PIN); }while(0)
381
+    #define E5_STEP_WRITE(STATE) do{ if (STATE) TOGGLE(E5_STEP_PIN); }while(0)
382 382
   #endif
383 383
 #endif
384 384
 
@@ -395,7 +395,7 @@ void reset_trinamic_drivers();
395 395
     #define E6_ENABLE_READ() stepperE6.isEnabled()
396 396
   #endif
397 397
   #if AXIS_HAS_SQUARE_WAVE(E6)
398
-    #define E6_STEP_WRITE(STATE) do{ if(STATE) TOGGLE(E6_STEP_PIN); }while(0)
398
+    #define E6_STEP_WRITE(STATE) do{ if (STATE) TOGGLE(E6_STEP_PIN); }while(0)
399 399
   #endif
400 400
 #endif
401 401
 
@@ -412,6 +412,6 @@ void reset_trinamic_drivers();
412 412
     #define E7_ENABLE_READ() stepperE7.isEnabled()
413 413
   #endif
414 414
   #if AXIS_HAS_SQUARE_WAVE(E7)
415
-    #define E7_STEP_WRITE(STATE) do{ if(STATE) TOGGLE(E7_STEP_PIN); }while(0)
415
+    #define E7_STEP_WRITE(STATE) do{ if (STATE) TOGGLE(E7_STEP_PIN); }while(0)
416 416
   #endif
417 417
 #endif

+ 4
- 6
Marlin/src/module/temperature.cpp View File

@@ -2288,9 +2288,7 @@ void Temperature::init() {
2288 2288
     INIT_FAN_PIN(CONTROLLER_FAN_PIN);
2289 2289
   #endif
2290 2290
 
2291
-  #if HAS_MAXTC_SW_SPI
2292
-    max_tc_spi.init();
2293
-  #endif
2291
+  TERN_(HAS_MAXTC_SW_SPI, max_tc_spi.init());
2294 2292
 
2295 2293
   HAL_adc_init();
2296 2294
 
@@ -3037,15 +3035,15 @@ void Temperature::isr() {
3037 3035
       #endif
3038 3036
 
3039 3037
       #if HAS_HEATED_BED
3040
-        _PWM_MOD(BED,soft_pwm_bed,temp_bed);
3038
+        _PWM_MOD(BED, soft_pwm_bed, temp_bed);
3041 3039
       #endif
3042 3040
 
3043 3041
       #if HAS_HEATED_CHAMBER
3044
-        _PWM_MOD(CHAMBER,soft_pwm_chamber,temp_chamber);
3042
+        _PWM_MOD(CHAMBER, soft_pwm_chamber, temp_chamber);
3045 3043
       #endif
3046 3044
 
3047 3045
       #if HAS_COOLER
3048
-        _PWM_MOD(COOLER,soft_pwm_cooler,temp_cooler);
3046
+        _PWM_MOD(COOLER, soft_pwm_cooler, temp_cooler);
3049 3047
       #endif
3050 3048
 
3051 3049
       #if ENABLED(FAN_SOFT_PWM)

+ 3
- 9
Marlin/src/module/tool_change.cpp View File

@@ -918,9 +918,7 @@ void fast_line_to_current(const AxisEnum fr_axis) { _line_to_current(fr_axis, 0.
918 918
       if (ok) {
919 919
         // Do a small lift to avoid the workpiece in the move back (below)
920 920
         current_position.z += toolchange_settings.z_raise;
921
-        #if HAS_SOFTWARE_ENDSTOPS
922
-          NOMORE(current_position.z, soft_endstop.max.z);
923
-        #endif
921
+        TERN_(HAS_SOFTWARE_ENDSTOPS, NOMORE(current_position.z, soft_endstop.max.z));
924 922
         fast_line_to_current(Z_AXIS);
925 923
         planner.synchronize();
926 924
       }
@@ -1068,9 +1066,7 @@ void tool_change(const uint8_t new_tool, bool no_move/*=false*/) {
1068 1066
         if (can_move_away && TERN1(TOOLCHANGE_PARK, toolchange_settings.enable_park)) {
1069 1067
           // Do a small lift to avoid the workpiece in the move back (below)
1070 1068
           current_position.z += toolchange_settings.z_raise;
1071
-          #if HAS_SOFTWARE_ENDSTOPS
1072
-            NOMORE(current_position.z, soft_endstop.max.z);
1073
-          #endif
1069
+          TERN_(HAS_SOFTWARE_ENDSTOPS, NOMORE(current_position.z, soft_endstop.max.z));
1074 1070
           fast_line_to_current(Z_AXIS);
1075 1071
           planner.synchronize();
1076 1072
         }
@@ -1117,9 +1113,7 @@ void tool_change(const uint8_t new_tool, bool no_move/*=false*/) {
1117 1113
         if (can_move_away && TERN1(TOOLCHANGE_PARK, toolchange_settings.enable_park)) {
1118 1114
           // Do a small lift to avoid the workpiece in the move back (below)
1119 1115
           current_position.z += toolchange_settings.z_raise;
1120
-          #if HAS_SOFTWARE_ENDSTOPS
1121
-            NOMORE(current_position.z, soft_endstop.max.z);
1122
-          #endif
1116
+          TERN_(HAS_SOFTWARE_ENDSTOPS, NOMORE(current_position.z, soft_endstop.max.z));
1123 1117
           fast_line_to_current(Z_AXIS);
1124 1118
         }
1125 1119
       #endif

+ 1
- 1
Marlin/src/sd/usb_flashdrive/lib-uhs2/max3421e.h View File

@@ -67,7 +67,7 @@
67 67
 
68 68
 #define rCPUCTL     0x80    //16<<3
69 69
 /* CPUCTL Bits  */
70
-#define bmPUSLEWID1 0x80    //b7
70
+#define bmPULSEWID1 0x80    //b7
71 71
 #define bmPULSEWID0 0x40    //b6
72 72
 #define bmIE        0x01    //b0
73 73
 

+ 6
- 6
Marlin/src/sd/usb_flashdrive/lib-uhs3/UHS_host/USB_HOST_SHIELD/UHS_max3421e.h View File

@@ -59,19 +59,19 @@ e-mail   :  support@circuitsathome.com
59 59
 
60 60
 // (CPUCTL)
61 61
 #define         rCPUCTL 0x80            //16<<3
62
-#define     bmPUSLEWID1 0x80            //b7
62
+#define     bmPULSEWID1 0x80            //b7
63 63
 #define     bmPULSEWID0 0x40            //b6
64 64
 #define            bmIE 0x01            //b0
65 65
 
66
-// bmPUSLEWID1 bmPULSEWID0 Pulse width
66
+// bmPULSEWID1 bmPULSEWID0 Pulse width
67 67
 // 0           0           10.6uS
68 68
 // 0           1            5.3uS
69 69
 // 1           0            2.6uS
70 70
 // 1           1            1.3uS
71
-#define  PUSLEWIDTH10_6 (0)
72
-#define   PUSLEWIDTH5_3 (bmPULSEWID0)
73
-#define   PUSLEWIDTH2_6 (bmPUSLEWID1)
74
-#define   PUSLEWIDTH1_3 (bmPULSEWID0 | bmPUSLEWID1)
71
+#define  PULSEWIDTH10_6 (0)
72
+#define   PULSEWIDTH5_3 (bmPULSEWID0)
73
+#define   PULSEWIDTH2_6 (bmPULSEWID1)
74
+#define   PULSEWIDTH1_3 (bmPULSEWID0 | bmPULSEWID1)
75 75
 
76 76
 // (PINCTL)
77 77
 #define         rPINCTL 0x88            //17<<3

+ 2
- 2
Marlin/src/sd/usb_flashdrive/lib-uhs3/UHS_host/USB_HOST_SHIELD/USB_HOST_SHIELD.h View File

@@ -272,11 +272,11 @@ e-mail   :  support@circuitsathome.com
272 272
 //
273 273
 #define IRQ_SENSE FALLING
274 274
 #ifdef ARDUINO_ARCH_PIC32
275
-//#define bmPULSEWIDTH PUSLEWIDTH10_6
275
+//#define bmPULSEWIDTH PULSEWIDTH10_6
276 276
 #define bmPULSEWIDTH 0
277 277
 #define bmIRQ_SENSE 0
278 278
 #else
279
-#define bmPULSEWIDTH PUSLEWIDTH1_3
279
+#define bmPULSEWIDTH PULSEWIDTH1_3
280 280
 #define bmIRQ_SENSE 0
281 281
 #endif
282 282
 #else

Loading…
Cancel
Save