Browse Source

Clean up formatting, wrap macros

vanilla_fb_2.0.x
Scott Lahteine 4 years ago
parent
commit
3bddbb1110
  1. 2
      Marlin/src/HAL/STM32/usb_host.cpp
  2. 2
      Marlin/src/MarlinCore.cpp
  3. 2
      Marlin/src/feature/hotend_idle.cpp
  4. 8
      Marlin/src/feature/leds/printer_event_leds.h
  5. 6
      Marlin/src/feature/power.cpp
  6. 2
      Marlin/src/feature/probe_temp_comp.cpp
  7. 6
      Marlin/src/feature/probe_temp_comp.h
  8. 2
      Marlin/src/gcode/calibrate/G76_M192_M871.cpp
  9. 2
      Marlin/src/lcd/extui/lib/anycubic_chiron/chiron_tft.cpp
  10. 12
      Marlin/src/lcd/extui/lib/anycubic_i3mega/anycubic_i3mega_lcd.cpp
  11. 2
      Marlin/src/lcd/extui/lib/mks_ui/draw_printing.cpp
  12. 6
      Marlin/src/lcd/extui/malyan_lcd.cpp
  13. 16
      Marlin/src/lcd/extui/ui_api.cpp
  14. 42
      Marlin/src/lcd/extui/ui_api.h
  15. 4
      Marlin/src/module/temperature.cpp
  16. 4
      Marlin/src/module/tool_change.cpp

2
Marlin/src/HAL/STM32/usb_host.cpp

@ -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

2
Marlin/src/MarlinCore.cpp

@ -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()
) { ) {

2
Marlin/src/feature/hotend_idle.cpp

@ -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;
} }
} }

8
Marlin/src/feature/leds/printer_event_leds.h

@ -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

6
Marlin/src/feature/power.cpp

@ -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;

2
Marlin/src/feature/probe_temp_comp.cpp

@ -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

6
Marlin/src/feature/probe_temp_comp.h

@ -81,10 +81,10 @@ typedef struct {
#endif #endif
static constexpr temp_calib_t cali_info_init[TSI_COUNT] = { static constexpr temp_calib_t cali_info_init[TSI_COUNT] = {
{ PTC_SAMPLE_COUNT, PTC_SAMPLE_RES, PTC_SAMPLE_START, PTC_SAMPLE_END }, // Probe { PTC_SAMPLE_COUNT, PTC_SAMPLE_RES, PTC_SAMPLE_START, PTC_SAMPLE_END }, // Probe
{ BTC_SAMPLE_COUNT, BTC_SAMPLE_RES, BTC_SAMPLE_START, BTC_SAMPLE_END }, // Bed { BTC_SAMPLE_COUNT, BTC_SAMPLE_RES, BTC_SAMPLE_START, BTC_SAMPLE_END }, // Bed
#if ENABLED(USE_TEMP_EXT_COMPENSATION) #if ENABLED(USE_TEMP_EXT_COMPENSATION)
{ 20, 5, 180, 180 + 5 * 20 } // Extruder { 20, 5, 180, 180 + 5 * 20 } // Extruder
#endif #endif
}; };

2
Marlin/src/gcode/calibrate/G76_M192_M871.cpp

@ -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());

2
Marlin/src/lcd/extui/lib/anycubic_chiron/chiron_tft.cpp

@ -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

12
Marlin/src/lcd/extui/lib/anycubic_i3mega/anycubic_i3mega_lcd.cpp

@ -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;

2
Marlin/src/lcd/extui/lib/mks_ui/draw_printing.cpp

@ -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);
} }

6
Marlin/src/lcd/extui/malyan_lcd.cpp

@ -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);

16
Marlin/src/lcd/extui/ui_api.cpp

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

42
Marlin/src/lcd/extui/ui_api.h

@ -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

4
Marlin/src/module/temperature.cpp

@ -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);

4
Marlin/src/module/tool_change.cpp

@ -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
} }

Loading…
Cancel
Save