Clean up formatting, wrap macros

This commit is contained in:
Scott Lahteine 2021-04-23 19:06:55 -05:00 committed by Scott Lahteine
parent 4ab19e7882
commit 9f22aaea2f
16 changed files with 49 additions and 69 deletions

View file

@ -110,7 +110,7 @@ uint8_t BulkStorage::Read(uint8_t lun, uint32_t addr, uint16_t bsize, uint8_t bl
} }
uint8_t BulkStorage::Write(uint8_t lun, uint32_t addr, uint16_t bsize, uint8_t blocks, const uint8_t * buf) { uint8_t BulkStorage::Write(uint8_t lun, uint32_t addr, uint16_t bsize, uint8_t blocks, const uint8_t * buf) {
return USBH_MSC_Write(&hUsbHost, lun, addr, const_cast <uint8_t*>(buf), blocks) != USBH_OK; return USBH_MSC_Write(&hUsbHost, lun, addr, const_cast<uint8_t*>(buf), blocks) != USBH_OK;
} }
#endif // USE_OTG_USB_HOST && USBHOST #endif // USE_OTG_USB_HOST && USBHOST

View file

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

View file

@ -45,7 +45,7 @@ void HotendIdleProtection::check_hotends(const millis_t &ms) {
bool do_prot = false; bool do_prot = false;
HOTEND_LOOP() { HOTEND_LOOP() {
const bool busy = (TERN0(HAS_RESUME_CONTINUE, wait_for_user) || planner.has_blocks_queued()); 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; do_prot = true; break;
} }
} }

View file

@ -36,13 +36,7 @@ private:
static bool leds_off_after_print; static bool leds_off_after_print;
#endif #endif
static inline void set_done() { static inline void set_done() { TERN(LED_COLOR_PRESETS, leds.set_default(), leds.set_off()); }
#if ENABLED(LED_COLOR_PRESETS)
leds.set_default();
#else
leds.set_off();
#endif
}
public: public:
#if HAS_TEMP_HOTEND #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 (TERN0(HAS_HEATED_BED, thermalManager.degTargetBed() > 0 || thermalManager.temp_bed.soft_pwm_amount > 0)) return true;
#if HAS_HOTEND && AUTO_POWER_E_TEMP #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 #endif
#if HAS_HEATED_CHAMBER && AUTO_POWER_CHAMBER_TEMP #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 #endif
#if HAS_COOLER && AUTO_POWER_COOLER_TEMP #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 #endif
return false; return false;

View file

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

View file

@ -208,7 +208,7 @@ void GcodeSuite::G76() {
report_temps(next_temp_report); report_temps(next_temp_report);
const float measured_z = g76_probe(TSI_BED, target_bed, noz_pos_xyz); 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()); SERIAL_ECHOLNPAIR("Retrieved measurements: ", temp_comp.get_index());

View file

@ -700,7 +700,7 @@ void ChironTFT::PanelAction(uint8_t req) {
if (!isPrinting()) { // Ignore request if printing if (!isPrinting()) { // Ignore request if printing
char MoveCmnd[30]; char MoveCmnd[30];
sprintf_P(MoveCmnd, PSTR("G91\nG0 %s \nG90"), panel_command+3); sprintf_P(MoveCmnd, PSTR("G91\nG0%s\nG90"), panel_command + 3);
#if ACDEBUG(AC_ACTION) #if ACDEBUG(AC_ACTION)
SERIAL_ECHOLNPAIR("Move: ", MoveCmnd); SERIAL_ECHOLNPAIR("Move: ", MoveCmnd);
#endif #endif

View file

@ -700,13 +700,13 @@ void AnycubicTFTClass::GetCommandFromTFT() {
unsigned int tempvalue; unsigned int tempvalue;
if (CodeSeen('S')) { if (CodeSeen('S')) {
tempvalue = constrain(CodeValue(), 0, 275); tempvalue = constrain(CodeValue(), 0, 275);
setTargetTemp_celsius(tempvalue, (extruder_t) E0); setTargetTemp_celsius(tempvalue, (extruder_t)E0);
} }
else if (CodeSeen('C') && !isPrinting()) { else if (CodeSeen('C') && !isPrinting()) {
if (getAxisPosition_mm(Z) < 10) if (getAxisPosition_mm(Z) < 10)
injectCommands_P(PSTR("G1 Z10")); // RASE Z AXIS injectCommands_P(PSTR("G1 Z10")); // RASE Z AXIS
tempvalue = constrain(CodeValue(), 0, 275); tempvalue = constrain(CodeValue(), 0, 275);
setTargetTemp_celsius(tempvalue, (extruder_t) E0); setTargetTemp_celsius(tempvalue, (extruder_t)E0);
} }
} }
break; break;
@ -832,8 +832,8 @@ void AnycubicTFTClass::GetCommandFromTFT() {
if (getAxisPosition_mm(Z) < 10) if (getAxisPosition_mm(Z) < 10)
injectCommands_P(PSTR("G1 Z10")); // RASE Z AXIS injectCommands_P(PSTR("G1 Z10")); // RASE Z AXIS
setTargetTemp_celsius(PREHEAT_1_TEMP_BED, (heater_t) BED); setTargetTemp_celsius(PREHEAT_1_TEMP_BED, (heater_t)BED);
setTargetTemp_celsius(PREHEAT_1_TEMP_HOTEND, (extruder_t) E0); setTargetTemp_celsius(PREHEAT_1_TEMP_HOTEND, (extruder_t)E0);
SENDLINE_PGM("OK"); SENDLINE_PGM("OK");
} }
break; break;
@ -843,8 +843,8 @@ void AnycubicTFTClass::GetCommandFromTFT() {
if (getAxisPosition_mm(Z) < 10) if (getAxisPosition_mm(Z) < 10)
injectCommands_P(PSTR("G1 Z10")); // RASE Z AXIS injectCommands_P(PSTR("G1 Z10")); // RASE Z AXIS
setTargetTemp_celsius(PREHEAT_2_TEMP_BED, (heater_t) BED); setTargetTemp_celsius(PREHEAT_2_TEMP_BED, (heater_t)BED);
setTargetTemp_celsius(PREHEAT_2_TEMP_HOTEND, (extruder_t) E0); setTargetTemp_celsius(PREHEAT_2_TEMP_HOTEND, (extruder_t)E0);
SENDLINE_PGM("OK"); SENDLINE_PGM("OK");
} }
break; break;

View file

@ -236,7 +236,7 @@ void disp_bed_temp() {
} }
void disp_fan_speed() { 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); lv_label_set_text(labelFan, public_buf_l);
} }

View file

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

View file

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

View file

@ -102,11 +102,11 @@ namespace ExtUI {
#if HAS_TRINAMIC_CONFIG #if HAS_TRINAMIC_CONFIG
float getAxisCurrent_mA(const axis_t); float getAxisCurrent_mA(const axis_t);
float getAxisCurrent_mA(const extruder_t); float getAxisCurrent_mA(const extruder_t);
void setAxisCurrent_mA(const_float_t , const axis_t); void setAxisCurrent_mA(const_float_t, const axis_t);
void setAxisCurrent_mA(const_float_t , const extruder_t); void setAxisCurrent_mA(const_float_t, const extruder_t);
int getTMCBumpSensitivity(const axis_t); int getTMCBumpSensitivity(const axis_t);
void setTMCBumpSensitivity(const_float_t , const axis_t); void setTMCBumpSensitivity(const_float_t, const axis_t);
#endif #endif
celsius_float_t getActualTemp_celsius(const heater_t); celsius_float_t getActualTemp_celsius(const heater_t);
@ -195,18 +195,18 @@ namespace ExtUI {
char* getFilamentUsed_str(char buffer[21]); char* getFilamentUsed_str(char buffer[21]);
#endif #endif
void setTargetTemp_celsius(const_float_t , const heater_t); void setTargetTemp_celsius(const_float_t, const heater_t);
void setTargetTemp_celsius(const_float_t , const extruder_t); void setTargetTemp_celsius(const_float_t, const extruder_t);
void setTargetFan_percent(const_float_t , const fan_t); void setTargetFan_percent(const_float_t, const fan_t);
void coolDown(); void coolDown();
void setAxisPosition_mm(const_float_t , const axis_t, const feedRate_t=0); void setAxisPosition_mm(const_float_t, const axis_t, const feedRate_t=0);
void setAxisPosition_mm(const_float_t , const extruder_t, const feedRate_t=0); void setAxisPosition_mm(const_float_t, const extruder_t, const feedRate_t=0);
void setAxisSteps_per_mm(const_float_t , const axis_t); void setAxisSteps_per_mm(const_float_t, const axis_t);
void setAxisSteps_per_mm(const_float_t , const extruder_t); void setAxisSteps_per_mm(const_float_t, const extruder_t);
void setAxisMaxFeedrate_mm_s(const feedRate_t, const axis_t); void setAxisMaxFeedrate_mm_s(const feedRate_t, const axis_t);
void setAxisMaxFeedrate_mm_s(const feedRate_t, const extruder_t); void setAxisMaxFeedrate_mm_s(const feedRate_t, const extruder_t);
void setAxisMaxAcceleration_mm_s2(const_float_t , const axis_t); void setAxisMaxAcceleration_mm_s2(const_float_t, const axis_t);
void setAxisMaxAcceleration_mm_s2(const_float_t , const extruder_t); void setAxisMaxAcceleration_mm_s2(const_float_t, const extruder_t);
void setFeedrate_mm_s(const feedRate_t); void setFeedrate_mm_s(const feedRate_t);
void setMinFeedrate_mm_s(const feedRate_t); void setMinFeedrate_mm_s(const feedRate_t);
void setMinTravelFeedrate_mm_s(const feedRate_t); void setMinTravelFeedrate_mm_s(const feedRate_t);
@ -220,7 +220,7 @@ namespace ExtUI {
#if ENABLED(LIN_ADVANCE) #if ENABLED(LIN_ADVANCE)
float getLinearAdvance_mm_mm_s(const extruder_t); float getLinearAdvance_mm_mm_s(const extruder_t);
void setLinearAdvance_mm_mm_s(const_float_t , const extruder_t); void setLinearAdvance_mm_mm_s(const_float_t, const extruder_t);
#endif #endif
#if HAS_JUNCTION_DEVIATION #if HAS_JUNCTION_DEVIATION
@ -229,8 +229,8 @@ namespace ExtUI {
#else #else
float getAxisMaxJerk_mm_s(const axis_t); float getAxisMaxJerk_mm_s(const axis_t);
float getAxisMaxJerk_mm_s(const extruder_t); float getAxisMaxJerk_mm_s(const extruder_t);
void setAxisMaxJerk_mm_s(const_float_t , const axis_t); void setAxisMaxJerk_mm_s(const_float_t, const axis_t);
void setAxisMaxJerk_mm_s(const_float_t , const extruder_t); void setAxisMaxJerk_mm_s(const_float_t, const extruder_t);
#endif #endif
extruder_t getTool(const uint8_t extruder); extruder_t getTool(const uint8_t extruder);
@ -246,7 +246,7 @@ namespace ExtUI {
#if HAS_HOTEND_OFFSET #if HAS_HOTEND_OFFSET
float getNozzleOffset_mm(const axis_t, const extruder_t); float getNozzleOffset_mm(const axis_t, const extruder_t);
void setNozzleOffset_mm(const_float_t , const axis_t, const extruder_t); void setNozzleOffset_mm(const_float_t, const axis_t, const extruder_t);
void normalizeNozzleOffset(const axis_t axis); void normalizeNozzleOffset(const axis_t axis);
#endif #endif
@ -255,12 +255,12 @@ namespace ExtUI {
#if HAS_BED_PROBE #if HAS_BED_PROBE
float getProbeOffset_mm(const axis_t); float getProbeOffset_mm(const axis_t);
void setProbeOffset_mm(const_float_t , const axis_t); void setProbeOffset_mm(const_float_t, const axis_t);
#endif #endif
#if ENABLED(BACKLASH_GCODE) #if ENABLED(BACKLASH_GCODE)
float getAxisBacklash_mm(const axis_t); float getAxisBacklash_mm(const axis_t);
void setAxisBacklash_mm(const_float_t , const axis_t); void setAxisBacklash_mm(const_float_t, const axis_t);
float getBacklashCorrection_percent(); float getBacklashCorrection_percent();
void setBacklashCorrection_percent(const_float_t ); void setBacklashCorrection_percent(const_float_t );
@ -297,15 +297,15 @@ namespace ExtUI {
float getPIDValues_Kp(const extruder_t); float getPIDValues_Kp(const extruder_t);
float getPIDValues_Ki(const extruder_t); float getPIDValues_Ki(const extruder_t);
float getPIDValues_Kd(const extruder_t); float getPIDValues_Kd(const extruder_t);
void setPIDValues(const_float_t , const_float_t , const_float_t , extruder_t); void setPIDValues(const_float_t, const_float_t , const_float_t , extruder_t);
void startPIDTune(const_float_t , extruder_t); void startPIDTune(const_float_t, extruder_t);
#endif #endif
#if ENABLED(PIDTEMPBED) #if ENABLED(PIDTEMPBED)
float getBedPIDValues_Kp(); float getBedPIDValues_Kp();
float getBedPIDValues_Ki(); float getBedPIDValues_Ki();
float getBedPIDValues_Kd(); float getBedPIDValues_Kd();
void setBedPIDValues(const_float_t , const_float_t , const_float_t ); void setBedPIDValues(const_float_t, const_float_t , const_float_t );
void startBedPIDTune(const_float_t ); void startBedPIDTune(const_float_t );
#endif #endif

View file

@ -567,7 +567,7 @@ volatile bool Temperature::raw_temps_ready = false;
SHV(bias); SHV(bias);
#if ENABLED(PRINTER_EVENT_LEDS) #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(); LEDColor color = ONHEATINGSTART();
#endif #endif
@ -583,7 +583,7 @@ volatile bool Temperature::raw_temps_ready = false;
updateTemperaturesFromRawValues(); updateTemperaturesFromRawValues();
// Get the current temperature and constrain it // 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); NOLESS(maxT, current_temp);
NOMORE(minT, 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; first_tool_is_primed = true;
TERN_(TOOLCHANGE_FS_INIT_BEFORE_SWAP, toolchange_extruder_ready[old_tool] = true); // Primed and initialized TERN_(TOOLCHANGE_FS_INIT_BEFORE_SWAP, toolchange_extruder_ready[old_tool] = true); // Primed and initialized
} }
#else
constexpr bool first_tool_is_primed = true;
#endif #endif
if (new_tool != old_tool || TERN0(PARKING_EXTRUDER, extruder_parked)) { // PARKING_EXTRUDER may need to attach old_tool when homing 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 { else {
// For first new tool, change without unloading the old. 'Just prime/init the new' // 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)); 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 TERN_(TOOLCHANGE_FS_PRIME_FIRST_USED, first_tool_is_primed = true); // The first new tool will be primed by toolchanging
} }