1
0
mirror of https://github.com/MarlinFirmware/Marlin.git synced 2024-11-27 05:48:43 +00:00

Clean up formatting, wrap macros

This commit is contained in:
Scott Lahteine 2021-04-23 19:06:55 -05:00
parent 72e3d2492f
commit 3bddbb1110
16 changed files with 49 additions and 69 deletions

View File

@ -600,7 +600,7 @@ inline void manage_inactivity(const bool ignore_stepper_queue=false) {
TERN_(HOTEND_IDLE_TIMEOUT, hotend_idle.check());
#if ENABLED(EXTRUDER_RUNOUT_PREVENT)
if (thermalManager.degHotend(active_extruder) > EXTRUDER_RUNOUT_MINTEMP
if (thermalManager.degHotend(active_extruder) > (EXTRUDER_RUNOUT_MINTEMP)
&& ELAPSED(ms, gcode.previous_move_ms + SEC_TO_MS(EXTRUDER_RUNOUT_SECONDS))
&& !planner.has_blocks_queued()
) {

View File

@ -45,7 +45,7 @@ void HotendIdleProtection::check_hotends(const millis_t &ms) {
bool do_prot = false;
HOTEND_LOOP() {
const bool busy = (TERN0(HAS_RESUME_CONTINUE, wait_for_user) || planner.has_blocks_queued());
if (thermalManager.degHotend(e) >= HOTEND_IDLE_MIN_TRIGGER && !busy) {
if (thermalManager.degHotend(e) >= (HOTEND_IDLE_MIN_TRIGGER) && !busy) {
do_prot = true; break;
}
}

View File

@ -36,13 +36,7 @@ private:
static bool leds_off_after_print;
#endif
static inline void set_done() {
#if ENABLED(LED_COLOR_PRESETS)
leds.set_default();
#else
leds.set_off();
#endif
}
static inline void set_done() { TERN(LED_COLOR_PRESETS, leds.set_default(), leds.set_off()); }
public:
#if HAS_TEMP_HOTEND

View File

@ -85,15 +85,15 @@ bool Power::is_power_needed() {
if (TERN0(HAS_HEATED_BED, thermalManager.degTargetBed() > 0 || thermalManager.temp_bed.soft_pwm_amount > 0)) return true;
#if HAS_HOTEND && AUTO_POWER_E_TEMP
HOTEND_LOOP() if (thermalManager.degHotend(e) >= AUTO_POWER_E_TEMP) return true;
HOTEND_LOOP() if (thermalManager.degHotend(e) >= (AUTO_POWER_E_TEMP)) return true;
#endif
#if HAS_HEATED_CHAMBER && AUTO_POWER_CHAMBER_TEMP
if (thermalManager.degChamber() >= AUTO_POWER_CHAMBER_TEMP) return true;
if (thermalManager.degChamber() >= (AUTO_POWER_CHAMBER_TEMP)) return true;
#endif
#if HAS_COOLER && AUTO_POWER_COOLER_TEMP
if (thermalManager.degCooler() >= AUTO_POWER_COOLER_TEMP) return true;
if (thermalManager.degCooler() >= (AUTO_POWER_COOLER_TEMP)) return true;
#endif
return false;

View File

@ -181,7 +181,7 @@ float ProbeTempComp::get_offset_for_temperature(const TempSensorID tsi, const_fl
// Linear interpolation
uint8_t idx = static_cast<uint8_t>((temp - start_temp) / res_temp);
// offset in um
// offset in µm
float offset = 0.0f;
#if !defined(PTC_LINEAR_EXTRAPOLATION) || PTC_LINEAR_EXTRAPOLATION <= 0

View File

@ -208,7 +208,7 @@ void GcodeSuite::G76() {
report_temps(next_temp_report);
const float measured_z = g76_probe(TSI_BED, target_bed, noz_pos_xyz);
if (isnan(measured_z) || target_bed > BED_MAX_TARGET) break;
if (isnan(measured_z) || target_bed > (BED_MAX_TARGET)) break;
}
SERIAL_ECHOLNPAIR("Retrieved measurements: ", temp_comp.get_index());

View File

@ -236,7 +236,7 @@ void disp_bed_temp() {
}
void disp_fan_speed() {
sprintf_P(public_buf_l, PSTR("%d%%"), thermalManager.fanSpeedPercent(0));
sprintf_P(public_buf_l, PSTR("%d%%"), (int)thermalManager.fanSpeedPercent(0));
lv_label_set_text(labelFan, public_buf_l);
}

View File

@ -178,11 +178,7 @@ void process_lcd_eb_command(const char *command) {
#else
0, 0,
#endif
#if ENABLED(SDSUPPORT)
done_pct,
#else
0,
#endif
TERN(SDSUPPORT, done_pct, 0),
elapsed_buffer
);
write_to_lcd(message_buffer);

View File

@ -296,21 +296,13 @@ namespace ExtUI {
}
float getTargetFan_percent(const fan_t fan) {
#if HAS_FAN
return thermalManager.fanSpeedPercent(fan - FAN0);
#else
UNUSED(fan);
return 0;
#endif
return TERN0(HAS_FAN, thermalManager.fanSpeedPercent(fan - FAN0));
}
float getActualFan_percent(const fan_t fan) {
#if HAS_FAN
return thermalManager.scaledFanSpeedPercent(fan - FAN0);
#else
UNUSED(fan);
return 0;
#endif
return TERN0(HAS_FAN, thermalManager.scaledFanSpeedPercent(fan - FAN0));
}
float getAxisPosition_mm(const axis_t axis) {

View File

@ -567,7 +567,7 @@ volatile bool Temperature::raw_temps_ready = false;
SHV(bias);
#if ENABLED(PRINTER_EVENT_LEDS)
const celsius_float_t start_temp = GHV(temp_chamber.celsius, temp_bed.celsius, temp_hotend[heater_id].celsius);
const celsius_float_t start_temp = GHV(degChamber(), degBed(), degHotend(heater_id));
LEDColor color = ONHEATINGSTART();
#endif
@ -583,7 +583,7 @@ volatile bool Temperature::raw_temps_ready = false;
updateTemperaturesFromRawValues();
// Get the current temperature and constrain it
current_temp = GHV(temp_chamber.celsius, temp_bed.celsius, temp_hotend[heater_id].celsius);
current_temp = GHV(degChamber(), degBed(), degHotend(heater_id));
NOLESS(maxT, current_temp);
NOMORE(minT, current_temp);

View File

@ -1054,8 +1054,6 @@ void tool_change(const uint8_t new_tool, bool no_move/*=false*/) {
first_tool_is_primed = true;
TERN_(TOOLCHANGE_FS_INIT_BEFORE_SWAP, toolchange_extruder_ready[old_tool] = true); // Primed and initialized
}
#else
constexpr bool first_tool_is_primed = true;
#endif
if (new_tool != old_tool || TERN0(PARKING_EXTRUDER, extruder_parked)) { // PARKING_EXTRUDER may need to attach old_tool when homing
@ -1092,7 +1090,7 @@ void tool_change(const uint8_t new_tool, bool no_move/*=false*/) {
}
else {
// For first new tool, change without unloading the old. 'Just prime/init the new'
if (first_tool_is_primed)
if (TERN1(TOOLCHANGE_FS_PRIME_FIRST_USED, first_tool_is_primed))
unscaled_e_move(-toolchange_settings.swap_length, MMM_TO_MMS(toolchange_settings.retract_speed));
TERN_(TOOLCHANGE_FS_PRIME_FIRST_USED, first_tool_is_primed = true); // The first new tool will be primed by toolchanging
}