Skip to content

Commit

Permalink
extended OPTARG
Browse files Browse the repository at this point in the history
  • Loading branch information
thinkyhead committed Jun 27, 2021
1 parent 0450af0 commit 4f7a550
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 15 deletions.
6 changes: 2 additions & 4 deletions Marlin/src/core/macros.h
Original file line number Diff line number Diff line change
Expand Up @@ -204,10 +204,8 @@
#define __TERN(T,V...) ___TERN(_CAT(_NO,T),V) // Prepend '_NO' to get '_NOT_0' or '_NOT_1'
#define ___TERN(P,V...) THIRD(P,V) // If first argument has a comma, A. Else B.

#define _OPTARG(A) , A
#define _OPTARGS(A...) , A
#define OPTARG(O,A) TERN_(O,DEFER4(_OPTARG)(A))
#define OPTARGS(O,A...) TERN_(O,DEFER4(_OPTARGS)(A))
#define _OPTARG(A...) , A
#define OPTARG(O,A...) TERN_(O,DEFER4(_OPTARG)(A))
#define _OPTCODE(A) A;
#define OPTCODE(O,A) TERN_(O,DEFER4(_OPTCODE)(A))

Expand Down
12 changes: 7 additions & 5 deletions Marlin/src/gcode/calibrate/G34_M422.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -314,11 +314,13 @@ void GcodeSuite::G34() {
sprintf_P(msg,
PSTR("1:2=%s" TERN_(TRIPLE_Z, " 3-2=%s 3-1=%s") TERN_(QUAD_Z, " 4-3=%s 4-2=%s 4-1=%s")),
dtostrf(ABS(z_measured[1] - z_measured[0]), 1, 3, fstr1)
OPTARG(TRIPLE_Z, dtostrf(ABS(z_measured[2] - z_measured[1]), 1, 3, fstr2))
OPTARG(TRIPLE_Z, dtostrf(ABS(z_measured[2] - z_measured[0]), 1, 3, fstr3))
OPTARG(QUAD_Z, dtostrf(ABS(z_measured[3] - z_measured[2]), 1, 3, fstr4))
OPTARG(QUAD_Z, dtostrf(ABS(z_measured[3] - z_measured[1]), 1, 3, fstr5))
OPTARG(QUAD_Z, dtostrf(ABS(z_measured[3] - z_measured[0]), 1, 3, fstr6))
OPTARG(TRIPLE_Z,
dtostrf(ABS(z_measured[2] - z_measured[1]), 1, 3, fstr2),
dtostrf(ABS(z_measured[2] - z_measured[0]), 1, 3, fstr3))
OPTARG(QUAD_Z,
dtostrf(ABS(z_measured[3] - z_measured[2]), 1, 3, fstr4),
dtostrf(ABS(z_measured[3] - z_measured[1]), 1, 3, fstr5),
dtostrf(ABS(z_measured[3] - z_measured[0]), 1, 3, fstr6))
);
ui.set_status(msg);
#endif
Expand Down
3 changes: 1 addition & 2 deletions Marlin/src/module/motion.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -703,8 +703,7 @@ void restore_feedrate_and_scaling() {
* at the same positions relative to the machine.
*/
void update_software_endstops(const AxisEnum axis
OPTARG(HAS_HOTEND_OFFSET, const uint8_t old_tool_index/*=0*/)
OPTARG(HAS_HOTEND_OFFSET, const uint8_t new_tool_index/*=0*/)
OPTARG(HAS_HOTEND_OFFSET, const uint8_t old_tool_index/*=0*/, const uint8_t new_tool_index/*=0*/)
) {

#if ENABLED(DUAL_X_CARRIAGE)
Expand Down
5 changes: 1 addition & 4 deletions Marlin/src/module/temperature.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -205,10 +205,7 @@ const char str_t_thermal_runaway[] PROGMEM = STR_T_THERMAL_RUNAWAY,
MAX##M max##M##_##n = MAX##M( \
TEMP_##n##_CS_PIN \
OPTARG(_MAX31865_##n##_SW, TEMP_##n##_MOSI_PIN) \
OPTARGS(TEMP_SENSOR_##n##_USES_SW_SPI, \
TEMP_##n##_MISO_PIN, \
TEMP_##n##_SCK_PIN \
) \
OPTARG(TEMP_SENSOR_##n##_USES_SW_SPI, TEMP_##n##_MISO_PIN, TEMP_##n##_SCK_PIN) \
OPTARG(LARGE_PINMAP, HIGH) \
)

Expand Down

0 comments on commit 4f7a550

Please sign in to comment.