Apply TERN to compact code (#17619)

This commit is contained in:
Scott Lahteine
2020-04-22 16:35:03 -05:00
committed by GitHub
parent 88bdd26c99
commit 6d90d1e1f5
162 changed files with 1493 additions and 3530 deletions

View File

@@ -56,11 +56,7 @@
*/
void GcodeSuite::M125() {
// Initial retract before move to filament change position
const float retract = -ABS(parser.seen('L') ? parser.value_axis_units(E_AXIS) : 0
#ifdef PAUSE_PARK_RETRACT_LENGTH
+ (PAUSE_PARK_RETRACT_LENGTH)
#endif
);
const float retract = -ABS(parser.seen('L') ? parser.value_axis_units(E_AXIS) : (PAUSE_PARK_RETRACT_LENGTH));
xyz_pos_t park_point = NOZZLE_PARK_POINT;
@@ -75,23 +71,14 @@ void GcodeSuite::M125() {
park_point += hotend_offset[active_extruder];
#endif
#if ENABLED(SDSUPPORT)
const bool sd_printing = IS_SD_PRINTING();
#else
constexpr bool sd_printing = false;
#endif
const bool sd_printing = TERN0(SDSUPPORT, IS_SD_PRINTING());
#if HAS_LCD_MENU
lcd_pause_show_message(PAUSE_MESSAGE_PARKING, PAUSE_MODE_PAUSE_PRINT);
const bool show_lcd = parser.seenval('P');
#else
constexpr bool show_lcd = false;
#endif
TERN_(HAS_LCD_MENU, lcd_pause_show_message(PAUSE_MESSAGE_PARKING, PAUSE_MODE_PAUSE_PRINT));
const bool show_lcd = TERN0(HAS_LCD_MENU, parser.seenval('P'));
if (pause_print(retract, park_point, 0, show_lcd)) {
#if ENABLED(POWER_LOSS_RECOVERY)
if (recovery.enabled) recovery.save(true);
#endif
TERN_(POWER_LOSS_RECOVERY, if (recovery.enabled) recovery.save(true));
if (!sd_printing || show_lcd) {
wait_for_confirmation(false, 0);
resume_print(0, 0, -retract, 0);