Browse Source

Reduce need for UNUSED

Scott Lahteine 4 years ago
parent
commit
e3fd0519b3

+ 1
- 2
Marlin/src/HAL/HAL_AVR/HAL.h View File

146
 #define DISABLE_TEMPERATURE_INTERRUPT()    CBI(TIMSK0, OCIE0B)
146
 #define DISABLE_TEMPERATURE_INTERRUPT()    CBI(TIMSK0, OCIE0B)
147
 #define TEMPERATURE_ISR_ENABLED()         TEST(TIMSK0, OCIE0B)
147
 #define TEMPERATURE_ISR_ENABLED()         TEST(TIMSK0, OCIE0B)
148
 
148
 
149
-FORCE_INLINE void HAL_timer_start(const uint8_t timer_num, const uint32_t frequency) {
150
-  UNUSED(frequency);
149
+FORCE_INLINE void HAL_timer_start(const uint8_t timer_num, const uint32_t) {
151
   switch (timer_num) {
150
   switch (timer_num) {
152
     case STEP_TIMER_NUM:
151
     case STEP_TIMER_NUM:
153
       // waveform generation = 0100 = CTC
152
       // waveform generation = 0100 = CTC

+ 2
- 7
Marlin/src/HAL/HAL_AVR/HAL_SPI.cpp View File

184
   // nop to tune soft SPI timing
184
   // nop to tune soft SPI timing
185
   #define nop asm volatile ("\tnop\n")
185
   #define nop asm volatile ("\tnop\n")
186
 
186
 
187
-  // Set SPI rate
188
-  void spiInit(uint8_t spiRate) {
189
-    UNUSED(spiRate);  // nothing to do
190
-  }
187
+  void spiInit(uint8_t) { /* do nothing */ }
191
 
188
 
192
   // Begin SPI transaction, set clock, bit order, data mode
189
   // Begin SPI transaction, set clock, bit order, data mode
193
-  void spiBeginTransaction(uint32_t spiClock, uint8_t bitOrder, uint8_t dataMode) {
194
-    UNUSED(spiBeginTransaction);  // nothing to do
195
-  }
190
+  void spiBeginTransaction(uint32_t spiClock, uint8_t bitOrder, uint8_t dataMode) { /* do nothing */ }
196
 
191
 
197
   // Soft SPI receive byte
192
   // Soft SPI receive byte
198
   uint8_t spiRec() {
193
   uint8_t spiRec() {

+ 1
- 2
Marlin/src/HAL/HAL_DUE/HAL_SPI.cpp View File

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

+ 2
- 5
Marlin/src/HAL/HAL_DUE/MarlinSerialUSB.cpp View File

55
 #endif
55
 #endif
56
 
56
 
57
 // Public Methods
57
 // Public Methods
58
-void MarlinSerialUSB::begin(const long baud_setting) {
59
-  UNUSED(baud_setting);
60
-}
58
+void MarlinSerialUSB::begin(const long) {}
61
 
59
 
62
-void MarlinSerialUSB::end() {
63
-}
60
+void MarlinSerialUSB::end() {}
64
 
61
 
65
 int MarlinSerialUSB::peek() {
62
 int MarlinSerialUSB::peek() {
66
   if (pending_char >= 0)
63
   if (pending_char >= 0)

+ 3
- 10
Marlin/src/HAL/HAL_DUE/usb/sd_mmc_spi_mem.cpp View File

33
   return CTRL_GOOD;
33
   return CTRL_GOOD;
34
 }
34
 }
35
 
35
 
36
-bool sd_mmc_spi_unload(bool unload) {
37
-  UNUSED(unload);
38
-  return true;
39
-}
36
+bool sd_mmc_spi_unload(bool) { return true; }
40
 
37
 
41
-bool sd_mmc_spi_wr_protect() {
42
-  return false;
43
-}
38
+bool sd_mmc_spi_wr_protect() { return false; }
44
 
39
 
45
 bool sd_mmc_spi_removal() {
40
 bool sd_mmc_spi_removal() {
46
-  if (!IS_SD_INSERTED() || IS_SD_PRINTING() || IS_SD_FILE_OPEN() || !card.isMounted())
47
-    return true;
48
-  return false;
41
+  return (!IS_SD_INSERTED() || IS_SD_PRINTING() || IS_SD_FILE_OPEN() || !card.isMounted());
49
 }
42
 }
50
 
43
 
51
 #if ACCESS_USB == true
44
 #if ACCESS_USB == true

+ 1
- 1
Marlin/src/HAL/HAL_ESP32/watchdog.h View File

25
 void watchdog_init();
25
 void watchdog_init();
26
 
26
 
27
 // Reset watchdog.
27
 // Reset watchdog.
28
-inline void HAL_watchdog_refresh() { }
28
+inline void HAL_watchdog_refresh() {}

+ 1
- 1
Marlin/src/HAL/HAL_LINUX/HAL.h View File

78
 #define ENABLE_ISRS()
78
 #define ENABLE_ISRS()
79
 #define DISABLE_ISRS()
79
 #define DISABLE_ISRS()
80
 
80
 
81
-inline void HAL_init() { }
81
+inline void HAL_init() {}
82
 
82
 
83
 // Utility functions
83
 // Utility functions
84
 #pragma GCC diagnostic push
84
 #pragma GCC diagnostic push

+ 2
- 2
Marlin/src/HAL/HAL_LINUX/include/serial.h View File

83
 
83
 
84
   HalSerial() { host_connected = true; }
84
   HalSerial() { host_connected = true; }
85
 
85
 
86
-  void begin(int32_t baud) { }
86
+  void begin(int32_t) {}
87
 
87
 
88
-  void end() { }
88
+  void end() {}
89
 
89
 
90
   int peek() {
90
   int peek() {
91
     uint8_t value;
91
     uint8_t value;

+ 1
- 1
Marlin/src/HAL/HAL_LPC1768/MarlinSerial.h View File

49
     {
49
     {
50
     }
50
     }
51
 
51
 
52
-  void end() { }
52
+  void end() {}
53
 
53
 
54
   #if ENABLED(EMERGENCY_PARSER)
54
   #if ENABLED(EMERGENCY_PARSER)
55
     bool recv_callback(const char c) override {
55
     bool recv_callback(const char c) override {

+ 4
- 10
Marlin/src/HAL/HAL_STM32/HAL.cpp View File

104
 // ADC
104
 // ADC
105
 // ------------------------
105
 // ------------------------
106
 
106
 
107
-void HAL_adc_start_conversion(const uint8_t adc_pin) {
108
-  HAL_adc_result = analogRead(adc_pin);
109
-}
107
+// TODO: Make sure this doesn't cause any delay
108
+void HAL_adc_start_conversion(const uint8_t adc_pin) { HAL_adc_result = analogRead(adc_pin); }
110
 
109
 
111
-uint16_t HAL_adc_get_result() {
112
-  return HAL_adc_result;
113
-}
110
+uint16_t HAL_adc_get_result() { return HAL_adc_result; }
114
 
111
 
115
-void flashFirmware(int16_t value) {
116
-  UNUSED(value);
117
-  NVIC_SystemReset();
118
-}
112
+void flashFirmware(int16_t) { NVIC_SystemReset(); }
119
 
113
 
120
 #endif // ARDUINO_ARCH_STM32 && !STM32GENERIC
114
 #endif // ARDUINO_ARCH_STM32 && !STM32GENERIC

+ 1
- 1
Marlin/src/HAL/HAL_STM32_F4_F7/HAL.h View File

150
 // Memory related
150
 // Memory related
151
 #define __bss_end __bss_end__
151
 #define __bss_end __bss_end__
152
 
152
 
153
-inline void HAL_init() { }
153
+inline void HAL_init() {}
154
 
154
 
155
 // Clear reset reason
155
 // Clear reset reason
156
 void HAL_clear_reset_source();
156
 void HAL_clear_reset_source();

+ 1
- 1
Marlin/src/HAL/HAL_TEENSY31_32/HAL.h View File

87
 #undef pgm_read_word
87
 #undef pgm_read_word
88
 #define pgm_read_word(addr) (*((uint16_t*)(addr)))
88
 #define pgm_read_word(addr) (*((uint16_t*)(addr)))
89
 
89
 
90
-inline void HAL_init() { }
90
+inline void HAL_init() {}
91
 
91
 
92
 // Clear the reset reason
92
 // Clear the reset reason
93
 void HAL_clear_reset_source();
93
 void HAL_clear_reset_source();

+ 1
- 1
Marlin/src/HAL/HAL_TEENSY35_36/HAL.h View File

93
 #undef pgm_read_word
93
 #undef pgm_read_word
94
 #define pgm_read_word(addr) (*((uint16_t*)(addr)))
94
 #define pgm_read_word(addr) (*((uint16_t*)(addr)))
95
 
95
 
96
-inline void HAL_init() { }
96
+inline void HAL_init() {}
97
 
97
 
98
 // Clear reset reason
98
 // Clear reset reason
99
 void HAL_clear_reset_source();
99
 void HAL_clear_reset_source();

+ 1
- 1
Marlin/src/HAL/shared/Delay.h View File

53
 
53
 
54
     FORCE_INLINE static void DELAY_CYCLES(const uint32_t x) {
54
     FORCE_INLINE static void DELAY_CYCLES(const uint32_t x) {
55
       const uint32_t endCycles = getCycleCount() + x;
55
       const uint32_t endCycles = getCycleCount() + x;
56
-      while (PENDING(getCycleCount(), endCycles)) { }
56
+      while (PENDING(getCycleCount(), endCycles)) {}
57
     }
57
     }
58
 
58
 
59
   #else
59
   #else

+ 1
- 1
Marlin/src/feature/Max7219_Debug_LEDs.h View File

75
 public:
75
 public:
76
   static uint8_t led_line[MAX7219_LINES];
76
   static uint8_t led_line[MAX7219_LINES];
77
 
77
 
78
-  Max7219() { }
78
+  Max7219() {}
79
 
79
 
80
   static void init();
80
   static void init();
81
   static void register_setup();
81
   static void register_setup();

+ 1
- 2
Marlin/src/feature/leds/pca9632.cpp View File

138
 
138
 
139
 #if ENABLED(PCA9632_BUZZER)
139
 #if ENABLED(PCA9632_BUZZER)
140
 
140
 
141
-  void pca9632_buzz(const long duration, const uint16_t freq) {
142
-    UNUSED(duration); UNUSED(freq);
141
+  void pca9632_buzz(const long, const uint16_t) {
143
     uint8_t data[] = PCA9632_BUZZER_DATA;
142
     uint8_t data[] = PCA9632_BUZZER_DATA;
144
     Wire.beginTransmission(I2C_ADDRESS(PCA9632_ADDRESS));
143
     Wire.beginTransmission(I2C_ADDRESS(PCA9632_ADDRESS));
145
     Wire.write(data, sizeof(data));
144
     Wire.write(data, sizeof(data));

+ 1
- 1
Marlin/src/feature/power_loss_recovery.h View File

169
   #if ENABLED(DEBUG_POWER_LOSS_RECOVERY)
169
   #if ENABLED(DEBUG_POWER_LOSS_RECOVERY)
170
     static void debug(PGM_P const prefix);
170
     static void debug(PGM_P const prefix);
171
   #else
171
   #else
172
-    static inline void debug(PGM_P const prefix) { UNUSED(prefix); }
172
+    static inline void debug(PGM_P const) {}
173
   #endif
173
   #endif
174
 
174
 
175
   private:
175
   private:

+ 3
- 3
Marlin/src/feature/runout.h View File

266
       }
266
       }
267
 
267
 
268
     public:
268
     public:
269
-      static inline void block_completed(const block_t* const b) { UNUSED(b); }
269
+      static inline void block_completed(const block_t* const) {}
270
 
270
 
271
       static inline void run() {
271
       static inline void run() {
272
         const bool out = poll_runout_state(active_extruder);
272
         const bool out = poll_runout_state(active_extruder);
353
       static inline void reset()                                  { runout_count = runout_threshold; }
353
       static inline void reset()                                  { runout_count = runout_threshold; }
354
       static inline void run()                                    { if (runout_count >= 0) runout_count--; }
354
       static inline void run()                                    { if (runout_count >= 0) runout_count--; }
355
       static inline bool has_run_out()                            { return runout_count < 0; }
355
       static inline bool has_run_out()                            { return runout_count < 0; }
356
-      static inline void block_completed(const block_t* const b)  { UNUSED(b); }
357
-      static inline void filament_present(const uint8_t extruder) { runout_count = runout_threshold; UNUSED(extruder); }
356
+      static inline void block_completed(const block_t* const)    { }
357
+      static inline void filament_present(const uint8_t)          { runout_count = runout_threshold; }
358
   };
358
   };
359
 
359
 
360
 #endif // !FILAMENT_RUNOUT_DISTANCE_MM
360
 #endif // !FILAMENT_RUNOUT_DISTANCE_MM

+ 1
- 1
Marlin/src/feature/spindle_laser.h View File

70
   #if ENABLED(SPINDLE_CHANGE_DIR)
70
   #if ENABLED(SPINDLE_CHANGE_DIR)
71
     static void set_direction(const bool reverse);
71
     static void set_direction(const bool reverse);
72
   #else
72
   #else
73
-    static inline void set_direction(const bool reverse) { UNUSED(reverse); }
73
+    static inline void set_direction(const bool) {}
74
   #endif
74
   #endif
75
 
75
 
76
   static inline void disable() { set_enabled(false); }
76
   static inline void disable() { set_enabled(false); }

+ 3
- 3
Marlin/src/gcode/parser.h View File

290
     static inline float mm_to_linear_unit(const float mm)     { return mm; }
290
     static inline float mm_to_linear_unit(const float mm)     { return mm; }
291
     static inline float mm_to_volumetric_unit(const float mm) { return mm; }
291
     static inline float mm_to_volumetric_unit(const float mm) { return mm; }
292
 
292
 
293
-    static inline float linear_value_to_mm(const float v)                    { return v; }
294
-    static inline float axis_value_to_mm(const AxisEnum axis, const float v) { UNUSED(axis); return v; }
295
-    static inline float per_axis_value(const AxisEnum axis, const float v)   { UNUSED(axis); return v; }
293
+    static inline float linear_value_to_mm(const float v)               { return v; }
294
+    static inline float axis_value_to_mm(const AxisEnum, const float v) { return v; }
295
+    static inline float per_axis_value(const AxisEnum, const float v)   { return v; }
296
 
296
 
297
   #endif
297
   #endif
298
 
298
 

+ 2
- 4
Marlin/src/lcd/menu/menu.h View File

114
   FORCE_INLINE void draw_menu_item_edit_##NAME (const bool sel, const uint8_t row, PGM_P const pstr, TYPE * const data, ...) { \
114
   FORCE_INLINE void draw_menu_item_edit_##NAME (const bool sel, const uint8_t row, PGM_P const pstr, TYPE * const data, ...) { \
115
     DRAW_MENU_ITEM_SETTING_EDIT_GENERIC(STRFUNC(*(data))); \
115
     DRAW_MENU_ITEM_SETTING_EDIT_GENERIC(STRFUNC(*(data))); \
116
   } \
116
   } \
117
-  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), ...) { \
118
-    UNUSED(pstr2); UNUSED(pset); \
117
+  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), ...) { \
119
     DRAW_MENU_ITEM_SETTING_EDIT_GENERIC(STRFUNC(pget())); \
118
     DRAW_MENU_ITEM_SETTING_EDIT_GENERIC(STRFUNC(pget())); \
120
   } \
119
   } \
121
   typedef void NAME##_void
120
   typedef void NAME##_void
149
 
148
 
150
 class MenuItem_back {
149
 class MenuItem_back {
151
   public:
150
   public:
152
-    static inline void action(PGM_P const dummy=nullptr) {
151
+    static inline void action(PGM_P const=nullptr) {
153
       ui.goto_previous_screen(
152
       ui.goto_previous_screen(
154
         #if ENABLED(TURBO_BACK_MENU_ITEM)
153
         #if ENABLED(TURBO_BACK_MENU_ITEM)
155
           true
154
           true
156
         #endif
155
         #endif
157
       );
156
       );
158
-      UNUSED(dummy);
159
     }
157
     }
160
 };
158
 };
161
 
159
 

+ 1
- 0
Marlin/src/lcd/menu/menu_media.cpp View File

108
         MenuItem_submenu::action(pstr, menu_sd_confirm);
108
         MenuItem_submenu::action(pstr, menu_sd_confirm);
109
       #else
109
       #else
110
         sdcard_start_selected_file();
110
         sdcard_start_selected_file();
111
+        UNUSED(pstr);
111
       #endif
112
       #endif
112
     }
113
     }
113
 };
114
 };

+ 5
- 5
Marlin/src/lcd/ultralcd.h View File

273
 
273
 
274
     static void init();
274
     static void init();
275
     static void update();
275
     static void update();
276
-    static void set_alert_status_P(PGM_P message);
276
+    static void set_alert_status_P(PGM_P const message);
277
 
277
 
278
     static char status_message[];
278
     static char status_message[];
279
     static bool has_status();
279
     static bool has_status();
393
     static inline void update() {}
393
     static inline void update() {}
394
     static inline void refresh() {}
394
     static inline void refresh() {}
395
     static inline void return_to_status() {}
395
     static inline void return_to_status() {}
396
-    static inline void set_alert_status_P(PGM_P message) { UNUSED(message); }
397
-    static inline void set_status(const char* const message, const bool persist=false) { UNUSED(message); UNUSED(persist); }
398
-    static inline void set_status_P(PGM_P const message, const int8_t level=0) { UNUSED(message); UNUSED(level); }
399
-    static inline void status_printf_P(const uint8_t level, PGM_P const fmt, ...) { UNUSED(level); UNUSED(fmt); }
396
+    static inline void set_alert_status_P(PGM_P const) {}
397
+    static inline void set_status(const char* const, const bool=false) {}
398
+    static inline void set_status_P(PGM_P const, const int8_t=0) {}
399
+    static inline void status_printf_P(const uint8_t, PGM_P const, ...) {}
400
     static inline void reset_status() {}
400
     static inline void reset_status() {}
401
     static inline void reset_alert_level() {}
401
     static inline void reset_alert_level() {}
402
     static constexpr bool has_status() { return false; }
402
     static constexpr bool has_status() { return false; }

+ 1
- 1
Marlin/src/module/configuration_store.h View File

85
       static void report(const bool forReplay=false);
85
       static void report(const bool forReplay=false);
86
     #else
86
     #else
87
       FORCE_INLINE
87
       FORCE_INLINE
88
-      static void report(const bool forReplay=false) { UNUSED(forReplay); }
88
+      static void report(const bool=false) {}
89
     #endif
89
     #endif
90
 
90
 
91
   private:
91
   private:

+ 6
- 6
Marlin/src/module/motion.h View File

279
 #else
279
 #else
280
   #define NATIVE_TO_LOGICAL(POS, AXIS) (POS)
280
   #define NATIVE_TO_LOGICAL(POS, AXIS) (POS)
281
   #define LOGICAL_TO_NATIVE(POS, AXIS) (POS)
281
   #define LOGICAL_TO_NATIVE(POS, AXIS) (POS)
282
-  FORCE_INLINE void toLogical(xy_pos_t &raw)   { UNUSED(raw); }
283
-  FORCE_INLINE void toLogical(xyz_pos_t &raw)  { UNUSED(raw); }
284
-  FORCE_INLINE void toLogical(xyze_pos_t &raw) { UNUSED(raw); }
285
-  FORCE_INLINE void toNative(xy_pos_t &raw)    { UNUSED(raw); }
286
-  FORCE_INLINE void toNative(xyz_pos_t &raw)   { UNUSED(raw); }
287
-  FORCE_INLINE void toNative(xyze_pos_t &raw)  { UNUSED(raw); }
282
+  FORCE_INLINE void toLogical(xy_pos_t&)   {}
283
+  FORCE_INLINE void toLogical(xyz_pos_t&)  {}
284
+  FORCE_INLINE void toLogical(xyze_pos_t&) {}
285
+  FORCE_INLINE void toNative(xy_pos_t&)    {}
286
+  FORCE_INLINE void toNative(xyz_pos_t&)   {}
287
+  FORCE_INLINE void toNative(xyze_pos_t&)  {}
288
 #endif
288
 #endif
289
 #define LOGICAL_X_POSITION(POS) NATIVE_TO_LOGICAL(POS, X_AXIS)
289
 #define LOGICAL_X_POSITION(POS) NATIVE_TO_LOGICAL(POS, X_AXIS)
290
 #define LOGICAL_Y_POSITION(POS) NATIVE_TO_LOGICAL(POS, Y_AXIS)
290
 #define LOGICAL_Y_POSITION(POS) NATIVE_TO_LOGICAL(POS, Y_AXIS)

+ 2
- 5
Marlin/src/module/planner.h View File

431
 
431
 
432
     #else
432
     #else
433
 
433
 
434
-      FORCE_INLINE static float fade_scaling_factor_for_z(const float &rz) {
435
-        UNUSED(rz);
436
-        return 1;
437
-      }
434
+      FORCE_INLINE static float fade_scaling_factor_for_z(const float&) { return 1; }
438
 
435
 
439
-      FORCE_INLINE static bool leveling_active_at_z(const float &rz) { UNUSED(rz); return true; }
436
+      FORCE_INLINE static bool leveling_active_at_z(const float&) { return true; }
440
 
437
 
441
     #endif
438
     #endif
442
 
439
 

+ 1
- 1
Marlin/src/module/stepper.h View File

337
     //
337
     //
338
     // Constructor / initializer
338
     // Constructor / initializer
339
     //
339
     //
340
-    Stepper() { };
340
+    Stepper() {};
341
 
341
 
342
     // Initialize stepper hardware
342
     // Initialize stepper hardware
343
     static void init();
343
     static void init();

+ 15
- 14
Marlin/src/module/temperature.cpp View File

813
 
813
 
814
 #if HOTENDS
814
 #if HOTENDS
815
 
815
 
816
-  float Temperature::get_pid_output_hotend(const uint8_t e) {
817
-    #if HOTENDS == 1
818
-      #define _HOTEND_TEST true
819
-    #else
820
-      #define _HOTEND_TEST (e == active_extruder)
821
-    #endif
822
-    E_UNUSED();
816
+  float Temperature::get_pid_output_hotend(const uint8_t E_NAME) {
823
     const uint8_t ee = HOTEND_INDEX;
817
     const uint8_t ee = HOTEND_INDEX;
824
     #if ENABLED(PIDTEMP)
818
     #if ENABLED(PIDTEMP)
825
       #if DISABLED(PID_OPENLOOP)
819
       #if DISABLED(PID_OPENLOOP)
860
           pid_output = work_pid[ee].Kp + work_pid[ee].Ki + work_pid[ee].Kd + float(MIN_POWER);
854
           pid_output = work_pid[ee].Kp + work_pid[ee].Ki + work_pid[ee].Kd + float(MIN_POWER);
861
 
855
 
862
           #if ENABLED(PID_EXTRUSION_SCALING)
856
           #if ENABLED(PID_EXTRUSION_SCALING)
857
+            #if HOTENDS == 1
858
+              constexpr bool this_hotend = true;
859
+            #else
860
+              const bool this_hotend = (e == active_extruder);
861
+            #endif
863
             work_pid[ee].Kc = 0;
862
             work_pid[ee].Kc = 0;
864
-            if (_HOTEND_TEST) {
863
+            if (this_hotend) {
865
               const long e_position = stepper.position(E_AXIS);
864
               const long e_position = stepper.position(E_AXIS);
866
               if (e_position > last_e_position) {
865
               if (e_position > last_e_position) {
867
                 lpq[lpq_ptr] = e_position - last_e_position;
866
                 lpq[lpq_ptr] = e_position - last_e_position;
895
             MSG_PID_DEBUG_OUTPUT, pid_output
894
             MSG_PID_DEBUG_OUTPUT, pid_output
896
           );
895
           );
897
           #if DISABLED(PID_OPENLOOP)
896
           #if DISABLED(PID_OPENLOOP)
897
+          {
898
             SERIAL_ECHOPAIR(
898
             SERIAL_ECHOPAIR(
899
               MSG_PID_DEBUG_PTERM, work_pid[ee].Kp,
899
               MSG_PID_DEBUG_PTERM, work_pid[ee].Kp,
900
               MSG_PID_DEBUG_ITERM, work_pid[ee].Ki,
900
               MSG_PID_DEBUG_ITERM, work_pid[ee].Ki,
903
                 , MSG_PID_DEBUG_CTERM, work_pid[ee].Kc
903
                 , MSG_PID_DEBUG_CTERM, work_pid[ee].Kc
904
               #endif
904
               #endif
905
             );
905
             );
906
+          }
906
           #endif
907
           #endif
907
           SERIAL_EOL();
908
           SERIAL_EOL();
908
         }
909
         }
911
     #else // No PID enabled
912
     #else // No PID enabled
912
 
913
 
913
       #if HEATER_IDLE_HANDLER
914
       #if HEATER_IDLE_HANDLER
914
-        #define _TIMED_OUT_TEST hotend_idle[ee].timed_out
915
+        const bool is_idling = hotend_idle[ee].timed_out;
915
       #else
916
       #else
916
-        #define _TIMED_OUT_TEST false
917
+        constexpr bool is_idling = false;
917
       #endif
918
       #endif
918
-      const float pid_output = (!_TIMED_OUT_TEST && temp_hotend[ee].celsius < temp_hotend[ee].target) ? BANG_MAX : 0;
919
-      #undef _TIMED_OUT_TEST
919
+      const float pid_output = (!is_idling && temp_hotend[ee].celsius < temp_hotend[ee].target) ? BANG_MAX : 0;
920
 
920
 
921
     #endif
921
     #endif
922
 
922
 
971
     #endif // PID_OPENLOOP
971
     #endif // PID_OPENLOOP
972
 
972
 
973
     #if ENABLED(PID_BED_DEBUG)
973
     #if ENABLED(PID_BED_DEBUG)
974
+    {
974
       SERIAL_ECHO_START();
975
       SERIAL_ECHO_START();
975
       SERIAL_ECHOLNPAIR(
976
       SERIAL_ECHOLNPAIR(
976
         " PID_BED_DEBUG : Input ", temp_bed.celsius, " Output ", pid_output,
977
         " PID_BED_DEBUG : Input ", temp_bed.celsius, " Output ", pid_output,
980
           MSG_PID_DEBUG_DTERM, work_pid.Kd,
981
           MSG_PID_DEBUG_DTERM, work_pid.Kd,
981
         #endif
982
         #endif
982
       );
983
       );
984
+    }
983
     #endif
985
     #endif
984
 
986
 
985
     return pid_output;
987
     return pid_output;
1811
    * their target temperature by a configurable margin.
1813
    * their target temperature by a configurable margin.
1812
    * This is called when the temperature is set. (M104, M109)
1814
    * This is called when the temperature is set. (M104, M109)
1813
    */
1815
    */
1814
-  void Temperature::start_watching_hotend(const uint8_t e) {
1815
-    E_UNUSED();
1816
+  void Temperature::start_watching_hotend(const uint8_t E_NAME) {
1816
     const uint8_t ee = HOTEND_INDEX;
1817
     const uint8_t ee = HOTEND_INDEX;
1817
     if (degTargetHotend(ee) && degHotend(ee) < degTargetHotend(ee) - (WATCH_TEMP_INCREASE + TEMP_HYSTERESIS + 1)) {
1818
     if (degTargetHotend(ee) && degHotend(ee) < degTargetHotend(ee) - (WATCH_TEMP_INCREASE + TEMP_HYSTERESIS + 1)) {
1818
       watch_hotend[ee].target = degHotend(ee) + WATCH_TEMP_INCREASE;
1819
       watch_hotend[ee].target = degHotend(ee) + WATCH_TEMP_INCREASE;

+ 32
- 44
Marlin/src/module/temperature.h View File

39
 
39
 
40
 #if HOTENDS <= 1
40
 #if HOTENDS <= 1
41
   #define HOTEND_INDEX  0
41
   #define HOTEND_INDEX  0
42
-  #define E_UNUSED() UNUSED(e)
42
+  #define E_NAME
43
 #else
43
 #else
44
   #define HOTEND_INDEX  e
44
   #define HOTEND_INDEX  e
45
-  #define E_UNUSED()
45
+  #define E_NAME e
46
 #endif
46
 #endif
47
 
47
 
48
 // Identifiers for other heaters
48
 // Identifiers for other heaters
304
       static bool allow_cold_extrude;
304
       static bool allow_cold_extrude;
305
       static int16_t extrude_min_temp;
305
       static int16_t extrude_min_temp;
306
       FORCE_INLINE static bool tooCold(const int16_t temp) { return allow_cold_extrude ? false : temp < extrude_min_temp; }
306
       FORCE_INLINE static bool tooCold(const int16_t temp) { return allow_cold_extrude ? false : temp < extrude_min_temp; }
307
-      FORCE_INLINE static bool tooColdToExtrude(const uint8_t e) {
308
-        E_UNUSED();
307
+      FORCE_INLINE static bool tooColdToExtrude(const uint8_t E_NAME) {
309
         return tooCold(degHotend(HOTEND_INDEX));
308
         return tooCold(degHotend(HOTEND_INDEX));
310
       }
309
       }
311
-      FORCE_INLINE static bool targetTooColdToExtrude(const uint8_t e) {
312
-        E_UNUSED();
310
+      FORCE_INLINE static bool targetTooColdToExtrude(const uint8_t E_NAME) {
313
         return tooCold(degTargetHotend(HOTEND_INDEX));
311
         return tooCold(degTargetHotend(HOTEND_INDEX));
314
       }
312
       }
315
     #else
313
     #else
316
-      FORCE_INLINE static bool tooColdToExtrude(const uint8_t e) { UNUSED(e); return false; }
317
-      FORCE_INLINE static bool targetTooColdToExtrude(const uint8_t e) { UNUSED(e); return false; }
314
+      FORCE_INLINE static bool tooColdToExtrude(const uint8_t) { return false; }
315
+      FORCE_INLINE static bool targetTooColdToExtrude(const uint8_t) { return false; }
318
     #endif
316
     #endif
319
 
317
 
320
     FORCE_INLINE static bool hotEnoughToExtrude(const uint8_t e) { return !tooColdToExtrude(e); }
318
     FORCE_INLINE static bool hotEnoughToExtrude(const uint8_t e) { return !tooColdToExtrude(e); }
546
      * Preheating hotends
544
      * Preheating hotends
547
      */
545
      */
548
     #ifdef MILLISECONDS_PREHEAT_TIME
546
     #ifdef MILLISECONDS_PREHEAT_TIME
549
-      static bool is_preheating(const uint8_t e) {
550
-        E_UNUSED();
547
+      static bool is_preheating(const uint8_t E_NAME) {
551
         return preheat_end_time[HOTEND_INDEX] && PENDING(millis(), preheat_end_time[HOTEND_INDEX]);
548
         return preheat_end_time[HOTEND_INDEX] && PENDING(millis(), preheat_end_time[HOTEND_INDEX]);
552
       }
549
       }
553
-      static void start_preheat_time(const uint8_t e) {
554
-        E_UNUSED();
550
+      static void start_preheat_time(const uint8_t E_NAME) {
555
         preheat_end_time[HOTEND_INDEX] = millis() + MILLISECONDS_PREHEAT_TIME;
551
         preheat_end_time[HOTEND_INDEX] = millis() + MILLISECONDS_PREHEAT_TIME;
556
       }
552
       }
557
-      static void reset_preheat_time(const uint8_t e) {
558
-        E_UNUSED();
553
+      static void reset_preheat_time(const uint8_t E_NAME) {
559
         preheat_end_time[HOTEND_INDEX] = 0;
554
         preheat_end_time[HOTEND_INDEX] = 0;
560
       }
555
       }
561
     #else
556
     #else
566
     //inline so that there is no performance decrease.
561
     //inline so that there is no performance decrease.
567
     //deg=degreeCelsius
562
     //deg=degreeCelsius
568
 
563
 
569
-    FORCE_INLINE static float degHotend(const uint8_t e) {
570
-      E_UNUSED();
571
-      #if HOTENDS
572
-        return temp_hotend[HOTEND_INDEX].celsius;
573
-      #else
574
-        return 0;
575
-      #endif
564
+    FORCE_INLINE static float degHotend(const uint8_t E_NAME) {
565
+      return (0
566
+        #if HOTENDS
567
+          + temp_hotend[HOTEND_INDEX].celsius
568
+        #endif
569
+      );
576
     }
570
     }
577
 
571
 
578
     #if ENABLED(SHOW_TEMP_ADC_VALUES)
572
     #if ENABLED(SHOW_TEMP_ADC_VALUES)
579
-      FORCE_INLINE static int16_t rawHotendTemp(const uint8_t e) {
580
-        E_UNUSED();
581
-        #if HOTENDS
582
-          return temp_hotend[HOTEND_INDEX].raw;
583
-        #else
584
-          return 0;
585
-        #endif
573
+      FORCE_INLINE static int16_t rawHotendTemp(const uint8_t E_NAME) {
574
+        return (0
575
+          #if HOTENDS
576
+            + temp_hotend[HOTEND_INDEX].raw
577
+          #endif
578
+        );
586
       }
579
       }
587
     #endif
580
     #endif
588
 
581
 
589
-    FORCE_INLINE static int16_t degTargetHotend(const uint8_t e) {
590
-      E_UNUSED();
591
-      #if HOTENDS
592
-        return temp_hotend[HOTEND_INDEX].target;
593
-      #else
594
-        return 0;
595
-      #endif
582
+    FORCE_INLINE static int16_t degTargetHotend(const uint8_t E_NAME) {
583
+      return (0
584
+        #if HOTENDS
585
+          + temp_hotend[HOTEND_INDEX].target
586
+        #endif
587
+      );
596
     }
588
     }
597
 
589
 
598
     #if WATCH_HOTENDS
590
     #if WATCH_HOTENDS
599
       static void start_watching_hotend(const uint8_t e=0);
591
       static void start_watching_hotend(const uint8_t e=0);
600
     #else
592
     #else
601
-      static inline void start_watching_hotend(const uint8_t e=0) { UNUSED(e); }
593
+      static inline void start_watching_hotend(const uint8_t=0) {}
602
     #endif
594
     #endif
603
 
595
 
604
     #if HOTENDS
596
     #if HOTENDS
612
         static inline void start_watching_E5() { start_watching_hotend(5); }
604
         static inline void start_watching_E5() { start_watching_hotend(5); }
613
       #endif
605
       #endif
614
 
606
 
615
-      static void setTargetHotend(const int16_t celsius, const uint8_t e) {
616
-        E_UNUSED();
607
+      static void setTargetHotend(const int16_t celsius, const uint8_t E_NAME) {
617
         const uint8_t ee = HOTEND_INDEX;
608
         const uint8_t ee = HOTEND_INDEX;
618
         #ifdef MILLISECONDS_PREHEAT_TIME
609
         #ifdef MILLISECONDS_PREHEAT_TIME
619
           if (celsius == 0)
610
           if (celsius == 0)
628
         start_watching_hotend(ee);
619
         start_watching_hotend(ee);
629
       }
620
       }
630
 
621
 
631
-      FORCE_INLINE static bool isHeatingHotend(const uint8_t e) {
632
-        E_UNUSED();
622
+      FORCE_INLINE static bool isHeatingHotend(const uint8_t E_NAME) {
633
         return temp_hotend[HOTEND_INDEX].target > temp_hotend[HOTEND_INDEX].celsius;
623
         return temp_hotend[HOTEND_INDEX].target > temp_hotend[HOTEND_INDEX].celsius;
634
       }
624
       }
635
 
625
 
636
-      FORCE_INLINE static bool isCoolingHotend(const uint8_t e) {
637
-        E_UNUSED();
626
+      FORCE_INLINE static bool isCoolingHotend(const uint8_t E_NAME) {
638
         return temp_hotend[HOTEND_INDEX].target < temp_hotend[HOTEND_INDEX].celsius;
627
         return temp_hotend[HOTEND_INDEX].target < temp_hotend[HOTEND_INDEX].celsius;
639
       }
628
       }
640
 
629
 
765
 
754
 
766
     #if HEATER_IDLE_HANDLER
755
     #if HEATER_IDLE_HANDLER
767
 
756
 
768
-      static void reset_heater_idle_timer(const uint8_t e) {
769
-        E_UNUSED();
757
+      static void reset_heater_idle_timer(const uint8_t E_NAME) {
770
         hotend_idle[HOTEND_INDEX].reset();
758
         hotend_idle[HOTEND_INDEX].reset();
771
         start_watching_hotend(HOTEND_INDEX);
759
         start_watching_hotend(HOTEND_INDEX);
772
       }
760
       }

+ 6
- 6
Marlin/src/sd/usb_flashdrive/Sd2Card_FlashDrive.h View File

57
 
57
 
58
     static void idle();
58
     static void idle();
59
 
59
 
60
-    inline bool readStart(const uint32_t block)                             { pos = block; return ready(); }
61
-    inline bool readData(uint8_t* dst)                                      { return readBlock(pos++, dst); }
62
-    inline bool readStop() const                                            { return true; }
60
+    inline bool readStart(const uint32_t block)                  { pos = block; return ready(); }
61
+    inline bool readData(uint8_t* dst)                           { return readBlock(pos++, dst); }
62
+    inline bool readStop() const                                 { return true; }
63
 
63
 
64
-    inline bool writeStart(const uint32_t block, const uint32_t eraseCount) { UNUSED(eraseCount); pos = block; return ready(); }
65
-    inline bool writeData(uint8_t* src)                                     { return writeBlock(pos++, src); }
66
-    inline bool writeStop() const                                           { return true; }
64
+    inline bool writeStart(const uint32_t block, const uint32_t) { pos = block; return ready(); }
65
+    inline bool writeData(uint8_t* src)                          { return writeBlock(pos++, src); }
66
+    inline bool writeStop() const                                { return true; }
67
 
67
 
68
     bool readBlock(uint32_t block, uint8_t* dst);
68
     bool readBlock(uint32_t block, uint8_t* dst);
69
     bool writeBlock(uint32_t blockNumber, const uint8_t* src);
69
     bool writeBlock(uint32_t blockNumber, const uint8_t* src);

+ 1
- 1
Marlin/src/sd/usb_flashdrive/lib-uhs2/parsetools.h View File

120
     lenSize(0),
120
     lenSize(0),
121
     valSize(0),
121
     valSize(0),
122
     pBuf(nullptr),
122
     pBuf(nullptr),
123
-    prsMode(modeArray) { }
123
+    prsMode(modeArray) {}
124
   ;
124
   ;
125
 
125
 
126
   void Initialize(const uint8_t len_size, const uint8_t val_size, MultiValueBuffer * const p, const uint8_t mode = modeArray) {
126
   void Initialize(const uint8_t len_size, const uint8_t val_size, MultiValueBuffer * const p, const uint8_t mode = modeArray) {

Loading…
Cancel
Save