Browse Source

Reduce need for UNUSED

pull/1/head
Scott Lahteine 5 years ago
parent
commit
e3fd0519b3
  1. 3
      Marlin/src/HAL/HAL_AVR/HAL.h
  2. 9
      Marlin/src/HAL/HAL_AVR/HAL_SPI.cpp
  3. 3
      Marlin/src/HAL/HAL_DUE/HAL_SPI.cpp
  4. 7
      Marlin/src/HAL/HAL_DUE/MarlinSerialUSB.cpp
  5. 13
      Marlin/src/HAL/HAL_DUE/usb/sd_mmc_spi_mem.cpp
  6. 2
      Marlin/src/HAL/HAL_ESP32/watchdog.h
  7. 2
      Marlin/src/HAL/HAL_LINUX/HAL.h
  8. 4
      Marlin/src/HAL/HAL_LINUX/include/serial.h
  9. 2
      Marlin/src/HAL/HAL_LPC1768/MarlinSerial.h
  10. 14
      Marlin/src/HAL/HAL_STM32/HAL.cpp
  11. 2
      Marlin/src/HAL/HAL_STM32_F4_F7/HAL.h
  12. 2
      Marlin/src/HAL/HAL_TEENSY31_32/HAL.h
  13. 2
      Marlin/src/HAL/HAL_TEENSY35_36/HAL.h
  14. 2
      Marlin/src/HAL/shared/Delay.h
  15. 2
      Marlin/src/feature/Max7219_Debug_LEDs.h
  16. 3
      Marlin/src/feature/leds/pca9632.cpp
  17. 2
      Marlin/src/feature/power_loss_recovery.h
  18. 6
      Marlin/src/feature/runout.h
  19. 2
      Marlin/src/feature/spindle_laser.h
  20. 4
      Marlin/src/gcode/parser.h
  21. 6
      Marlin/src/lcd/menu/menu.h
  22. 1
      Marlin/src/lcd/menu/menu_media.cpp
  23. 10
      Marlin/src/lcd/ultralcd.h
  24. 2
      Marlin/src/module/configuration_store.h
  25. 12
      Marlin/src/module/motion.h
  26. 7
      Marlin/src/module/planner.h
  27. 2
      Marlin/src/module/stepper.h
  28. 29
      Marlin/src/module/temperature.cpp
  29. 64
      Marlin/src/module/temperature.h
  30. 2
      Marlin/src/sd/usb_flashdrive/Sd2Card_FlashDrive.h
  31. 2
      Marlin/src/sd/usb_flashdrive/lib-uhs2/parsetools.h

3
Marlin/src/HAL/HAL_AVR/HAL.h

@ -146,8 +146,7 @@ extern "C" {
#define DISABLE_TEMPERATURE_INTERRUPT() CBI(TIMSK0, OCIE0B) #define DISABLE_TEMPERATURE_INTERRUPT() CBI(TIMSK0, OCIE0B)
#define TEMPERATURE_ISR_ENABLED() TEST(TIMSK0, OCIE0B) #define TEMPERATURE_ISR_ENABLED() TEST(TIMSK0, OCIE0B)
FORCE_INLINE void HAL_timer_start(const uint8_t timer_num, const uint32_t frequency) { FORCE_INLINE void HAL_timer_start(const uint8_t timer_num, const uint32_t) {
UNUSED(frequency);
switch (timer_num) { switch (timer_num) {
case STEP_TIMER_NUM: case STEP_TIMER_NUM:
// waveform generation = 0100 = CTC // waveform generation = 0100 = CTC

9
Marlin/src/HAL/HAL_AVR/HAL_SPI.cpp

@ -184,15 +184,10 @@ void spiBegin() {
// nop to tune soft SPI timing // nop to tune soft SPI timing
#define nop asm volatile ("\tnop\n") #define nop asm volatile ("\tnop\n")
// Set SPI rate void spiInit(uint8_t) { /* do nothing */ }
void spiInit(uint8_t spiRate) {
UNUSED(spiRate); // nothing to do
}
// Begin SPI transaction, set clock, bit order, data mode // Begin SPI transaction, set clock, bit order, data mode
void spiBeginTransaction(uint32_t spiClock, uint8_t bitOrder, uint8_t dataMode) { void spiBeginTransaction(uint32_t spiClock, uint8_t bitOrder, uint8_t dataMode) { /* do nothing */ }
UNUSED(spiBeginTransaction); // nothing to do
}
// Soft SPI receive byte // Soft SPI receive byte
uint8_t spiRec() { uint8_t spiRec() {

3
Marlin/src/HAL/HAL_DUE/HAL_SPI.cpp

@ -151,13 +151,12 @@
(((uint32_t)(addr) & 0xF0000000) + 0x02000000 + ((uint32_t)(addr)&0xFFFFF)*32 + (bit)*4) (((uint32_t)(addr) & 0xF0000000) + 0x02000000 + ((uint32_t)(addr)&0xFFFFF)*32 + (bit)*4)
// run at ~8 .. ~10Mhz - Rx version (Tx line not altered) // run at ~8 .. ~10Mhz - Rx version (Tx line not altered)
static uint8_t spiTransferRx0(uint8_t bout) { // using Mode 0 static uint8_t spiTransferRx0(uint8_t) { // using Mode 0
uint32_t bin = 0; uint32_t bin = 0;
uint32_t work = 0; uint32_t work = 0;
uint32_t BITBAND_MISO_PORT = BITBAND_ADDRESS( ((uint32_t)PORT(MISO_PIN))+0x3C, PIN_SHIFT(MISO_PIN)); /* PDSR of port in bitband area */ uint32_t BITBAND_MISO_PORT = BITBAND_ADDRESS( ((uint32_t)PORT(MISO_PIN))+0x3C, PIN_SHIFT(MISO_PIN)); /* PDSR of port in bitband area */
uint32_t SCK_PORT_PLUS30 = ((uint32_t) PORT(SCK_PIN)) + 0x30; /* SODR of port */ uint32_t SCK_PORT_PLUS30 = ((uint32_t) PORT(SCK_PIN)) + 0x30; /* SODR of port */
uint32_t SCK_MASK = PIN_MASK(SCK_PIN); uint32_t SCK_MASK = PIN_MASK(SCK_PIN);
UNUSED(bout);
/* The software SPI routine */ /* The software SPI routine */
__asm__ __volatile__( __asm__ __volatile__(

7
Marlin/src/HAL/HAL_DUE/MarlinSerialUSB.cpp

@ -55,12 +55,9 @@ static int pending_char = -1;
#endif #endif
// Public Methods // Public Methods
void MarlinSerialUSB::begin(const long baud_setting) { void MarlinSerialUSB::begin(const long) {}
UNUSED(baud_setting);
}
void MarlinSerialUSB::end() { void MarlinSerialUSB::end() {}
}
int MarlinSerialUSB::peek() { int MarlinSerialUSB::peek() {
if (pending_char >= 0) if (pending_char >= 0)

13
Marlin/src/HAL/HAL_DUE/usb/sd_mmc_spi_mem.cpp

@ -33,19 +33,12 @@ Ctrl_status sd_mmc_spi_read_capacity(uint32_t *nb_sector) {
return CTRL_GOOD; return CTRL_GOOD;
} }
bool sd_mmc_spi_unload(bool unload) { bool sd_mmc_spi_unload(bool) { return true; }
UNUSED(unload);
return true;
}
bool sd_mmc_spi_wr_protect() { bool sd_mmc_spi_wr_protect() { return false; }
return false;
}
bool sd_mmc_spi_removal() { bool sd_mmc_spi_removal() {
if (!IS_SD_INSERTED() || IS_SD_PRINTING() || IS_SD_FILE_OPEN() || !card.isMounted()) return (!IS_SD_INSERTED() || IS_SD_PRINTING() || IS_SD_FILE_OPEN() || !card.isMounted());
return true;
return false;
} }
#if ACCESS_USB == true #if ACCESS_USB == true

2
Marlin/src/HAL/HAL_ESP32/watchdog.h

@ -25,4 +25,4 @@
void watchdog_init(); void watchdog_init();
// Reset watchdog. // Reset watchdog.
inline void HAL_watchdog_refresh() { } inline void HAL_watchdog_refresh() {}

2
Marlin/src/HAL/HAL_LINUX/HAL.h

@ -78,7 +78,7 @@ extern HalSerial usb_serial;
#define ENABLE_ISRS() #define ENABLE_ISRS()
#define DISABLE_ISRS() #define DISABLE_ISRS()
inline void HAL_init() { } inline void HAL_init() {}
// Utility functions // Utility functions
#pragma GCC diagnostic push #pragma GCC diagnostic push

4
Marlin/src/HAL/HAL_LINUX/include/serial.h

@ -83,9 +83,9 @@ public:
HalSerial() { host_connected = true; } HalSerial() { host_connected = true; }
void begin(int32_t baud) { } void begin(int32_t) {}
void end() { } void end() {}
int peek() { int peek() {
uint8_t value; uint8_t value;

2
Marlin/src/HAL/HAL_LPC1768/MarlinSerial.h

@ -49,7 +49,7 @@ public:
{ {
} }
void end() { } void end() {}
#if ENABLED(EMERGENCY_PARSER) #if ENABLED(EMERGENCY_PARSER)
bool recv_callback(const char c) override { bool recv_callback(const char c) override {

14
Marlin/src/HAL/HAL_STM32/HAL.cpp

@ -104,17 +104,11 @@ extern "C" {
// ADC // ADC
// ------------------------ // ------------------------
void HAL_adc_start_conversion(const uint8_t adc_pin) { // TODO: Make sure this doesn't cause any delay
HAL_adc_result = analogRead(adc_pin); void HAL_adc_start_conversion(const uint8_t adc_pin) { HAL_adc_result = analogRead(adc_pin); }
}
uint16_t HAL_adc_get_result() { uint16_t HAL_adc_get_result() { return HAL_adc_result; }
return HAL_adc_result;
}
void flashFirmware(int16_t value) { void flashFirmware(int16_t) { NVIC_SystemReset(); }
UNUSED(value);
NVIC_SystemReset();
}
#endif // ARDUINO_ARCH_STM32 && !STM32GENERIC #endif // ARDUINO_ARCH_STM32 && !STM32GENERIC

2
Marlin/src/HAL/HAL_STM32_F4_F7/HAL.h

@ -150,7 +150,7 @@ extern uint16_t HAL_adc_result;
// Memory related // Memory related
#define __bss_end __bss_end__ #define __bss_end __bss_end__
inline void HAL_init() { } inline void HAL_init() {}
// Clear reset reason // Clear reset reason
void HAL_clear_reset_source(); void HAL_clear_reset_source();

2
Marlin/src/HAL/HAL_TEENSY31_32/HAL.h

@ -87,7 +87,7 @@ typedef int8_t pin_t;
#undef pgm_read_word #undef pgm_read_word
#define pgm_read_word(addr) (*((uint16_t*)(addr))) #define pgm_read_word(addr) (*((uint16_t*)(addr)))
inline void HAL_init() { } inline void HAL_init() {}
// Clear the reset reason // Clear the reset reason
void HAL_clear_reset_source(); void HAL_clear_reset_source();

2
Marlin/src/HAL/HAL_TEENSY35_36/HAL.h

@ -93,7 +93,7 @@ typedef int8_t pin_t;
#undef pgm_read_word #undef pgm_read_word
#define pgm_read_word(addr) (*((uint16_t*)(addr))) #define pgm_read_word(addr) (*((uint16_t*)(addr)))
inline void HAL_init() { } inline void HAL_init() {}
// Clear reset reason // Clear reset reason
void HAL_clear_reset_source(); void HAL_clear_reset_source();

2
Marlin/src/HAL/shared/Delay.h

@ -53,7 +53,7 @@
FORCE_INLINE static void DELAY_CYCLES(const uint32_t x) { FORCE_INLINE static void DELAY_CYCLES(const uint32_t x) {
const uint32_t endCycles = getCycleCount() + x; const uint32_t endCycles = getCycleCount() + x;
while (PENDING(getCycleCount(), endCycles)) { } while (PENDING(getCycleCount(), endCycles)) {}
} }
#else #else

2
Marlin/src/feature/Max7219_Debug_LEDs.h

@ -75,7 +75,7 @@ class Max7219 {
public: public:
static uint8_t led_line[MAX7219_LINES]; static uint8_t led_line[MAX7219_LINES];
Max7219() { } Max7219() {}
static void init(); static void init();
static void register_setup(); static void register_setup();

3
Marlin/src/feature/leds/pca9632.cpp

@ -138,8 +138,7 @@ void pca9632_set_led_color(const LEDColor &color) {
#if ENABLED(PCA9632_BUZZER) #if ENABLED(PCA9632_BUZZER)
void pca9632_buzz(const long duration, const uint16_t freq) { void pca9632_buzz(const long, const uint16_t) {
UNUSED(duration); UNUSED(freq);
uint8_t data[] = PCA9632_BUZZER_DATA; uint8_t data[] = PCA9632_BUZZER_DATA;
Wire.beginTransmission(I2C_ADDRESS(PCA9632_ADDRESS)); Wire.beginTransmission(I2C_ADDRESS(PCA9632_ADDRESS));
Wire.write(data, sizeof(data)); Wire.write(data, sizeof(data));

2
Marlin/src/feature/power_loss_recovery.h

@ -169,7 +169,7 @@ class PrintJobRecovery {
#if ENABLED(DEBUG_POWER_LOSS_RECOVERY) #if ENABLED(DEBUG_POWER_LOSS_RECOVERY)
static void debug(PGM_P const prefix); static void debug(PGM_P const prefix);
#else #else
static inline void debug(PGM_P const prefix) { UNUSED(prefix); } static inline void debug(PGM_P const) {}
#endif #endif
private: private:

6
Marlin/src/feature/runout.h

@ -266,7 +266,7 @@ class FilamentSensorBase {
} }
public: public:
static inline void block_completed(const block_t* const b) { UNUSED(b); } static inline void block_completed(const block_t* const) {}
static inline void run() { static inline void run() {
const bool out = poll_runout_state(active_extruder); const bool out = poll_runout_state(active_extruder);
@ -353,8 +353,8 @@ class FilamentSensorBase {
static inline void reset() { runout_count = runout_threshold; } static inline void reset() { runout_count = runout_threshold; }
static inline void run() { if (runout_count >= 0) runout_count--; } static inline void run() { if (runout_count >= 0) runout_count--; }
static inline bool has_run_out() { return runout_count < 0; } static inline bool has_run_out() { return runout_count < 0; }
static inline void block_completed(const block_t* const b) { UNUSED(b); } static inline void block_completed(const block_t* const) { }
static inline void filament_present(const uint8_t extruder) { runout_count = runout_threshold; UNUSED(extruder); } static inline void filament_present(const uint8_t) { runout_count = runout_threshold; }
}; };
#endif // !FILAMENT_RUNOUT_DISTANCE_MM #endif // !FILAMENT_RUNOUT_DISTANCE_MM

2
Marlin/src/feature/spindle_laser.h

@ -70,7 +70,7 @@ public:
#if ENABLED(SPINDLE_CHANGE_DIR) #if ENABLED(SPINDLE_CHANGE_DIR)
static void set_direction(const bool reverse); static void set_direction(const bool reverse);
#else #else
static inline void set_direction(const bool reverse) { UNUSED(reverse); } static inline void set_direction(const bool) {}
#endif #endif
static inline void disable() { set_enabled(false); } static inline void disable() { set_enabled(false); }

4
Marlin/src/gcode/parser.h

@ -291,8 +291,8 @@ public:
static inline float mm_to_volumetric_unit(const float mm) { return mm; } static inline float mm_to_volumetric_unit(const float mm) { return mm; }
static inline float linear_value_to_mm(const float v) { return v; } static inline float linear_value_to_mm(const float v) { return v; }
static inline float axis_value_to_mm(const AxisEnum axis, const float v) { UNUSED(axis); return v; } static inline float axis_value_to_mm(const AxisEnum, const float v) { return v; }
static inline float per_axis_value(const AxisEnum axis, const float v) { UNUSED(axis); return v; } static inline float per_axis_value(const AxisEnum, const float v) { return v; }
#endif #endif

6
Marlin/src/lcd/menu/menu.h

@ -114,8 +114,7 @@ FORCE_INLINE void draw_menu_item_edit_P(const bool sel, const uint8_t row, PGM_P
FORCE_INLINE void draw_menu_item_edit_##NAME (const bool sel, const uint8_t row, PGM_P const pstr, TYPE * const data, ...) { \ FORCE_INLINE void draw_menu_item_edit_##NAME (const bool sel, const uint8_t row, PGM_P const pstr, TYPE * const data, ...) { \
DRAW_MENU_ITEM_SETTING_EDIT_GENERIC(STRFUNC(*(data))); \ DRAW_MENU_ITEM_SETTING_EDIT_GENERIC(STRFUNC(*(data))); \
} \ } \
FORCE_INLINE void draw_menu_item_edit_accessor_##NAME (const bool sel, const uint8_t row, PGM_P const pstr, PGM_P const pstr2, TYPE (*pget)(), void (*pset)(TYPE), ...) { \ FORCE_INLINE void draw_menu_item_edit_accessor_##NAME (const bool sel, const uint8_t row, PGM_P const pstr, PGM_P const, TYPE (*pget)(), void (*)(TYPE), ...) { \
UNUSED(pstr2); UNUSED(pset); \
DRAW_MENU_ITEM_SETTING_EDIT_GENERIC(STRFUNC(pget())); \ DRAW_MENU_ITEM_SETTING_EDIT_GENERIC(STRFUNC(pget())); \
} \ } \
typedef void NAME##_void typedef void NAME##_void
@ -149,13 +148,12 @@ DEFINE_DRAW_MENU_ITEM_SETTING_EDIT(long5_25); // 12345 right-justif
class MenuItem_back { class MenuItem_back {
public: public:
static inline void action(PGM_P const dummy=nullptr) { static inline void action(PGM_P const=nullptr) {
ui.goto_previous_screen( ui.goto_previous_screen(
#if ENABLED(TURBO_BACK_MENU_ITEM) #if ENABLED(TURBO_BACK_MENU_ITEM)
true true
#endif #endif
); );
UNUSED(dummy);
} }
}; };

1
Marlin/src/lcd/menu/menu_media.cpp

@ -108,6 +108,7 @@ class MenuItem_sdfile {
MenuItem_submenu::action(pstr, menu_sd_confirm); MenuItem_submenu::action(pstr, menu_sd_confirm);
#else #else
sdcard_start_selected_file(); sdcard_start_selected_file();
UNUSED(pstr);
#endif #endif
} }
}; };

10
Marlin/src/lcd/ultralcd.h

@ -273,7 +273,7 @@ public:
static void init(); static void init();
static void update(); static void update();
static void set_alert_status_P(PGM_P message); static void set_alert_status_P(PGM_P const message);
static char status_message[]; static char status_message[];
static bool has_status(); static bool has_status();
@ -393,10 +393,10 @@ public:
static inline void update() {} static inline void update() {}
static inline void refresh() {} static inline void refresh() {}
static inline void return_to_status() {} static inline void return_to_status() {}
static inline void set_alert_status_P(PGM_P message) { UNUSED(message); } static inline void set_alert_status_P(PGM_P const) {}
static inline void set_status(const char* const message, const bool persist=false) { UNUSED(message); UNUSED(persist); } static inline void set_status(const char* const, const bool=false) {}
static inline void set_status_P(PGM_P const message, const int8_t level=0) { UNUSED(message); UNUSED(level); } static inline void set_status_P(PGM_P const, const int8_t=0) {}
static inline void status_printf_P(const uint8_t level, PGM_P const fmt, ...) { UNUSED(level); UNUSED(fmt); } static inline void status_printf_P(const uint8_t, PGM_P const, ...) {}
static inline void reset_status() {} static inline void reset_status() {}
static inline void reset_alert_level() {} static inline void reset_alert_level() {}
static constexpr bool has_status() { return false; } static constexpr bool has_status() { return false; }

2
Marlin/src/module/configuration_store.h

@ -85,7 +85,7 @@ class MarlinSettings {
static void report(const bool forReplay=false); static void report(const bool forReplay=false);
#else #else
FORCE_INLINE FORCE_INLINE
static void report(const bool forReplay=false) { UNUSED(forReplay); } static void report(const bool=false) {}
#endif #endif
private: private:

12
Marlin/src/module/motion.h

@ -279,12 +279,12 @@ void homeaxis(const AxisEnum axis);
#else #else
#define NATIVE_TO_LOGICAL(POS, AXIS) (POS) #define NATIVE_TO_LOGICAL(POS, AXIS) (POS)
#define LOGICAL_TO_NATIVE(POS, AXIS) (POS) #define LOGICAL_TO_NATIVE(POS, AXIS) (POS)
FORCE_INLINE void toLogical(xy_pos_t &raw) { UNUSED(raw); } FORCE_INLINE void toLogical(xy_pos_t&) {}
FORCE_INLINE void toLogical(xyz_pos_t &raw) { UNUSED(raw); } FORCE_INLINE void toLogical(xyz_pos_t&) {}
FORCE_INLINE void toLogical(xyze_pos_t &raw) { UNUSED(raw); } FORCE_INLINE void toLogical(xyze_pos_t&) {}
FORCE_INLINE void toNative(xy_pos_t &raw) { UNUSED(raw); } FORCE_INLINE void toNative(xy_pos_t&) {}
FORCE_INLINE void toNative(xyz_pos_t &raw) { UNUSED(raw); } FORCE_INLINE void toNative(xyz_pos_t&) {}
FORCE_INLINE void toNative(xyze_pos_t &raw) { UNUSED(raw); } FORCE_INLINE void toNative(xyze_pos_t&) {}
#endif #endif
#define LOGICAL_X_POSITION(POS) NATIVE_TO_LOGICAL(POS, X_AXIS) #define LOGICAL_X_POSITION(POS) NATIVE_TO_LOGICAL(POS, X_AXIS)
#define LOGICAL_Y_POSITION(POS) NATIVE_TO_LOGICAL(POS, Y_AXIS) #define LOGICAL_Y_POSITION(POS) NATIVE_TO_LOGICAL(POS, Y_AXIS)

7
Marlin/src/module/planner.h

@ -431,12 +431,9 @@ class Planner {
#else #else
FORCE_INLINE static float fade_scaling_factor_for_z(const float &rz) { FORCE_INLINE static float fade_scaling_factor_for_z(const float&) { return 1; }
UNUSED(rz);
return 1;
}
FORCE_INLINE static bool leveling_active_at_z(const float &rz) { UNUSED(rz); return true; } FORCE_INLINE static bool leveling_active_at_z(const float&) { return true; }
#endif #endif

2
Marlin/src/module/stepper.h

@ -337,7 +337,7 @@ class Stepper {
// //
// Constructor / initializer // Constructor / initializer
// //
Stepper() { }; Stepper() {};
// Initialize stepper hardware // Initialize stepper hardware
static void init(); static void init();

29
Marlin/src/module/temperature.cpp

@ -813,13 +813,7 @@ void Temperature::min_temp_error(const heater_ind_t heater) {
#if HOTENDS #if HOTENDS
float Temperature::get_pid_output_hotend(const uint8_t e) { float Temperature::get_pid_output_hotend(const uint8_t E_NAME) {
#if HOTENDS == 1
#define _HOTEND_TEST true
#else
#define _HOTEND_TEST (e == active_extruder)
#endif
E_UNUSED();
const uint8_t ee = HOTEND_INDEX; const uint8_t ee = HOTEND_INDEX;
#if ENABLED(PIDTEMP) #if ENABLED(PIDTEMP)
#if DISABLED(PID_OPENLOOP) #if DISABLED(PID_OPENLOOP)
@ -860,8 +854,13 @@ void Temperature::min_temp_error(const heater_ind_t heater) {
pid_output = work_pid[ee].Kp + work_pid[ee].Ki + work_pid[ee].Kd + float(MIN_POWER); pid_output = work_pid[ee].Kp + work_pid[ee].Ki + work_pid[ee].Kd + float(MIN_POWER);
#if ENABLED(PID_EXTRUSION_SCALING) #if ENABLED(PID_EXTRUSION_SCALING)
#if HOTENDS == 1
constexpr bool this_hotend = true;
#else
const bool this_hotend = (e == active_extruder);
#endif
work_pid[ee].Kc = 0; work_pid[ee].Kc = 0;
if (_HOTEND_TEST) { if (this_hotend) {
const long e_position = stepper.position(E_AXIS); const long e_position = stepper.position(E_AXIS);
if (e_position > last_e_position) { if (e_position > last_e_position) {
lpq[lpq_ptr] = e_position - last_e_position; lpq[lpq_ptr] = e_position - last_e_position;
@ -895,6 +894,7 @@ void Temperature::min_temp_error(const heater_ind_t heater) {
MSG_PID_DEBUG_OUTPUT, pid_output MSG_PID_DEBUG_OUTPUT, pid_output
); );
#if DISABLED(PID_OPENLOOP) #if DISABLED(PID_OPENLOOP)
{
SERIAL_ECHOPAIR( SERIAL_ECHOPAIR(
MSG_PID_DEBUG_PTERM, work_pid[ee].Kp, MSG_PID_DEBUG_PTERM, work_pid[ee].Kp,
MSG_PID_DEBUG_ITERM, work_pid[ee].Ki, MSG_PID_DEBUG_ITERM, work_pid[ee].Ki,
@ -903,6 +903,7 @@ void Temperature::min_temp_error(const heater_ind_t heater) {
, MSG_PID_DEBUG_CTERM, work_pid[ee].Kc , MSG_PID_DEBUG_CTERM, work_pid[ee].Kc
#endif #endif
); );
}
#endif #endif
SERIAL_EOL(); SERIAL_EOL();
} }
@ -911,12 +912,11 @@ void Temperature::min_temp_error(const heater_ind_t heater) {
#else // No PID enabled #else // No PID enabled
#if HEATER_IDLE_HANDLER #if HEATER_IDLE_HANDLER
#define _TIMED_OUT_TEST hotend_idle[ee].timed_out const bool is_idling = hotend_idle[ee].timed_out;
#else #else
#define _TIMED_OUT_TEST false constexpr bool is_idling = false;
#endif #endif
const float pid_output = (!_TIMED_OUT_TEST && temp_hotend[ee].celsius < temp_hotend[ee].target) ? BANG_MAX : 0; const float pid_output = (!is_idling && temp_hotend[ee].celsius < temp_hotend[ee].target) ? BANG_MAX : 0;
#undef _TIMED_OUT_TEST
#endif #endif
@ -971,6 +971,7 @@ void Temperature::min_temp_error(const heater_ind_t heater) {
#endif // PID_OPENLOOP #endif // PID_OPENLOOP
#if ENABLED(PID_BED_DEBUG) #if ENABLED(PID_BED_DEBUG)
{
SERIAL_ECHO_START(); SERIAL_ECHO_START();
SERIAL_ECHOLNPAIR( SERIAL_ECHOLNPAIR(
" PID_BED_DEBUG : Input ", temp_bed.celsius, " Output ", pid_output, " PID_BED_DEBUG : Input ", temp_bed.celsius, " Output ", pid_output,
@ -980,6 +981,7 @@ void Temperature::min_temp_error(const heater_ind_t heater) {
MSG_PID_DEBUG_DTERM, work_pid.Kd, MSG_PID_DEBUG_DTERM, work_pid.Kd,
#endif #endif
); );
}
#endif #endif
return pid_output; return pid_output;
@ -1811,8 +1813,7 @@ void Temperature::init() {
* their target temperature by a configurable margin. * their target temperature by a configurable margin.
* This is called when the temperature is set. (M104, M109) * This is called when the temperature is set. (M104, M109)
*/ */
void Temperature::start_watching_hotend(const uint8_t e) { void Temperature::start_watching_hotend(const uint8_t E_NAME) {
E_UNUSED();
const uint8_t ee = HOTEND_INDEX; const uint8_t ee = HOTEND_INDEX;
if (degTargetHotend(ee) && degHotend(ee) < degTargetHotend(ee) - (WATCH_TEMP_INCREASE + TEMP_HYSTERESIS + 1)) { if (degTargetHotend(ee) && degHotend(ee) < degTargetHotend(ee) - (WATCH_TEMP_INCREASE + TEMP_HYSTERESIS + 1)) {
watch_hotend[ee].target = degHotend(ee) + WATCH_TEMP_INCREASE; watch_hotend[ee].target = degHotend(ee) + WATCH_TEMP_INCREASE;

64
Marlin/src/module/temperature.h

@ -39,10 +39,10 @@
#if HOTENDS <= 1 #if HOTENDS <= 1
#define HOTEND_INDEX 0 #define HOTEND_INDEX 0
#define E_UNUSED() UNUSED(e) #define E_NAME
#else #else
#define HOTEND_INDEX e #define HOTEND_INDEX e
#define E_UNUSED() #define E_NAME e
#endif #endif
// Identifiers for other heaters // Identifiers for other heaters
@ -304,17 +304,15 @@ class Temperature {
static bool allow_cold_extrude; static bool allow_cold_extrude;
static int16_t extrude_min_temp; static int16_t extrude_min_temp;
FORCE_INLINE static bool tooCold(const int16_t temp) { return allow_cold_extrude ? false : temp < extrude_min_temp; } FORCE_INLINE static bool tooCold(const int16_t temp) { return allow_cold_extrude ? false : temp < extrude_min_temp; }
FORCE_INLINE static bool tooColdToExtrude(const uint8_t e) { FORCE_INLINE static bool tooColdToExtrude(const uint8_t E_NAME) {
E_UNUSED();
return tooCold(degHotend(HOTEND_INDEX)); return tooCold(degHotend(HOTEND_INDEX));
} }
FORCE_INLINE static bool targetTooColdToExtrude(const uint8_t e) { FORCE_INLINE static bool targetTooColdToExtrude(const uint8_t E_NAME) {
E_UNUSED();
return tooCold(degTargetHotend(HOTEND_INDEX)); return tooCold(degTargetHotend(HOTEND_INDEX));
} }
#else #else
FORCE_INLINE static bool tooColdToExtrude(const uint8_t e) { UNUSED(e); return false; } FORCE_INLINE static bool tooColdToExtrude(const uint8_t) { return false; }
FORCE_INLINE static bool targetTooColdToExtrude(const uint8_t e) { UNUSED(e); return false; } FORCE_INLINE static bool targetTooColdToExtrude(const uint8_t) { return false; }
#endif #endif
FORCE_INLINE static bool hotEnoughToExtrude(const uint8_t e) { return !tooColdToExtrude(e); } FORCE_INLINE static bool hotEnoughToExtrude(const uint8_t e) { return !tooColdToExtrude(e); }
@ -546,16 +544,13 @@ class Temperature {
* Preheating hotends * Preheating hotends
*/ */
#ifdef MILLISECONDS_PREHEAT_TIME #ifdef MILLISECONDS_PREHEAT_TIME
static bool is_preheating(const uint8_t e) { static bool is_preheating(const uint8_t E_NAME) {
E_UNUSED();
return preheat_end_time[HOTEND_INDEX] && PENDING(millis(), preheat_end_time[HOTEND_INDEX]); return preheat_end_time[HOTEND_INDEX] && PENDING(millis(), preheat_end_time[HOTEND_INDEX]);
} }
static void start_preheat_time(const uint8_t e) { static void start_preheat_time(const uint8_t E_NAME) {
E_UNUSED();
preheat_end_time[HOTEND_INDEX] = millis() + MILLISECONDS_PREHEAT_TIME; preheat_end_time[HOTEND_INDEX] = millis() + MILLISECONDS_PREHEAT_TIME;
} }
static void reset_preheat_time(const uint8_t e) { static void reset_preheat_time(const uint8_t E_NAME) {
E_UNUSED();
preheat_end_time[HOTEND_INDEX] = 0; preheat_end_time[HOTEND_INDEX] = 0;
} }
#else #else
@ -566,39 +561,36 @@ class Temperature {
//inline so that there is no performance decrease. //inline so that there is no performance decrease.
//deg=degreeCelsius //deg=degreeCelsius
FORCE_INLINE static float degHotend(const uint8_t e) { FORCE_INLINE static float degHotend(const uint8_t E_NAME) {
E_UNUSED(); return (0
#if HOTENDS #if HOTENDS
return temp_hotend[HOTEND_INDEX].celsius; + temp_hotend[HOTEND_INDEX].celsius
#else
return 0;
#endif #endif
);
} }
#if ENABLED(SHOW_TEMP_ADC_VALUES) #if ENABLED(SHOW_TEMP_ADC_VALUES)
FORCE_INLINE static int16_t rawHotendTemp(const uint8_t e) { FORCE_INLINE static int16_t rawHotendTemp(const uint8_t E_NAME) {
E_UNUSED(); return (0
#if HOTENDS #if HOTENDS
return temp_hotend[HOTEND_INDEX].raw; + temp_hotend[HOTEND_INDEX].raw
#else
return 0;
#endif #endif
);
} }
#endif #endif
FORCE_INLINE static int16_t degTargetHotend(const uint8_t e) { FORCE_INLINE static int16_t degTargetHotend(const uint8_t E_NAME) {
E_UNUSED(); return (0
#if HOTENDS #if HOTENDS
return temp_hotend[HOTEND_INDEX].target; + temp_hotend[HOTEND_INDEX].target
#else
return 0;
#endif #endif
);
} }
#if WATCH_HOTENDS #if WATCH_HOTENDS
static void start_watching_hotend(const uint8_t e=0); static void start_watching_hotend(const uint8_t e=0);
#else #else
static inline void start_watching_hotend(const uint8_t e=0) { UNUSED(e); } static inline void start_watching_hotend(const uint8_t=0) {}
#endif #endif
#if HOTENDS #if HOTENDS
@ -612,8 +604,7 @@ class Temperature {
static inline void start_watching_E5() { start_watching_hotend(5); } static inline void start_watching_E5() { start_watching_hotend(5); }
#endif #endif
static void setTargetHotend(const int16_t celsius, const uint8_t e) { static void setTargetHotend(const int16_t celsius, const uint8_t E_NAME) {
E_UNUSED();
const uint8_t ee = HOTEND_INDEX; const uint8_t ee = HOTEND_INDEX;
#ifdef MILLISECONDS_PREHEAT_TIME #ifdef MILLISECONDS_PREHEAT_TIME
if (celsius == 0) if (celsius == 0)
@ -628,13 +619,11 @@ class Temperature {
start_watching_hotend(ee); start_watching_hotend(ee);
} }
FORCE_INLINE static bool isHeatingHotend(const uint8_t e) { FORCE_INLINE static bool isHeatingHotend(const uint8_t E_NAME) {
E_UNUSED();
return temp_hotend[HOTEND_INDEX].target > temp_hotend[HOTEND_INDEX].celsius; return temp_hotend[HOTEND_INDEX].target > temp_hotend[HOTEND_INDEX].celsius;
} }
FORCE_INLINE static bool isCoolingHotend(const uint8_t e) { FORCE_INLINE static bool isCoolingHotend(const uint8_t E_NAME) {
E_UNUSED();
return temp_hotend[HOTEND_INDEX].target < temp_hotend[HOTEND_INDEX].celsius; return temp_hotend[HOTEND_INDEX].target < temp_hotend[HOTEND_INDEX].celsius;
} }
@ -765,8 +754,7 @@ class Temperature {
#if HEATER_IDLE_HANDLER #if HEATER_IDLE_HANDLER
static void reset_heater_idle_timer(const uint8_t e) { static void reset_heater_idle_timer(const uint8_t E_NAME) {
E_UNUSED();
hotend_idle[HOTEND_INDEX].reset(); hotend_idle[HOTEND_INDEX].reset();
start_watching_hotend(HOTEND_INDEX); start_watching_hotend(HOTEND_INDEX);
} }

2
Marlin/src/sd/usb_flashdrive/Sd2Card_FlashDrive.h

@ -61,7 +61,7 @@ class Sd2Card {
inline bool readData(uint8_t* dst) { return readBlock(pos++, dst); } inline bool readData(uint8_t* dst) { return readBlock(pos++, dst); }
inline bool readStop() const { return true; } inline bool readStop() const { return true; }
inline bool writeStart(const uint32_t block, const uint32_t eraseCount) { UNUSED(eraseCount); pos = block; return ready(); } inline bool writeStart(const uint32_t block, const uint32_t) { pos = block; return ready(); }
inline bool writeData(uint8_t* src) { return writeBlock(pos++, src); } inline bool writeData(uint8_t* src) { return writeBlock(pos++, src); }
inline bool writeStop() const { return true; } inline bool writeStop() const { return true; }

2
Marlin/src/sd/usb_flashdrive/lib-uhs2/parsetools.h

@ -120,7 +120,7 @@ public:
lenSize(0), lenSize(0),
valSize(0), valSize(0),
pBuf(nullptr), pBuf(nullptr),
prsMode(modeArray) { } prsMode(modeArray) {}
; ;
void Initialize(const uint8_t len_size, const uint8_t val_size, MultiValueBuffer * const p, const uint8_t mode = modeArray) { void Initialize(const uint8_t len_size, const uint8_t val_size, MultiValueBuffer * const p, const uint8_t mode = modeArray) {

Loading…
Cancel
Save