Browse Source

🎨 Misc code and spacing cleanup

Scott Lahteine 4 years ago
parent
commit
536cf287a6

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

88
 #if HAS_MULTI_SERIAL
88
 #if HAS_MULTI_SERIAL
89
   #define _PORT_REDIRECT(n,p) REMEMBER(n,multiSerial.portMask,p)
89
   #define _PORT_REDIRECT(n,p) REMEMBER(n,multiSerial.portMask,p)
90
   #define _PORT_RESTORE(n,p)  RESTORE(n)
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
   // If we have a catchall, use that directly
92
   // If we have a catchall, use that directly
93
   #ifdef SERIAL_CATCHALL
93
   #ifdef SERIAL_CATCHALL
94
     #define _SERIAL_LEAF_2 SERIAL_CATCHALL
94
     #define _SERIAL_LEAF_2 SERIAL_CATCHALL

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

169
   #include "../module/planner.h"
169
   #include "../module/planner.h"
170
 
170
 
171
   gradient_t Mixer::gradient = {
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
   float Mixer::prev_z; // = 0
180
   float Mixer::prev_z; // = 0

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

191
 
191
 
192
     KEEPALIVE_STATE(PAUSED_FOR_USER);
192
     KEEPALIVE_STATE(PAUSED_FOR_USER);
193
     wait_for_user = true;    // LCD click or M108 will clear this
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
     #if ENABLED(HOST_PROMPT_SUPPORT)
197
     #if ENABLED(HOST_PROMPT_SUPPORT)
195
       const char tool = '0' + TERN0(MULTI_FILAMENT_SENSOR, active_extruder);
198
       const char tool = '0' + TERN0(MULTI_FILAMENT_SENSOR, active_extruder);
196
       host_prompt_do(PROMPT_USER_CONTINUE, PSTR("Load Filament T"), tool, CONTINUE_STR);
199
       host_prompt_do(PROMPT_USER_CONTINUE, PSTR("Load Filament T"), tool, CONTINUE_STR);
197
     #endif
200
     #endif
198
 
201
 
199
-    TERN_(EXTENSIBLE_UI, ExtUI::onUserConfirmRequired_P(PSTR("Load Filament")));
200
-
201
     while (wait_for_user) {
202
     while (wait_for_user) {
202
       impatient_beep(max_beep_count);
203
       impatient_beep(max_beep_count);
203
       idle_no_sleep();
204
       idle_no_sleep();
237
 
238
 
238
     if (show_lcd) ui.pause_show_message(PAUSE_MESSAGE_PURGE);
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
     TERN_(EXTENSIBLE_UI, ExtUI::onUserConfirmRequired_P(PSTR("Filament Purging...")));
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
     wait_for_user = true; // A click or M108 breaks the purge_length loop
243
     wait_for_user = true; // A click or M108 breaks the purge_length loop
243
     for (float purge_count = purge_length; purge_count > 0 && wait_for_user; --purge_count)
244
     for (float purge_count = purge_length; purge_count > 0 && wait_for_user; --purge_count)
244
       unscaled_e_move(1, ADVANCED_PAUSE_PURGE_FEEDRATE);
245
       unscaled_e_move(1, ADVANCED_PAUSE_PURGE_FEEDRATE);
272
       #endif
273
       #endif
273
 
274
 
274
       // Keep looping if "Purge More" was selected
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
   #endif
278
   #endif
278
   TERN_(HOST_PROMPT_SUPPORT, host_action_prompt_end());
279
   TERN_(HOST_PROMPT_SUPPORT, host_action_prompt_end());

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

38
 
38
 
39
 int16_t *ProbeTempComp::sensor_z_offsets[TSI_COUNT] = {
39
 int16_t *ProbeTempComp::sensor_z_offsets[TSI_COUNT] = {
40
   ProbeTempComp::z_offsets_probe, ProbeTempComp::z_offsets_bed
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
 const temp_calib_t ProbeTempComp::cali_info[TSI_COUNT] = {
44
 const temp_calib_t ProbeTempComp::cali_info[TSI_COUNT] = {
47
   cali_info_init[TSI_PROBE], cali_info_init[TSI_BED]
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
 constexpr xyz_pos_t ProbeTempComp::park_point;
49
 constexpr xyz_pos_t ProbeTempComp::park_point;

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

878
   // Sync the planner from the current_position
878
   // Sync the planner from the current_position
879
   if (planner.leveling_active) sync_plan_position();
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
   #ifdef Z_PROBE_END_SCRIPT
883
   #ifdef Z_PROBE_END_SCRIPT
886
     if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPAIR("Z Probe End Script: ", Z_PROBE_END_SCRIPT);
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
     };
135
     };
136
 
136
 
137
     #ifdef PHOTO_RETRACT_MM
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
       e_move_m240(-rval, sval);
140
       e_move_m240(-rval, sval);
150
     #endif
141
     #endif
151
 
142
 

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

32
  * G10 - Retract filament according to settings of M207
32
  * G10 - Retract filament according to settings of M207
33
  *       TODO: Handle 'G10 P' for tool settings and 'G10 L' for workspace settings
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
  * G11 - Recover filament according to settings of M208
38
  * G11 - Recover filament according to settings of M208

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

114
       true,                                           // show_lcd
114
       true,                                           // show_lcd
115
       thermalManager.still_heating(target_extruder),  // pause_for_user
115
       thermalManager.still_heating(target_extruder),  // pause_for_user
116
       PAUSE_MODE_LOAD_FILAMENT                        // pause_mode
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
   #endif
119
   #endif
122
 
120
 

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

416
   static inline float     linearval(const char c, const float dval=0)    { return seenval(c) ? value_linear_units() : dval; }
416
   static inline float     linearval(const char c, const float dval=0)    { return seenval(c) ? value_linear_units() : dval; }
417
   static inline float     axisunitsval(const char c, const AxisEnum a, const float dval=0)
417
   static inline float     axisunitsval(const char c, const AxisEnum a, const float dval=0)
418
                                                                          { return seenval(c) ? value_axis_units(a)  : dval; }
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
   #if ENABLED(MARLIN_DEV_MODE)
422
   #if ENABLED(MARLIN_DEV_MODE)
422
 
423
 

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

118
 ) {
118
 ) {
119
   if (*cmd == ';' || length >= BUFSIZE) return false;
119
   if (*cmd == ';' || length >= BUFSIZE) return false;
120
   strcpy(commands[index_w].buffer, cmd);
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
   return true;
122
   return true;
127
 }
123
 }
128
 
124
 
538
         #endif
534
         #endif
539
 
535
 
540
         // Add the command to the queue
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
       else
539
       else
548
         process_stream_char(serial_char, serial.input_state, serial.line_buffer, serial.count);
540
         process_stream_char(serial_char, serial.input_state, serial.line_buffer, serial.count);

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

105
  * Currently only supported by DUE platform
105
  * Currently only supported by DUE platform
106
  */
106
  */
107
 #ifndef USB_DEVICE_VENDOR_ID
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
 #endif
109
 #endif
110
 #ifndef USB_DEVICE_PRODUCT_ID
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
 #endif
112
 #endif
113
 //! USB Device string definitions (Optional)
113
 //! USB Device string definitions (Optional)
114
 #ifndef USB_DEVICE_MANUFACTURE_NAME
114
 #ifndef USB_DEVICE_MANUFACTURE_NAME
115
-  #define  USB_DEVICE_MANUFACTURE_NAME    WEBSITE_URL
115
+  #define USB_DEVICE_MANUFACTURE_NAME     WEBSITE_URL
116
 #endif
116
 #endif
117
 #ifdef CUSTOM_MACHINE_NAME
117
 #ifdef CUSTOM_MACHINE_NAME
118
-  #define  USB_DEVICE_PRODUCT_NAME        CUSTOM_MACHINE_NAME
118
+  #define USB_DEVICE_PRODUCT_NAME         CUSTOM_MACHINE_NAME
119
 #else
119
 #else
120
-  #define  USB_DEVICE_PRODUCT_NAME        MACHINE_NAME
120
+  #define USB_DEVICE_PRODUCT_NAME         MACHINE_NAME
121
 #endif
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
 
390
 
391
       LOOP_L_N(y, PAGE_HEIGHT) {
391
       LOOP_L_N(y, PAGE_HEIGHT) {
392
         uint32_t k = 0;
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
         for (uint16_t i = 0; i < (uint32_t)pb->width; i++) {
394
         for (uint16_t i = 0; i < (uint32_t)pb->width; i++) {
397
           const uint8_t b = *(((uint8_t *)pb->buf) + i);
395
           const uint8_t b = *(((uint8_t *)pb->buf) + i);
398
           const uint16_t c = TEST(b, y) ? TFT_MARLINUI_COLOR : TFT_MARLINBG_COLOR;
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
       ScreenHandler.SetupConfirmAction(setUserConfirmed);
64
       ScreenHandler.SetupConfirmAction(setUserConfirmed);
65
       ScreenHandler.GotoScreen(DGUSLCD_SCREEN_POPUP);
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
       ScreenHandler.SetupConfirmAction(nullptr);
68
       ScreenHandler.SetupConfirmAction(nullptr);
69
       ScreenHandler.PopToOldScreen();
69
       ScreenHandler.PopToOldScreen();
70
     }
70
     }

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

569
       SUBMENU(MSG_JERK, menu_advanced_jerk);
569
       SUBMENU(MSG_JERK, menu_advanced_jerk);
570
     #elif HAS_JUNCTION_DEVIATION
570
     #elif HAS_JUNCTION_DEVIATION
571
       EDIT_ITEM(float43, MSG_JUNCTION_DEVIATION, &planner.junction_deviation_mm, 0.001f, 0.3f
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
     #endif
574
     #endif
577
 
575
 

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

192
     char ubl_lcd_gcode[20];
192
     char ubl_lcd_gcode[20];
193
     sprintf_P(ubl_lcd_gcode, PSTR("G28\nG26CPH%" PRIi16 TERN_(HAS_HEATED_BED, "B%" PRIi16))
193
     sprintf_P(ubl_lcd_gcode, PSTR("G28\nG26CPH%" PRIi16 TERN_(HAS_HEATED_BED, "B%" PRIi16))
194
       , custom_hotend_temp
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
     queue.inject(ubl_lcd_gcode);
197
     queue.inject(ubl_lcd_gcode);
200
   }
198
   }

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

1388
   // Update Fan speeds
1388
   // Update Fan speeds
1389
   // Only if synchronous M106/M107 is disabled
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
   TERN_(AUTOTEMP, autotemp_task());
1393
   TERN_(AUTOTEMP, autotemp_task());
1396
 
1394
 
1585
 
1583
 
1586
       raw.z += (
1584
       raw.z += (
1587
         #if ENABLED(MESH_BED_LEVELING)
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
         #elif ENABLED(AUTO_BED_LEVELING_UBL)
1587
         #elif ENABLED(AUTO_BED_LEVELING_UBL)
1594
           fade_scaling_factor ? fade_scaling_factor * ubl.get_z_correction(raw) : 0.0
1588
           fade_scaling_factor ? fade_scaling_factor * ubl.get_z_correction(raw) : 0.0
1595
         #elif ENABLED(AUTO_BED_LEVELING_BILINEAR)
1589
         #elif ENABLED(AUTO_BED_LEVELING_BILINEAR)
1622
 
1616
 
1623
         raw.z -= (
1617
         raw.z -= (
1624
           #if ENABLED(MESH_BED_LEVELING)
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
           #elif ENABLED(AUTO_BED_LEVELING_UBL)
1620
           #elif ENABLED(AUTO_BED_LEVELING_UBL)
1631
             fade_scaling_factor ? fade_scaling_factor * ubl.get_z_correction(raw) : 0.0
1621
             fade_scaling_factor ? fade_scaling_factor * ubl.get_z_correction(raw) : 0.0
1632
           #elif ENABLED(AUTO_BED_LEVELING_BILINEAR)
1622
           #elif ENABLED(AUTO_BED_LEVELING_BILINEAR)
1811
 
1801
 
1812
   // Fill the block with the specified movement
1802
   // Fill the block with the specified movement
1813
   if (!_populate_block(block, false, target
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
     , fr_mm_s, extruder, millimeters
1806
     , fr_mm_s, extruder, millimeters
1821
   )) {
1807
   )) {
1822
     // Movement was not queued, probably because it was too short.
1808
     // Movement was not queued, probably because it was too short.
1975
     #endif
1961
     #endif
1976
   #endif
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
   #if HAS_EXTRUDERS
1966
   #if HAS_EXTRUDERS
1983
     const float esteps_float = de * e_factor[extruder];
1967
     const float esteps_float = de * e_factor[extruder];
2075
     );
2059
     );
2076
   #endif
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
   TERN_(LCD_SHOW_E_TOTAL, e_move_accumulator += steps_dist_mm.e);
2064
   TERN_(LCD_SHOW_E_TOTAL, e_move_accumulator += steps_dist_mm.e);
2083
 
2065
 
2162
     block->e_to_p_pressure = baricuda_e_to_p_pressure;
2144
     block->e_to_p_pressure = baricuda_e_to_p_pressure;
2163
   #endif
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
   #if ENABLED(AUTO_POWER_CONTROL)
2149
   #if ENABLED(AUTO_POWER_CONTROL)
2170
     if (LINEAR_AXIS_GANG(
2150
     if (LINEAR_AXIS_GANG(
2986
 
2966
 
2987
   // Queue the movement. Return 'false' if the move was not queued.
2967
   // Queue the movement. Return 'false' if the move was not queued.
2988
   if (!_buffer_steps(target
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
       , fr_mm_s, extruder, millimeters)
2971
       , fr_mm_s, extruder, millimeters)
2996
   ) return false;
2972
   ) return false;
2997
 
2973
 

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

2555
     TERN_(HAS_CLASSIC_E_JERK, planner.max_jerk.e = DEFAULT_EJERK);
2555
     TERN_(HAS_CLASSIC_E_JERK, planner.max_jerk.e = DEFAULT_EJERK);
2556
   #endif
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
   #if HAS_SCARA_OFFSET
2560
   #if HAS_SCARA_OFFSET
2563
     scara_home_offset.reset();
2561
     scara_home_offset.reset();
3151
 
3149
 
3152
     CONFIG_ECHO_HEADING(
3150
     CONFIG_ECHO_HEADING(
3153
       "Advanced: B<min_segment_time_us> S<min_feedrate> T<min_travel_feedrate>"
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
       #if HAS_CLASSIC_JERK
3153
       #if HAS_CLASSIC_JERK
3158
         " X<max_x_jerk> Y<max_y_jerk> Z<max_z_jerk>"
3154
         " X<max_x_jerk> Y<max_y_jerk> Z<max_z_jerk>"
3159
         TERN_(HAS_CLASSIC_E_JERK, " E<max_e_jerk>")
3155
         TERN_(HAS_CLASSIC_E_JERK, " E<max_e_jerk>")

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

1428
 
1428
 
1429
     // Get the interval to the next ISR call
1429
     // Get the interval to the next ISR call
1430
     const uint32_t interval = _MIN(
1430
     const uint32_t interval = _MIN(
1431
+      uint32_t(HAL_TIMER_TYPE_MAX),                     // Come back in a very long time
1431
       nextMainISR                                       // Time until the next Pulse / Block phase
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
     #define X_ENABLE_READ() stepperX.isEnabled()
121
     #define X_ENABLE_READ() stepperX.isEnabled()
122
   #endif
122
   #endif
123
   #if AXIS_HAS_SQUARE_WAVE(X)
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
   #endif
125
   #endif
126
 #endif
126
 #endif
127
 
127
 
149
     #define Z_ENABLE_READ() stepperZ.isEnabled()
149
     #define Z_ENABLE_READ() stepperZ.isEnabled()
150
   #endif
150
   #endif
151
   #if AXIS_HAS_SQUARE_WAVE(Z)
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
   #endif
153
   #endif
154
 #endif
154
 #endif
155
 
155
 
166
     #define X2_ENABLE_READ() stepperX2.isEnabled()
166
     #define X2_ENABLE_READ() stepperX2.isEnabled()
167
   #endif
167
   #endif
168
   #if AXIS_HAS_SQUARE_WAVE(X2)
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
   #endif
170
   #endif
171
 #endif
171
 #endif
172
 
172
 
183
     #define Y2_ENABLE_READ() stepperY2.isEnabled()
183
     #define Y2_ENABLE_READ() stepperY2.isEnabled()
184
   #endif
184
   #endif
185
   #if AXIS_HAS_SQUARE_WAVE(Y2)
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
   #endif
187
   #endif
188
 #endif
188
 #endif
189
 
189
 
200
     #define Z2_ENABLE_READ() stepperZ2.isEnabled()
200
     #define Z2_ENABLE_READ() stepperZ2.isEnabled()
201
   #endif
201
   #endif
202
   #if AXIS_HAS_SQUARE_WAVE(Z2)
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
   #endif
204
   #endif
205
 #endif
205
 #endif
206
 
206
 
217
     #define Z3_ENABLE_READ() stepperZ3.isEnabled()
217
     #define Z3_ENABLE_READ() stepperZ3.isEnabled()
218
   #endif
218
   #endif
219
   #if AXIS_HAS_SQUARE_WAVE(Z3)
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
   #endif
221
   #endif
222
 #endif
222
 #endif
223
 
223
 
234
     #define Z4_ENABLE_READ() stepperZ4.isEnabled()
234
     #define Z4_ENABLE_READ() stepperZ4.isEnabled()
235
   #endif
235
   #endif
236
   #if AXIS_HAS_SQUARE_WAVE(Z4)
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
   #endif
238
   #endif
239
 #endif
239
 #endif
240
 
240
 
293
     #define E0_ENABLE_READ() stepperE0.isEnabled()
293
     #define E0_ENABLE_READ() stepperE0.isEnabled()
294
   #endif
294
   #endif
295
   #if AXIS_HAS_SQUARE_WAVE(E0)
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
   #endif
297
   #endif
298
 #endif
298
 #endif
299
 
299
 
310
     #define E1_ENABLE_READ() stepperE1.isEnabled()
310
     #define E1_ENABLE_READ() stepperE1.isEnabled()
311
   #endif
311
   #endif
312
   #if AXIS_HAS_SQUARE_WAVE(E1)
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
   #endif
314
   #endif
315
 #endif
315
 #endif
316
 
316
 
327
     #define E2_ENABLE_READ() stepperE2.isEnabled()
327
     #define E2_ENABLE_READ() stepperE2.isEnabled()
328
   #endif
328
   #endif
329
   #if AXIS_HAS_SQUARE_WAVE(E2)
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
   #endif
331
   #endif
332
 #endif
332
 #endif
333
 
333
 
344
     #define E3_ENABLE_READ() stepperE3.isEnabled()
344
     #define E3_ENABLE_READ() stepperE3.isEnabled()
345
   #endif
345
   #endif
346
   #if AXIS_HAS_SQUARE_WAVE(E3)
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
   #endif
348
   #endif
349
 #endif
349
 #endif
350
 
350
 
361
     #define E4_ENABLE_READ() stepperE4.isEnabled()
361
     #define E4_ENABLE_READ() stepperE4.isEnabled()
362
   #endif
362
   #endif
363
   #if AXIS_HAS_SQUARE_WAVE(E4)
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
   #endif
365
   #endif
366
 #endif
366
 #endif
367
 
367
 
378
     #define E5_ENABLE_READ() stepperE5.isEnabled()
378
     #define E5_ENABLE_READ() stepperE5.isEnabled()
379
   #endif
379
   #endif
380
   #if AXIS_HAS_SQUARE_WAVE(E5)
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
   #endif
382
   #endif
383
 #endif
383
 #endif
384
 
384
 
395
     #define E6_ENABLE_READ() stepperE6.isEnabled()
395
     #define E6_ENABLE_READ() stepperE6.isEnabled()
396
   #endif
396
   #endif
397
   #if AXIS_HAS_SQUARE_WAVE(E6)
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
   #endif
399
   #endif
400
 #endif
400
 #endif
401
 
401
 
412
     #define E7_ENABLE_READ() stepperE7.isEnabled()
412
     #define E7_ENABLE_READ() stepperE7.isEnabled()
413
   #endif
413
   #endif
414
   #if AXIS_HAS_SQUARE_WAVE(E7)
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
   #endif
416
   #endif
417
 #endif
417
 #endif

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

2288
     INIT_FAN_PIN(CONTROLLER_FAN_PIN);
2288
     INIT_FAN_PIN(CONTROLLER_FAN_PIN);
2289
   #endif
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
   HAL_adc_init();
2293
   HAL_adc_init();
2296
 
2294
 
3037
       #endif
3035
       #endif
3038
 
3036
 
3039
       #if HAS_HEATED_BED
3037
       #if HAS_HEATED_BED
3040
-        _PWM_MOD(BED,soft_pwm_bed,temp_bed);
3038
+        _PWM_MOD(BED, soft_pwm_bed, temp_bed);
3041
       #endif
3039
       #endif
3042
 
3040
 
3043
       #if HAS_HEATED_CHAMBER
3041
       #if HAS_HEATED_CHAMBER
3044
-        _PWM_MOD(CHAMBER,soft_pwm_chamber,temp_chamber);
3042
+        _PWM_MOD(CHAMBER, soft_pwm_chamber, temp_chamber);
3045
       #endif
3043
       #endif
3046
 
3044
 
3047
       #if HAS_COOLER
3045
       #if HAS_COOLER
3048
-        _PWM_MOD(COOLER,soft_pwm_cooler,temp_cooler);
3046
+        _PWM_MOD(COOLER, soft_pwm_cooler, temp_cooler);
3049
       #endif
3047
       #endif
3050
 
3048
 
3051
       #if ENABLED(FAN_SOFT_PWM)
3049
       #if ENABLED(FAN_SOFT_PWM)

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

918
       if (ok) {
918
       if (ok) {
919
         // Do a small lift to avoid the workpiece in the move back (below)
919
         // Do a small lift to avoid the workpiece in the move back (below)
920
         current_position.z += toolchange_settings.z_raise;
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
         fast_line_to_current(Z_AXIS);
922
         fast_line_to_current(Z_AXIS);
925
         planner.synchronize();
923
         planner.synchronize();
926
       }
924
       }
1068
         if (can_move_away && TERN1(TOOLCHANGE_PARK, toolchange_settings.enable_park)) {
1066
         if (can_move_away && TERN1(TOOLCHANGE_PARK, toolchange_settings.enable_park)) {
1069
           // Do a small lift to avoid the workpiece in the move back (below)
1067
           // Do a small lift to avoid the workpiece in the move back (below)
1070
           current_position.z += toolchange_settings.z_raise;
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
           fast_line_to_current(Z_AXIS);
1070
           fast_line_to_current(Z_AXIS);
1075
           planner.synchronize();
1071
           planner.synchronize();
1076
         }
1072
         }
1117
         if (can_move_away && TERN1(TOOLCHANGE_PARK, toolchange_settings.enable_park)) {
1113
         if (can_move_away && TERN1(TOOLCHANGE_PARK, toolchange_settings.enable_park)) {
1118
           // Do a small lift to avoid the workpiece in the move back (below)
1114
           // Do a small lift to avoid the workpiece in the move back (below)
1119
           current_position.z += toolchange_settings.z_raise;
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
           fast_line_to_current(Z_AXIS);
1117
           fast_line_to_current(Z_AXIS);
1124
         }
1118
         }
1125
       #endif
1119
       #endif

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

67
 
67
 
68
 #define rCPUCTL     0x80    //16<<3
68
 #define rCPUCTL     0x80    //16<<3
69
 /* CPUCTL Bits  */
69
 /* CPUCTL Bits  */
70
-#define bmPUSLEWID1 0x80    //b7
70
+#define bmPULSEWID1 0x80    //b7
71
 #define bmPULSEWID0 0x40    //b6
71
 #define bmPULSEWID0 0x40    //b6
72
 #define bmIE        0x01    //b0
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
 
59
 
60
 // (CPUCTL)
60
 // (CPUCTL)
61
 #define         rCPUCTL 0x80            //16<<3
61
 #define         rCPUCTL 0x80            //16<<3
62
-#define     bmPUSLEWID1 0x80            //b7
62
+#define     bmPULSEWID1 0x80            //b7
63
 #define     bmPULSEWID0 0x40            //b6
63
 #define     bmPULSEWID0 0x40            //b6
64
 #define            bmIE 0x01            //b0
64
 #define            bmIE 0x01            //b0
65
 
65
 
66
-// bmPUSLEWID1 bmPULSEWID0 Pulse width
66
+// bmPULSEWID1 bmPULSEWID0 Pulse width
67
 // 0           0           10.6uS
67
 // 0           0           10.6uS
68
 // 0           1            5.3uS
68
 // 0           1            5.3uS
69
 // 1           0            2.6uS
69
 // 1           0            2.6uS
70
 // 1           1            1.3uS
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
 // (PINCTL)
76
 // (PINCTL)
77
 #define         rPINCTL 0x88            //17<<3
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
 //
272
 //
273
 #define IRQ_SENSE FALLING
273
 #define IRQ_SENSE FALLING
274
 #ifdef ARDUINO_ARCH_PIC32
274
 #ifdef ARDUINO_ARCH_PIC32
275
-//#define bmPULSEWIDTH PUSLEWIDTH10_6
275
+//#define bmPULSEWIDTH PULSEWIDTH10_6
276
 #define bmPULSEWIDTH 0
276
 #define bmPULSEWIDTH 0
277
 #define bmIRQ_SENSE 0
277
 #define bmIRQ_SENSE 0
278
 #else
278
 #else
279
-#define bmPULSEWIDTH PUSLEWIDTH1_3
279
+#define bmPULSEWIDTH PULSEWIDTH1_3
280
 #define bmIRQ_SENSE 0
280
 #define bmIRQ_SENSE 0
281
 #endif
281
 #endif
282
 #else
282
 #else

Loading…
Cancel
Save