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,8 +146,7 @@ extern "C" {
146 146
 #define DISABLE_TEMPERATURE_INTERRUPT()    CBI(TIMSK0, OCIE0B)
147 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 150
   switch (timer_num) {
152 151
     case STEP_TIMER_NUM:
153 152
       // waveform generation = 0100 = CTC

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

@@ -184,15 +184,10 @@ void spiBegin() {
184 184
   // nop to tune soft SPI timing
185 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 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 192
   // Soft SPI receive byte
198 193
   uint8_t spiRec() {

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

@@ -151,13 +151,12 @@
151 151
     (((uint32_t)(addr) & 0xF0000000) + 0x02000000 + ((uint32_t)(addr)&0xFFFFF)*32 + (bit)*4)
152 152
 
153 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 155
     uint32_t bin = 0;
156 156
     uint32_t work = 0;
157 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 158
     uint32_t SCK_PORT_PLUS30 = ((uint32_t) PORT(SCK_PIN)) + 0x30;    /* SODR of port */
159 159
     uint32_t SCK_MASK = PIN_MASK(SCK_PIN);
160
-    UNUSED(bout);
161 160
 
162 161
     /* The software SPI routine */
163 162
     __asm__ __volatile__(

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

@@ -55,12 +55,9 @@ static int pending_char = -1;
55 55
 #endif
56 56
 
57 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 62
 int MarlinSerialUSB::peek() {
66 63
   if (pending_char >= 0)

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

@@ -33,19 +33,12 @@ Ctrl_status sd_mmc_spi_read_capacity(uint32_t *nb_sector) {
33 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 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 44
 #if ACCESS_USB == true

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

@@ -25,4 +25,4 @@
25 25
 void watchdog_init();
26 26
 
27 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,7 +78,7 @@ extern HalSerial usb_serial;
78 78
 #define ENABLE_ISRS()
79 79
 #define DISABLE_ISRS()
80 80
 
81
-inline void HAL_init() { }
81
+inline void HAL_init() {}
82 82
 
83 83
 // Utility functions
84 84
 #pragma GCC diagnostic push

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

@@ -83,9 +83,9 @@ public:
83 83
 
84 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 90
   int peek() {
91 91
     uint8_t value;

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

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

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

@@ -104,17 +104,11 @@ extern "C" {
104 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 114
 #endif // ARDUINO_ARCH_STM32 && !STM32GENERIC

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

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

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

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

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

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

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

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

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

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

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

@@ -138,8 +138,7 @@ void pca9632_set_led_color(const LEDColor &color) {
138 138
 
139 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 142
     uint8_t data[] = PCA9632_BUZZER_DATA;
144 143
     Wire.beginTransmission(I2C_ADDRESS(PCA9632_ADDRESS));
145 144
     Wire.write(data, sizeof(data));

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

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

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

@@ -266,7 +266,7 @@ class FilamentSensorBase {
266 266
       }
267 267
 
268 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 271
       static inline void run() {
272 272
         const bool out = poll_runout_state(active_extruder);
@@ -353,8 +353,8 @@ class FilamentSensorBase {
353 353
       static inline void reset()                                  { runout_count = runout_threshold; }
354 354
       static inline void run()                                    { if (runout_count >= 0) runout_count--; }
355 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 360
 #endif // !FILAMENT_RUNOUT_DISTANCE_MM

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

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

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

@@ -290,9 +290,9 @@ public:
290 290
     static inline float mm_to_linear_unit(const float mm)     { return mm; }
291 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 297
   #endif
298 298
 

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

@@ -114,8 +114,7 @@ FORCE_INLINE void draw_menu_item_edit_P(const bool sel, const uint8_t row, PGM_P
114 114
   FORCE_INLINE void draw_menu_item_edit_##NAME (const bool sel, const uint8_t row, PGM_P const pstr, TYPE * const data, ...) { \
115 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 118
     DRAW_MENU_ITEM_SETTING_EDIT_GENERIC(STRFUNC(pget())); \
120 119
   } \
121 120
   typedef void NAME##_void
@@ -149,13 +148,12 @@ DEFINE_DRAW_MENU_ITEM_SETTING_EDIT(long5_25);         // 12345      right-justif
149 148
 
150 149
 class MenuItem_back {
151 150
   public:
152
-    static inline void action(PGM_P const dummy=nullptr) {
151
+    static inline void action(PGM_P const=nullptr) {
153 152
       ui.goto_previous_screen(
154 153
         #if ENABLED(TURBO_BACK_MENU_ITEM)
155 154
           true
156 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,6 +108,7 @@ class MenuItem_sdfile {
108 108
         MenuItem_submenu::action(pstr, menu_sd_confirm);
109 109
       #else
110 110
         sdcard_start_selected_file();
111
+        UNUSED(pstr);
111 112
       #endif
112 113
     }
113 114
 };

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

@@ -273,7 +273,7 @@ public:
273 273
 
274 274
     static void init();
275 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 278
     static char status_message[];
279 279
     static bool has_status();
@@ -393,10 +393,10 @@ public:
393 393
     static inline void update() {}
394 394
     static inline void refresh() {}
395 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 400
     static inline void reset_status() {}
401 401
     static inline void reset_alert_level() {}
402 402
     static constexpr bool has_status() { return false; }

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

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

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

@@ -279,12 +279,12 @@ void homeaxis(const AxisEnum axis);
279 279
 #else
280 280
   #define NATIVE_TO_LOGICAL(POS, AXIS) (POS)
281 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 288
 #endif
289 289
 #define LOGICAL_X_POSITION(POS) NATIVE_TO_LOGICAL(POS, X_AXIS)
290 290
 #define LOGICAL_Y_POSITION(POS) NATIVE_TO_LOGICAL(POS, Y_AXIS)

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

@@ -431,12 +431,9 @@ class Planner {
431 431
 
432 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 438
     #endif
442 439
 

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

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

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

@@ -813,13 +813,7 @@ void Temperature::min_temp_error(const heater_ind_t heater) {
813 813
 
814 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 817
     const uint8_t ee = HOTEND_INDEX;
824 818
     #if ENABLED(PIDTEMP)
825 819
       #if DISABLED(PID_OPENLOOP)
@@ -860,8 +854,13 @@ void Temperature::min_temp_error(const heater_ind_t heater) {
860 854
           pid_output = work_pid[ee].Kp + work_pid[ee].Ki + work_pid[ee].Kd + float(MIN_POWER);
861 855
 
862 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 862
             work_pid[ee].Kc = 0;
864
-            if (_HOTEND_TEST) {
863
+            if (this_hotend) {
865 864
               const long e_position = stepper.position(E_AXIS);
866 865
               if (e_position > last_e_position) {
867 866
                 lpq[lpq_ptr] = e_position - last_e_position;
@@ -895,6 +894,7 @@ void Temperature::min_temp_error(const heater_ind_t heater) {
895 894
             MSG_PID_DEBUG_OUTPUT, pid_output
896 895
           );
897 896
           #if DISABLED(PID_OPENLOOP)
897
+          {
898 898
             SERIAL_ECHOPAIR(
899 899
               MSG_PID_DEBUG_PTERM, work_pid[ee].Kp,
900 900
               MSG_PID_DEBUG_ITERM, work_pid[ee].Ki,
@@ -903,6 +903,7 @@ void Temperature::min_temp_error(const heater_ind_t heater) {
903 903
                 , MSG_PID_DEBUG_CTERM, work_pid[ee].Kc
904 904
               #endif
905 905
             );
906
+          }
906 907
           #endif
907 908
           SERIAL_EOL();
908 909
         }
@@ -911,12 +912,11 @@ void Temperature::min_temp_error(const heater_ind_t heater) {
911 912
     #else // No PID enabled
912 913
 
913 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 916
       #else
916
-        #define _TIMED_OUT_TEST false
917
+        constexpr bool is_idling = false;
917 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 921
     #endif
922 922
 
@@ -971,6 +971,7 @@ void Temperature::min_temp_error(const heater_ind_t heater) {
971 971
     #endif // PID_OPENLOOP
972 972
 
973 973
     #if ENABLED(PID_BED_DEBUG)
974
+    {
974 975
       SERIAL_ECHO_START();
975 976
       SERIAL_ECHOLNPAIR(
976 977
         " PID_BED_DEBUG : Input ", temp_bed.celsius, " Output ", pid_output,
@@ -980,6 +981,7 @@ void Temperature::min_temp_error(const heater_ind_t heater) {
980 981
           MSG_PID_DEBUG_DTERM, work_pid.Kd,
981 982
         #endif
982 983
       );
984
+    }
983 985
     #endif
984 986
 
985 987
     return pid_output;
@@ -1811,8 +1813,7 @@ void Temperature::init() {
1811 1813
    * their target temperature by a configurable margin.
1812 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 1817
     const uint8_t ee = HOTEND_INDEX;
1817 1818
     if (degTargetHotend(ee) && degHotend(ee) < degTargetHotend(ee) - (WATCH_TEMP_INCREASE + TEMP_HYSTERESIS + 1)) {
1818 1819
       watch_hotend[ee].target = degHotend(ee) + WATCH_TEMP_INCREASE;

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

@@ -39,10 +39,10 @@
39 39
 
40 40
 #if HOTENDS <= 1
41 41
   #define HOTEND_INDEX  0
42
-  #define E_UNUSED() UNUSED(e)
42
+  #define E_NAME
43 43
 #else
44 44
   #define HOTEND_INDEX  e
45
-  #define E_UNUSED()
45
+  #define E_NAME e
46 46
 #endif
47 47
 
48 48
 // Identifiers for other heaters
@@ -304,17 +304,15 @@ class Temperature {
304 304
       static bool allow_cold_extrude;
305 305
       static int16_t extrude_min_temp;
306 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 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 311
         return tooCold(degTargetHotend(HOTEND_INDEX));
314 312
       }
315 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 316
     #endif
319 317
 
320 318
     FORCE_INLINE static bool hotEnoughToExtrude(const uint8_t e) { return !tooColdToExtrude(e); }
@@ -546,16 +544,13 @@ class Temperature {
546 544
      * Preheating hotends
547 545
      */
548 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 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 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 554
         preheat_end_time[HOTEND_INDEX] = 0;
560 555
       }
561 556
     #else
@@ -566,39 +561,36 @@ class Temperature {
566 561
     //inline so that there is no performance decrease.
567 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 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 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 590
     #if WATCH_HOTENDS
599 591
       static void start_watching_hotend(const uint8_t e=0);
600 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 594
     #endif
603 595
 
604 596
     #if HOTENDS
@@ -612,8 +604,7 @@ class Temperature {
612 604
         static inline void start_watching_E5() { start_watching_hotend(5); }
613 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 608
         const uint8_t ee = HOTEND_INDEX;
618 609
         #ifdef MILLISECONDS_PREHEAT_TIME
619 610
           if (celsius == 0)
@@ -628,13 +619,11 @@ class Temperature {
628 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 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 627
         return temp_hotend[HOTEND_INDEX].target < temp_hotend[HOTEND_INDEX].celsius;
639 628
       }
640 629
 
@@ -765,8 +754,7 @@ class Temperature {
765 754
 
766 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 758
         hotend_idle[HOTEND_INDEX].reset();
771 759
         start_watching_hotend(HOTEND_INDEX);
772 760
       }

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

@@ -57,13 +57,13 @@ class Sd2Card {
57 57
 
58 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 68
     bool readBlock(uint32_t block, uint8_t* dst);
69 69
     bool writeBlock(uint32_t blockNumber, const uint8_t* src);

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

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

Loading…
Cancel
Save