diff --git a/Marlin/src/core/serial.h b/Marlin/src/core/serial.h index dfcf23ddb6..a3d640ee1a 100644 --- a/Marlin/src/core/serial.h +++ b/Marlin/src/core/serial.h @@ -88,7 +88,7 @@ extern uint8_t marlin_debug_flags; #if HAS_MULTI_SERIAL #define _PORT_REDIRECT(n,p) REMEMBER(n,multiSerial.portMask,p) #define _PORT_RESTORE(n,p) RESTORE(n) - #define SERIAL_ASSERT(P) if(multiSerial.portMask!=(P)){ debugger(); } + #define SERIAL_ASSERT(P) if (multiSerial.portMask!=(P)) { debugger(); } // If we have a catchall, use that directly #ifdef SERIAL_CATCHALL #define _SERIAL_LEAF_2 SERIAL_CATCHALL diff --git a/Marlin/src/feature/mixing.cpp b/Marlin/src/feature/mixing.cpp index 332a4f3740..0013797ad5 100644 --- a/Marlin/src/feature/mixing.cpp +++ b/Marlin/src/feature/mixing.cpp @@ -169,14 +169,12 @@ void Mixer::refresh_collector(const float proportion/*=1.0*/, const uint8_t t/*= #include "../module/planner.h" gradient_t Mixer::gradient = { - false, // enabled - {0}, // color (array) - 0, 0, // start_z, end_z - 0, 1, // start_vtool, end_vtool - {0}, {0} // start_mix[], end_mix[] - #if ENABLED(GRADIENT_VTOOL) - , -1 // vtool_index - #endif + false, // enabled + {0}, // color (array) + 0, 0, // start_z, end_z + 0, 1, // start_vtool, end_vtool + {0}, {0} // start_mix[], end_mix[] + OPTARG(GRADIENT_VTOOL, -1) // vtool_index }; float Mixer::prev_z; // = 0 diff --git a/Marlin/src/feature/pause.cpp b/Marlin/src/feature/pause.cpp index 94c564a9aa..d24a60a0b0 100644 --- a/Marlin/src/feature/pause.cpp +++ b/Marlin/src/feature/pause.cpp @@ -191,13 +191,14 @@ bool load_filament(const_float_t slow_load_length/*=0*/, const_float_t fast_load KEEPALIVE_STATE(PAUSED_FOR_USER); wait_for_user = true; // LCD click or M108 will clear this + + TERN_(EXTENSIBLE_UI, ExtUI::onUserConfirmRequired_P(PSTR("Load Filament"))); + #if ENABLED(HOST_PROMPT_SUPPORT) const char tool = '0' + TERN0(MULTI_FILAMENT_SENSOR, active_extruder); host_prompt_do(PROMPT_USER_CONTINUE, PSTR("Load Filament T"), tool, CONTINUE_STR); #endif - TERN_(EXTENSIBLE_UI, ExtUI::onUserConfirmRequired_P(PSTR("Load Filament"))); - while (wait_for_user) { impatient_beep(max_beep_count); idle_no_sleep(); @@ -237,8 +238,8 @@ bool load_filament(const_float_t slow_load_length/*=0*/, const_float_t fast_load if (show_lcd) ui.pause_show_message(PAUSE_MESSAGE_PURGE); - TERN_(HOST_PROMPT_SUPPORT, host_prompt_do(PROMPT_USER_CONTINUE, PSTR("Filament Purging..."), CONTINUE_STR)); TERN_(EXTENSIBLE_UI, ExtUI::onUserConfirmRequired_P(PSTR("Filament Purging..."))); + TERN_(HOST_PROMPT_SUPPORT, host_prompt_do(PROMPT_USER_CONTINUE, PSTR("Filament Purging..."), CONTINUE_STR)); wait_for_user = true; // A click or M108 breaks the purge_length loop for (float purge_count = purge_length; purge_count > 0 && wait_for_user; --purge_count) 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 #endif // Keep looping if "Purge More" was selected - } while (TERN0(M600_PURGE_MORE_RESUMABLE, show_lcd && pause_menu_response == PAUSE_RESPONSE_EXTRUDE_MORE)); + } while (TERN0(M600_PURGE_MORE_RESUMABLE, pause_menu_response == PAUSE_RESPONSE_EXTRUDE_MORE)); #endif TERN_(HOST_PROMPT_SUPPORT, host_action_prompt_end()); diff --git a/Marlin/src/feature/probe_temp_comp.cpp b/Marlin/src/feature/probe_temp_comp.cpp index e39896d4dc..6f2dad58b9 100644 --- a/Marlin/src/feature/probe_temp_comp.cpp +++ b/Marlin/src/feature/probe_temp_comp.cpp @@ -38,16 +38,12 @@ int16_t ProbeTempComp::z_offsets_probe[cali_info_init[TSI_PROBE].measurements], int16_t *ProbeTempComp::sensor_z_offsets[TSI_COUNT] = { ProbeTempComp::z_offsets_probe, ProbeTempComp::z_offsets_bed - #if ENABLED(USE_TEMP_EXT_COMPENSATION) - , ProbeTempComp::z_offsets_ext - #endif + OPTARG(USE_TEMP_EXT_COMPENSATION, ProbeTempComp::z_offsets_ext) }; const temp_calib_t ProbeTempComp::cali_info[TSI_COUNT] = { cali_info_init[TSI_PROBE], cali_info_init[TSI_BED] - #if ENABLED(USE_TEMP_EXT_COMPENSATION) - , cali_info_init[TSI_EXT] - #endif + OPTARG(USE_TEMP_EXT_COMPENSATION, cali_info_init[TSI_EXT]) }; constexpr xyz_pos_t ProbeTempComp::park_point; diff --git a/Marlin/src/gcode/bedlevel/abl/G29.cpp b/Marlin/src/gcode/bedlevel/abl/G29.cpp index 29009c6e2d..c3c8d3c92b 100644 --- a/Marlin/src/gcode/bedlevel/abl/G29.cpp +++ b/Marlin/src/gcode/bedlevel/abl/G29.cpp @@ -878,9 +878,7 @@ G29_TYPE GcodeSuite::G29() { // Sync the planner from the current_position if (planner.leveling_active) sync_plan_position(); - #if HAS_BED_PROBE - probe.move_z_after_probing(); - #endif + TERN_(HAS_BED_PROBE, probe.move_z_after_probing()); #ifdef Z_PROBE_END_SCRIPT if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPAIR("Z Probe End Script: ", Z_PROBE_END_SCRIPT); diff --git a/Marlin/src/gcode/feature/camera/M240.cpp b/Marlin/src/gcode/feature/camera/M240.cpp index f5c910a9e9..19051ffd42 100644 --- a/Marlin/src/gcode/feature/camera/M240.cpp +++ b/Marlin/src/gcode/feature/camera/M240.cpp @@ -135,17 +135,8 @@ void GcodeSuite::M240() { }; #ifdef PHOTO_RETRACT_MM - const float rval = parser.seenval('R') ? parser.value_linear_units() : _PHOTO_RETRACT_MM; - feedRate_t sval = ( - #if ENABLED(ADVANCED_PAUSE_FEATURE) - PAUSE_PARK_RETRACT_FEEDRATE - #elif ENABLED(FWRETRACT) - RETRACT_FEEDRATE - #else - 45 - #endif - ); - if (parser.seenval('S')) sval = parser.value_feedrate(); + const float rval = parser.linearval('R', _PHOTO_RETRACT_MM); + const feedRate_t sval = parser.feedrateval('S', TERN(ADVANCED_PAUSE_FEATURE, PAUSE_PARK_RETRACT_FEEDRATE, TERN(FWRETRACT, RETRACT_FEEDRATE, 45))); e_move_m240(-rval, sval); #endif diff --git a/Marlin/src/gcode/feature/fwretract/G10_G11.cpp b/Marlin/src/gcode/feature/fwretract/G10_G11.cpp index 219502f28a..35330fe0ac 100644 --- a/Marlin/src/gcode/feature/fwretract/G10_G11.cpp +++ b/Marlin/src/gcode/feature/fwretract/G10_G11.cpp @@ -32,16 +32,7 @@ * G10 - Retract filament according to settings of M207 * TODO: Handle 'G10 P' for tool settings and 'G10 L' for workspace settings */ -void GcodeSuite::G10() { - #if HAS_MULTI_EXTRUDER - const bool rs = parser.boolval('S'); - #endif - fwretract.retract(true - #if HAS_MULTI_EXTRUDER - , rs - #endif - ); -} +void GcodeSuite::G10() { fwretract.retract(true OPTARG(HAS_MULTI_EXTRUDER, parser.boolval('S'))); } /** * G11 - Recover filament according to settings of M208 diff --git a/Marlin/src/gcode/feature/pause/M701_M702.cpp b/Marlin/src/gcode/feature/pause/M701_M702.cpp index 0a649dadd4..d46bb234bc 100644 --- a/Marlin/src/gcode/feature/pause/M701_M702.cpp +++ b/Marlin/src/gcode/feature/pause/M701_M702.cpp @@ -114,9 +114,7 @@ void GcodeSuite::M701() { true, // show_lcd thermalManager.still_heating(target_extruder), // pause_for_user PAUSE_MODE_LOAD_FILAMENT // pause_mode - #if ENABLED(DUAL_X_CARRIAGE) - , target_extruder // Dual X target - #endif + OPTARG(DUAL_X_CARRIAGE, target_extruder) // Dual X target ); #endif diff --git a/Marlin/src/gcode/parser.h b/Marlin/src/gcode/parser.h index 08cf10004a..a819de6127 100644 --- a/Marlin/src/gcode/parser.h +++ b/Marlin/src/gcode/parser.h @@ -416,7 +416,8 @@ public: static inline float linearval(const char c, const float dval=0) { return seenval(c) ? value_linear_units() : dval; } static inline float axisunitsval(const char c, const AxisEnum a, const float dval=0) { return seenval(c) ? value_axis_units(a) : dval; } - static inline celsius_t celsiusval(const char c, const float dval=0) { return seenval(c) ? value_celsius() : dval; } + static inline celsius_t celsiusval(const char c, const celsius_t dval=0) { return seenval(c) ? value_celsius() : dval; } + static inline feedRate_t feedrateval(const char c, const feedRate_t dval=0) { return seenval(c) ? value_feedrate() : dval; } #if ENABLED(MARLIN_DEV_MODE) diff --git a/Marlin/src/gcode/queue.cpp b/Marlin/src/gcode/queue.cpp index fa83c82ddc..37acc8d58c 100644 --- a/Marlin/src/gcode/queue.cpp +++ b/Marlin/src/gcode/queue.cpp @@ -118,11 +118,7 @@ bool GCodeQueue::RingBuffer::enqueue(const char *cmd, bool skip_ok/*=true*/ ) { if (*cmd == ';' || length >= BUFSIZE) return false; strcpy(commands[index_w].buffer, cmd); - commit_command(skip_ok - #if HAS_MULTI_SERIAL - , serial_ind - #endif - ); + commit_command(skip_ok OPTARG(HAS_MULTI_SERIAL, serial_ind)); return true; } @@ -538,11 +534,7 @@ void GCodeQueue::get_serial_commands() { #endif // Add the command to the queue - ring_buffer.enqueue(serial.line_buffer, false - #if HAS_MULTI_SERIAL - , p - #endif - ); + ring_buffer.enqueue(serial.line_buffer, false OPTARG(HAS_MULTI_SERIAL, p)); } else process_stream_char(serial_char, serial.input_state, serial.line_buffer, serial.count); diff --git a/Marlin/src/inc/Version.h b/Marlin/src/inc/Version.h index 47faf32aad..0f1f82de27 100644 --- a/Marlin/src/inc/Version.h +++ b/Marlin/src/inc/Version.h @@ -105,18 +105,18 @@ * Currently only supported by DUE platform */ #ifndef USB_DEVICE_VENDOR_ID - #define USB_DEVICE_VENDOR_ID 0x03EB /* ATMEL VID */ + #define USB_DEVICE_VENDOR_ID 0x03EB /* ATMEL VID */ #endif #ifndef USB_DEVICE_PRODUCT_ID - #define USB_DEVICE_PRODUCT_ID 0x2424 /* MSC / CDC */ + #define USB_DEVICE_PRODUCT_ID 0x2424 /* MSC / CDC */ #endif //! USB Device string definitions (Optional) #ifndef USB_DEVICE_MANUFACTURE_NAME - #define USB_DEVICE_MANUFACTURE_NAME WEBSITE_URL + #define USB_DEVICE_MANUFACTURE_NAME WEBSITE_URL #endif #ifdef CUSTOM_MACHINE_NAME - #define USB_DEVICE_PRODUCT_NAME CUSTOM_MACHINE_NAME + #define USB_DEVICE_PRODUCT_NAME CUSTOM_MACHINE_NAME #else - #define USB_DEVICE_PRODUCT_NAME MACHINE_NAME + #define USB_DEVICE_PRODUCT_NAME MACHINE_NAME #endif -#define USB_DEVICE_SERIAL_NAME "123985739853" +#define USB_DEVICE_SERIAL_NAME "123985739853" diff --git a/Marlin/src/lcd/dogm/u8g_dev_tft_upscale_from_128x64.cpp b/Marlin/src/lcd/dogm/u8g_dev_tft_upscale_from_128x64.cpp index b0cb59a12c..9b5f206fa9 100644 --- a/Marlin/src/lcd/dogm/u8g_dev_tft_upscale_from_128x64.cpp +++ b/Marlin/src/lcd/dogm/u8g_dev_tft_upscale_from_128x64.cpp @@ -390,9 +390,7 @@ uint8_t u8g_dev_tft_320x240_upscale_from_128x64_fn(u8g_t *u8g, u8g_dev_t *dev, u LOOP_L_N(y, PAGE_HEIGHT) { uint32_t k = 0; - #if HAS_LCD_IO - buffer = (y & 1) ? bufferB : bufferA; - #endif + TERN_(HAS_LCD_IO, buffer = (y & 1) ? bufferB : bufferA); for (uint16_t i = 0; i < (uint32_t)pb->width; i++) { const uint8_t b = *(((uint8_t *)pb->buf) + i); const uint16_t c = TEST(b, y) ? TFT_MARLINUI_COLOR : TFT_MARLINBG_COLOR; diff --git a/Marlin/src/lcd/extui/dgus/dgus_extui.cpp b/Marlin/src/lcd/extui/dgus/dgus_extui.cpp index 55546caaf1..589821e23a 100644 --- a/Marlin/src/lcd/extui/dgus/dgus_extui.cpp +++ b/Marlin/src/lcd/extui/dgus/dgus_extui.cpp @@ -64,7 +64,7 @@ namespace ExtUI { ScreenHandler.SetupConfirmAction(setUserConfirmed); ScreenHandler.GotoScreen(DGUSLCD_SCREEN_POPUP); } - else if (ScreenHandler.getCurrentScreen() == DGUSLCD_SCREEN_POPUP ) { + else if (ScreenHandler.getCurrentScreen() == DGUSLCD_SCREEN_POPUP) { ScreenHandler.SetupConfirmAction(nullptr); ScreenHandler.PopToOldScreen(); } diff --git a/Marlin/src/lcd/menu/menu_advanced.cpp b/Marlin/src/lcd/menu/menu_advanced.cpp index 467aa9a4eb..8834ee6eac 100644 --- a/Marlin/src/lcd/menu/menu_advanced.cpp +++ b/Marlin/src/lcd/menu/menu_advanced.cpp @@ -569,9 +569,7 @@ void menu_advanced_settings() { SUBMENU(MSG_JERK, menu_advanced_jerk); #elif HAS_JUNCTION_DEVIATION EDIT_ITEM(float43, MSG_JUNCTION_DEVIATION, &planner.junction_deviation_mm, 0.001f, 0.3f - #if ENABLED(LIN_ADVANCE) - , planner.recalculate_max_e_jerk - #endif + OPTARG(LIN_ADVANCE, planner.recalculate_max_e_jerk) ); #endif diff --git a/Marlin/src/lcd/menu/menu_ubl.cpp b/Marlin/src/lcd/menu/menu_ubl.cpp index 467bd81acf..dae2c42047 100644 --- a/Marlin/src/lcd/menu/menu_ubl.cpp +++ b/Marlin/src/lcd/menu/menu_ubl.cpp @@ -192,9 +192,7 @@ void _lcd_ubl_edit_mesh() { char ubl_lcd_gcode[20]; sprintf_P(ubl_lcd_gcode, PSTR("G28\nG26CPH%" PRIi16 TERN_(HAS_HEATED_BED, "B%" PRIi16)) , custom_hotend_temp - #if HAS_HEATED_BED - , custom_bed_temp - #endif + OPTARG(HAS_HEATED_BED, custom_bed_temp) ); queue.inject(ubl_lcd_gcode); } diff --git a/Marlin/src/module/planner.cpp b/Marlin/src/module/planner.cpp index e4649b9410..00173e9ad1 100644 --- a/Marlin/src/module/planner.cpp +++ b/Marlin/src/module/planner.cpp @@ -1388,9 +1388,7 @@ void Planner::check_axes_activity() { // Update Fan speeds // Only if synchronous M106/M107 is disabled // - #if HAS_TAIL_FAN_SPEED - sync_fan_speeds(tail_fan_speed); - #endif + TERN_(HAS_TAIL_FAN_SPEED, sync_fan_speeds(tail_fan_speed)); TERN_(AUTOTEMP, autotemp_task()); @@ -1585,11 +1583,7 @@ void Planner::check_axes_activity() { raw.z += ( #if ENABLED(MESH_BED_LEVELING) - mbl.get_z(raw - #if ENABLED(ENABLE_LEVELING_FADE_HEIGHT) - , fade_scaling_factor - #endif - ) + mbl.get_z(raw OPTARG(ENABLE_LEVELING_FADE_HEIGHT, fade_scaling_factor)) #elif ENABLED(AUTO_BED_LEVELING_UBL) fade_scaling_factor ? fade_scaling_factor * ubl.get_z_correction(raw) : 0.0 #elif ENABLED(AUTO_BED_LEVELING_BILINEAR) @@ -1622,11 +1616,7 @@ void Planner::check_axes_activity() { raw.z -= ( #if ENABLED(MESH_BED_LEVELING) - mbl.get_z(raw - #if ENABLED(ENABLE_LEVELING_FADE_HEIGHT) - , fade_scaling_factor - #endif - ) + mbl.get_z(raw OPTARG(ENABLE_LEVELING_FADE_HEIGHT, fade_scaling_factor)) #elif ENABLED(AUTO_BED_LEVELING_UBL) fade_scaling_factor ? fade_scaling_factor * ubl.get_z_correction(raw) : 0.0 #elif ENABLED(AUTO_BED_LEVELING_BILINEAR) @@ -1811,12 +1801,8 @@ bool Planner::_buffer_steps(const xyze_long_t &target // Fill the block with the specified movement if (!_populate_block(block, false, target - #if HAS_POSITION_FLOAT - , target_float - #endif - #if HAS_DIST_MM_ARG - , cart_dist_mm - #endif + OPTARG(HAS_POSITION_FLOAT, target_float) + OPTARG(HAS_DIST_MM_ARG, cart_dist_mm) , fr_mm_s, extruder, millimeters )) { // 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, #endif #endif - #if HAS_EXTRUDERS - if (de < 0) SBI(dm, E_AXIS); - #endif + TERN_(HAS_EXTRUDERS, if (de < 0) SBI(dm, E_AXIS)); #if HAS_EXTRUDERS const float esteps_float = de * e_factor[extruder]; @@ -2075,9 +2059,7 @@ bool Planner::_populate_block(block_t * const block, bool split_move, ); #endif - #if HAS_EXTRUDERS - steps_dist_mm.e = esteps_float * steps_to_mm[E_AXIS_N(extruder)]; - #endif + TERN_(HAS_EXTRUDERS, steps_dist_mm.e = esteps_float * steps_to_mm[E_AXIS_N(extruder)]); TERN_(LCD_SHOW_E_TOTAL, e_move_accumulator += steps_dist_mm.e); @@ -2162,9 +2144,7 @@ bool Planner::_populate_block(block_t * const block, bool split_move, block->e_to_p_pressure = baricuda_e_to_p_pressure; #endif - #if HAS_MULTI_EXTRUDER - block->extruder = extruder; - #endif + TERN_(HAS_MULTI_EXTRUDER, block->extruder = extruder); #if ENABLED(AUTO_POWER_CONTROL) if (LINEAR_AXIS_GANG( @@ -2986,12 +2966,8 @@ bool Planner::buffer_segment(const abce_pos_t &abce // Queue the movement. Return 'false' if the move was not queued. if (!_buffer_steps(target - #if HAS_POSITION_FLOAT - , target_float - #endif - #if HAS_DIST_MM_ARG - , cart_dist_mm - #endif + OPTARG(HAS_POSITION_FLOAT, target_float) + OPTARG(HAS_DIST_MM_ARG, cart_dist_mm) , fr_mm_s, extruder, millimeters) ) return false; diff --git a/Marlin/src/module/settings.cpp b/Marlin/src/module/settings.cpp index 47c1314e28..fca33c98c2 100644 --- a/Marlin/src/module/settings.cpp +++ b/Marlin/src/module/settings.cpp @@ -2555,9 +2555,7 @@ void MarlinSettings::reset() { TERN_(HAS_CLASSIC_E_JERK, planner.max_jerk.e = DEFAULT_EJERK); #endif - #if HAS_JUNCTION_DEVIATION - planner.junction_deviation_mm = float(JUNCTION_DEVIATION_MM); - #endif + TERN_(HAS_JUNCTION_DEVIATION, planner.junction_deviation_mm = float(JUNCTION_DEVIATION_MM)); #if HAS_SCARA_OFFSET scara_home_offset.reset(); @@ -3151,9 +3149,7 @@ void MarlinSettings::reset() { CONFIG_ECHO_HEADING( "Advanced: B S T" - #if HAS_JUNCTION_DEVIATION - " J" - #endif + TERN_(HAS_JUNCTION_DEVIATION, " J") #if HAS_CLASSIC_JERK " X Y Z" TERN_(HAS_CLASSIC_E_JERK, " E") diff --git a/Marlin/src/module/stepper.cpp b/Marlin/src/module/stepper.cpp index b8fdaa5f76..882f5efc35 100644 --- a/Marlin/src/module/stepper.cpp +++ b/Marlin/src/module/stepper.cpp @@ -1428,14 +1428,10 @@ void Stepper::isr() { // Get the interval to the next ISR call const uint32_t interval = _MIN( + uint32_t(HAL_TIMER_TYPE_MAX), // Come back in a very long time nextMainISR // Time until the next Pulse / Block phase - #if ENABLED(LIN_ADVANCE) - , nextAdvanceISR // Come back early for Linear Advance? - #endif - #if ENABLED(INTEGRATED_BABYSTEPPING) - , nextBabystepISR // Come back early for Babystepping? - #endif - , uint32_t(HAL_TIMER_TYPE_MAX) // Come back in a very long time + OPTARG(LIN_ADVANCE, nextAdvanceISR) // Come back early for Linear Advance? + OPTARG(INTEGRATED_BABYSTEPPING, nextBabystepISR) // Come back early for Babystepping? ); // diff --git a/Marlin/src/module/stepper/trinamic.h b/Marlin/src/module/stepper/trinamic.h index 766f8fced2..7957a1b353 100644 --- a/Marlin/src/module/stepper/trinamic.h +++ b/Marlin/src/module/stepper/trinamic.h @@ -121,7 +121,7 @@ void reset_trinamic_drivers(); #define X_ENABLE_READ() stepperX.isEnabled() #endif #if AXIS_HAS_SQUARE_WAVE(X) - #define X_STEP_WRITE(STATE) do{ if(STATE) TOGGLE(X_STEP_PIN); }while(0) + #define X_STEP_WRITE(STATE) do{ if (STATE) TOGGLE(X_STEP_PIN); }while(0) #endif #endif @@ -149,7 +149,7 @@ void reset_trinamic_drivers(); #define Z_ENABLE_READ() stepperZ.isEnabled() #endif #if AXIS_HAS_SQUARE_WAVE(Z) - #define Z_STEP_WRITE(STATE) do{ if(STATE) TOGGLE(Z_STEP_PIN); }while(0) + #define Z_STEP_WRITE(STATE) do{ if (STATE) TOGGLE(Z_STEP_PIN); }while(0) #endif #endif @@ -166,7 +166,7 @@ void reset_trinamic_drivers(); #define X2_ENABLE_READ() stepperX2.isEnabled() #endif #if AXIS_HAS_SQUARE_WAVE(X2) - #define X2_STEP_WRITE(STATE) do{ if(STATE) TOGGLE(X2_STEP_PIN); }while(0) + #define X2_STEP_WRITE(STATE) do{ if (STATE) TOGGLE(X2_STEP_PIN); }while(0) #endif #endif @@ -183,7 +183,7 @@ void reset_trinamic_drivers(); #define Y2_ENABLE_READ() stepperY2.isEnabled() #endif #if AXIS_HAS_SQUARE_WAVE(Y2) - #define Y2_STEP_WRITE(STATE) do{ if(STATE) TOGGLE(Y2_STEP_PIN); }while(0) + #define Y2_STEP_WRITE(STATE) do{ if (STATE) TOGGLE(Y2_STEP_PIN); }while(0) #endif #endif @@ -200,7 +200,7 @@ void reset_trinamic_drivers(); #define Z2_ENABLE_READ() stepperZ2.isEnabled() #endif #if AXIS_HAS_SQUARE_WAVE(Z2) - #define Z2_STEP_WRITE(STATE) do{ if(STATE) TOGGLE(Z2_STEP_PIN); }while(0) + #define Z2_STEP_WRITE(STATE) do{ if (STATE) TOGGLE(Z2_STEP_PIN); }while(0) #endif #endif @@ -217,7 +217,7 @@ void reset_trinamic_drivers(); #define Z3_ENABLE_READ() stepperZ3.isEnabled() #endif #if AXIS_HAS_SQUARE_WAVE(Z3) - #define Z3_STEP_WRITE(STATE) do{ if(STATE) TOGGLE(Z3_STEP_PIN); }while(0) + #define Z3_STEP_WRITE(STATE) do{ if (STATE) TOGGLE(Z3_STEP_PIN); }while(0) #endif #endif @@ -234,7 +234,7 @@ void reset_trinamic_drivers(); #define Z4_ENABLE_READ() stepperZ4.isEnabled() #endif #if AXIS_HAS_SQUARE_WAVE(Z4) - #define Z4_STEP_WRITE(STATE) do{ if(STATE) TOGGLE(Z4_STEP_PIN); }while(0) + #define Z4_STEP_WRITE(STATE) do{ if (STATE) TOGGLE(Z4_STEP_PIN); }while(0) #endif #endif @@ -293,7 +293,7 @@ void reset_trinamic_drivers(); #define E0_ENABLE_READ() stepperE0.isEnabled() #endif #if AXIS_HAS_SQUARE_WAVE(E0) - #define E0_STEP_WRITE(STATE) do{ if(STATE) TOGGLE(E0_STEP_PIN); }while(0) + #define E0_STEP_WRITE(STATE) do{ if (STATE) TOGGLE(E0_STEP_PIN); }while(0) #endif #endif @@ -310,7 +310,7 @@ void reset_trinamic_drivers(); #define E1_ENABLE_READ() stepperE1.isEnabled() #endif #if AXIS_HAS_SQUARE_WAVE(E1) - #define E1_STEP_WRITE(STATE) do{ if(STATE) TOGGLE(E1_STEP_PIN); }while(0) + #define E1_STEP_WRITE(STATE) do{ if (STATE) TOGGLE(E1_STEP_PIN); }while(0) #endif #endif @@ -327,7 +327,7 @@ void reset_trinamic_drivers(); #define E2_ENABLE_READ() stepperE2.isEnabled() #endif #if AXIS_HAS_SQUARE_WAVE(E2) - #define E2_STEP_WRITE(STATE) do{ if(STATE) TOGGLE(E2_STEP_PIN); }while(0) + #define E2_STEP_WRITE(STATE) do{ if (STATE) TOGGLE(E2_STEP_PIN); }while(0) #endif #endif @@ -344,7 +344,7 @@ void reset_trinamic_drivers(); #define E3_ENABLE_READ() stepperE3.isEnabled() #endif #if AXIS_HAS_SQUARE_WAVE(E3) - #define E3_STEP_WRITE(STATE) do{ if(STATE) TOGGLE(E3_STEP_PIN); }while(0) + #define E3_STEP_WRITE(STATE) do{ if (STATE) TOGGLE(E3_STEP_PIN); }while(0) #endif #endif @@ -361,7 +361,7 @@ void reset_trinamic_drivers(); #define E4_ENABLE_READ() stepperE4.isEnabled() #endif #if AXIS_HAS_SQUARE_WAVE(E4) - #define E4_STEP_WRITE(STATE) do{ if(STATE) TOGGLE(E4_STEP_PIN); }while(0) + #define E4_STEP_WRITE(STATE) do{ if (STATE) TOGGLE(E4_STEP_PIN); }while(0) #endif #endif @@ -378,7 +378,7 @@ void reset_trinamic_drivers(); #define E5_ENABLE_READ() stepperE5.isEnabled() #endif #if AXIS_HAS_SQUARE_WAVE(E5) - #define E5_STEP_WRITE(STATE) do{ if(STATE) TOGGLE(E5_STEP_PIN); }while(0) + #define E5_STEP_WRITE(STATE) do{ if (STATE) TOGGLE(E5_STEP_PIN); }while(0) #endif #endif @@ -395,7 +395,7 @@ void reset_trinamic_drivers(); #define E6_ENABLE_READ() stepperE6.isEnabled() #endif #if AXIS_HAS_SQUARE_WAVE(E6) - #define E6_STEP_WRITE(STATE) do{ if(STATE) TOGGLE(E6_STEP_PIN); }while(0) + #define E6_STEP_WRITE(STATE) do{ if (STATE) TOGGLE(E6_STEP_PIN); }while(0) #endif #endif @@ -412,6 +412,6 @@ void reset_trinamic_drivers(); #define E7_ENABLE_READ() stepperE7.isEnabled() #endif #if AXIS_HAS_SQUARE_WAVE(E7) - #define E7_STEP_WRITE(STATE) do{ if(STATE) TOGGLE(E7_STEP_PIN); }while(0) + #define E7_STEP_WRITE(STATE) do{ if (STATE) TOGGLE(E7_STEP_PIN); }while(0) #endif #endif diff --git a/Marlin/src/module/temperature.cpp b/Marlin/src/module/temperature.cpp index 52d0dfb56e..0475db486c 100644 --- a/Marlin/src/module/temperature.cpp +++ b/Marlin/src/module/temperature.cpp @@ -2288,9 +2288,7 @@ void Temperature::init() { INIT_FAN_PIN(CONTROLLER_FAN_PIN); #endif - #if HAS_MAXTC_SW_SPI - max_tc_spi.init(); - #endif + TERN_(HAS_MAXTC_SW_SPI, max_tc_spi.init()); HAL_adc_init(); @@ -3037,15 +3035,15 @@ void Temperature::isr() { #endif #if HAS_HEATED_BED - _PWM_MOD(BED,soft_pwm_bed,temp_bed); + _PWM_MOD(BED, soft_pwm_bed, temp_bed); #endif #if HAS_HEATED_CHAMBER - _PWM_MOD(CHAMBER,soft_pwm_chamber,temp_chamber); + _PWM_MOD(CHAMBER, soft_pwm_chamber, temp_chamber); #endif #if HAS_COOLER - _PWM_MOD(COOLER,soft_pwm_cooler,temp_cooler); + _PWM_MOD(COOLER, soft_pwm_cooler, temp_cooler); #endif #if ENABLED(FAN_SOFT_PWM) diff --git a/Marlin/src/module/tool_change.cpp b/Marlin/src/module/tool_change.cpp index 6d69b8722d..8fffb2e640 100644 --- a/Marlin/src/module/tool_change.cpp +++ b/Marlin/src/module/tool_change.cpp @@ -918,9 +918,7 @@ void fast_line_to_current(const AxisEnum fr_axis) { _line_to_current(fr_axis, 0. if (ok) { // Do a small lift to avoid the workpiece in the move back (below) current_position.z += toolchange_settings.z_raise; - #if HAS_SOFTWARE_ENDSTOPS - NOMORE(current_position.z, soft_endstop.max.z); - #endif + TERN_(HAS_SOFTWARE_ENDSTOPS, NOMORE(current_position.z, soft_endstop.max.z)); fast_line_to_current(Z_AXIS); planner.synchronize(); } @@ -1068,9 +1066,7 @@ void tool_change(const uint8_t new_tool, bool no_move/*=false*/) { if (can_move_away && TERN1(TOOLCHANGE_PARK, toolchange_settings.enable_park)) { // Do a small lift to avoid the workpiece in the move back (below) current_position.z += toolchange_settings.z_raise; - #if HAS_SOFTWARE_ENDSTOPS - NOMORE(current_position.z, soft_endstop.max.z); - #endif + TERN_(HAS_SOFTWARE_ENDSTOPS, NOMORE(current_position.z, soft_endstop.max.z)); fast_line_to_current(Z_AXIS); planner.synchronize(); } @@ -1117,9 +1113,7 @@ void tool_change(const uint8_t new_tool, bool no_move/*=false*/) { if (can_move_away && TERN1(TOOLCHANGE_PARK, toolchange_settings.enable_park)) { // Do a small lift to avoid the workpiece in the move back (below) current_position.z += toolchange_settings.z_raise; - #if HAS_SOFTWARE_ENDSTOPS - NOMORE(current_position.z, soft_endstop.max.z); - #endif + TERN_(HAS_SOFTWARE_ENDSTOPS, NOMORE(current_position.z, soft_endstop.max.z)); fast_line_to_current(Z_AXIS); } #endif diff --git a/Marlin/src/sd/usb_flashdrive/lib-uhs2/max3421e.h b/Marlin/src/sd/usb_flashdrive/lib-uhs2/max3421e.h index 6cad39d0df..f7eb9adf06 100644 --- a/Marlin/src/sd/usb_flashdrive/lib-uhs2/max3421e.h +++ b/Marlin/src/sd/usb_flashdrive/lib-uhs2/max3421e.h @@ -67,7 +67,7 @@ #define rCPUCTL 0x80 //16<<3 /* CPUCTL Bits */ -#define bmPUSLEWID1 0x80 //b7 +#define bmPULSEWID1 0x80 //b7 #define bmPULSEWID0 0x40 //b6 #define bmIE 0x01 //b0 diff --git a/Marlin/src/sd/usb_flashdrive/lib-uhs3/UHS_host/USB_HOST_SHIELD/UHS_max3421e.h b/Marlin/src/sd/usb_flashdrive/lib-uhs3/UHS_host/USB_HOST_SHIELD/UHS_max3421e.h index 8ecafd4ad8..841cc8fe75 100644 --- a/Marlin/src/sd/usb_flashdrive/lib-uhs3/UHS_host/USB_HOST_SHIELD/UHS_max3421e.h +++ b/Marlin/src/sd/usb_flashdrive/lib-uhs3/UHS_host/USB_HOST_SHIELD/UHS_max3421e.h @@ -59,19 +59,19 @@ e-mail : support@circuitsathome.com // (CPUCTL) #define rCPUCTL 0x80 //16<<3 -#define bmPUSLEWID1 0x80 //b7 +#define bmPULSEWID1 0x80 //b7 #define bmPULSEWID0 0x40 //b6 #define bmIE 0x01 //b0 -// bmPUSLEWID1 bmPULSEWID0 Pulse width +// bmPULSEWID1 bmPULSEWID0 Pulse width // 0 0 10.6uS // 0 1 5.3uS // 1 0 2.6uS // 1 1 1.3uS -#define PUSLEWIDTH10_6 (0) -#define PUSLEWIDTH5_3 (bmPULSEWID0) -#define PUSLEWIDTH2_6 (bmPUSLEWID1) -#define PUSLEWIDTH1_3 (bmPULSEWID0 | bmPUSLEWID1) +#define PULSEWIDTH10_6 (0) +#define PULSEWIDTH5_3 (bmPULSEWID0) +#define PULSEWIDTH2_6 (bmPULSEWID1) +#define PULSEWIDTH1_3 (bmPULSEWID0 | bmPULSEWID1) // (PINCTL) #define rPINCTL 0x88 //17<<3 diff --git a/Marlin/src/sd/usb_flashdrive/lib-uhs3/UHS_host/USB_HOST_SHIELD/USB_HOST_SHIELD.h b/Marlin/src/sd/usb_flashdrive/lib-uhs3/UHS_host/USB_HOST_SHIELD/USB_HOST_SHIELD.h index 7d17d626c1..79c06a492b 100644 --- a/Marlin/src/sd/usb_flashdrive/lib-uhs3/UHS_host/USB_HOST_SHIELD/USB_HOST_SHIELD.h +++ b/Marlin/src/sd/usb_flashdrive/lib-uhs3/UHS_host/USB_HOST_SHIELD/USB_HOST_SHIELD.h @@ -272,11 +272,11 @@ e-mail : support@circuitsathome.com // #define IRQ_SENSE FALLING #ifdef ARDUINO_ARCH_PIC32 -//#define bmPULSEWIDTH PUSLEWIDTH10_6 +//#define bmPULSEWIDTH PULSEWIDTH10_6 #define bmPULSEWIDTH 0 #define bmIRQ_SENSE 0 #else -#define bmPULSEWIDTH PUSLEWIDTH1_3 +#define bmPULSEWIDTH PULSEWIDTH1_3 #define bmIRQ_SENSE 0 #endif #else