ソースを参照

Clean up formatting, wrap macros

Scott Lahteine 3年前
コミット
3bddbb1110

+ 1
- 1
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
110 110
 }
111 111
 
112 112
 uint8_t BulkStorage::Write(uint8_t lun, uint32_t addr, uint16_t bsize, uint8_t blocks, const uint8_t * buf) {
113
-  return USBH_MSC_Write(&hUsbHost, lun, addr, const_cast <uint8_t*>(buf), blocks) != USBH_OK;
113
+  return USBH_MSC_Write(&hUsbHost, lun, addr, const_cast<uint8_t*>(buf), blocks) != USBH_OK;
114 114
 }
115 115
 
116 116
 #endif // USE_OTG_USB_HOST && USBHOST

+ 1
- 1
Marlin/src/MarlinCore.cpp ファイルの表示

@@ -600,7 +600,7 @@ inline void manage_inactivity(const bool ignore_stepper_queue=false) {
600 600
   TERN_(HOTEND_IDLE_TIMEOUT, hotend_idle.check());
601 601
 
602 602
   #if ENABLED(EXTRUDER_RUNOUT_PREVENT)
603
-    if (thermalManager.degHotend(active_extruder) > EXTRUDER_RUNOUT_MINTEMP
603
+    if (thermalManager.degHotend(active_extruder) > (EXTRUDER_RUNOUT_MINTEMP)
604 604
       && ELAPSED(ms, gcode.previous_move_ms + SEC_TO_MS(EXTRUDER_RUNOUT_SECONDS))
605 605
       && !planner.has_blocks_queued()
606 606
     ) {

+ 1
- 1
Marlin/src/feature/hotend_idle.cpp ファイルの表示

@@ -45,7 +45,7 @@ void HotendIdleProtection::check_hotends(const millis_t &ms) {
45 45
   bool do_prot = false;
46 46
   HOTEND_LOOP() {
47 47
     const bool busy = (TERN0(HAS_RESUME_CONTINUE, wait_for_user) || planner.has_blocks_queued());
48
-    if (thermalManager.degHotend(e) >= HOTEND_IDLE_MIN_TRIGGER && !busy) {
48
+    if (thermalManager.degHotend(e) >= (HOTEND_IDLE_MIN_TRIGGER) && !busy) {
49 49
       do_prot = true; break;
50 50
     }
51 51
   }

+ 1
- 7
Marlin/src/feature/leds/printer_event_leds.h ファイルの表示

@@ -36,13 +36,7 @@ private:
36 36
     static bool leds_off_after_print;
37 37
   #endif
38 38
 
39
-  static inline void set_done() {
40
-    #if ENABLED(LED_COLOR_PRESETS)
41
-      leds.set_default();
42
-    #else
43
-      leds.set_off();
44
-    #endif
45
-  }
39
+  static inline void set_done() { TERN(LED_COLOR_PRESETS, leds.set_default(), leds.set_off()); }
46 40
 
47 41
 public:
48 42
   #if HAS_TEMP_HOTEND

+ 3
- 3
Marlin/src/feature/power.cpp ファイルの表示

@@ -85,15 +85,15 @@ bool Power::is_power_needed() {
85 85
   if (TERN0(HAS_HEATED_BED, thermalManager.degTargetBed() > 0 || thermalManager.temp_bed.soft_pwm_amount > 0)) return true;
86 86
 
87 87
   #if HAS_HOTEND && AUTO_POWER_E_TEMP
88
-    HOTEND_LOOP() if (thermalManager.degHotend(e) >= AUTO_POWER_E_TEMP) return true;
88
+    HOTEND_LOOP() if (thermalManager.degHotend(e) >= (AUTO_POWER_E_TEMP)) return true;
89 89
   #endif
90 90
 
91 91
   #if HAS_HEATED_CHAMBER && AUTO_POWER_CHAMBER_TEMP
92
-    if (thermalManager.degChamber() >= AUTO_POWER_CHAMBER_TEMP) return true;
92
+    if (thermalManager.degChamber() >= (AUTO_POWER_CHAMBER_TEMP)) return true;
93 93
   #endif
94 94
 
95 95
   #if HAS_COOLER && AUTO_POWER_COOLER_TEMP
96
-    if (thermalManager.degCooler() >= AUTO_POWER_COOLER_TEMP) return true;
96
+    if (thermalManager.degCooler() >= (AUTO_POWER_COOLER_TEMP)) return true;
97 97
   #endif
98 98
 
99 99
   return false;

+ 1
- 1
Marlin/src/feature/probe_temp_comp.cpp ファイルの表示

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

+ 3
- 3
Marlin/src/feature/probe_temp_comp.h ファイルの表示

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

+ 1
- 1
Marlin/src/gcode/calibrate/G76_M192_M871.cpp ファイルの表示

@@ -208,7 +208,7 @@ void GcodeSuite::G76() {
208 208
         report_temps(next_temp_report);
209 209
 
210 210
       const float measured_z = g76_probe(TSI_BED, target_bed, noz_pos_xyz);
211
-      if (isnan(measured_z) || target_bed > BED_MAX_TARGET) break;
211
+      if (isnan(measured_z) || target_bed > (BED_MAX_TARGET)) break;
212 212
     }
213 213
 
214 214
     SERIAL_ECHOLNPAIR("Retrieved measurements: ", temp_comp.get_index());

+ 1
- 1
Marlin/src/lcd/extui/lib/anycubic_chiron/chiron_tft.cpp ファイルの表示

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

+ 6
- 6
Marlin/src/lcd/extui/lib/anycubic_i3mega/anycubic_i3mega_lcd.cpp ファイルの表示

@@ -700,13 +700,13 @@ void AnycubicTFTClass::GetCommandFromTFT() {
700 700
             unsigned int tempvalue;
701 701
             if (CodeSeen('S')) {
702 702
               tempvalue = constrain(CodeValue(), 0, 275);
703
-              setTargetTemp_celsius(tempvalue, (extruder_t) E0);
703
+              setTargetTemp_celsius(tempvalue, (extruder_t)E0);
704 704
             }
705 705
             else if (CodeSeen('C') && !isPrinting()) {
706 706
               if (getAxisPosition_mm(Z) < 10)
707 707
                 injectCommands_P(PSTR("G1 Z10")); // RASE Z AXIS
708 708
               tempvalue = constrain(CodeValue(), 0, 275);
709
-              setTargetTemp_celsius(tempvalue, (extruder_t) E0);
709
+              setTargetTemp_celsius(tempvalue, (extruder_t)E0);
710 710
             }
711 711
           }
712 712
           break;
@@ -832,8 +832,8 @@ void AnycubicTFTClass::GetCommandFromTFT() {
832 832
               if (getAxisPosition_mm(Z) < 10)
833 833
                 injectCommands_P(PSTR("G1 Z10")); // RASE Z AXIS
834 834
 
835
-              setTargetTemp_celsius(PREHEAT_1_TEMP_BED, (heater_t) BED);
836
-              setTargetTemp_celsius(PREHEAT_1_TEMP_HOTEND, (extruder_t) E0);
835
+              setTargetTemp_celsius(PREHEAT_1_TEMP_BED, (heater_t)BED);
836
+              setTargetTemp_celsius(PREHEAT_1_TEMP_HOTEND, (extruder_t)E0);
837 837
               SENDLINE_PGM("OK");
838 838
             }
839 839
             break;
@@ -843,8 +843,8 @@ void AnycubicTFTClass::GetCommandFromTFT() {
843 843
               if (getAxisPosition_mm(Z) < 10)
844 844
                 injectCommands_P(PSTR("G1 Z10")); // RASE Z AXIS
845 845
 
846
-              setTargetTemp_celsius(PREHEAT_2_TEMP_BED, (heater_t) BED);
847
-              setTargetTemp_celsius(PREHEAT_2_TEMP_HOTEND, (extruder_t) E0);
846
+              setTargetTemp_celsius(PREHEAT_2_TEMP_BED, (heater_t)BED);
847
+              setTargetTemp_celsius(PREHEAT_2_TEMP_HOTEND, (extruder_t)E0);
848 848
               SENDLINE_PGM("OK");
849 849
             }
850 850
             break;

+ 1
- 1
Marlin/src/lcd/extui/lib/mks_ui/draw_printing.cpp ファイルの表示

@@ -236,7 +236,7 @@ void disp_bed_temp() {
236 236
 }
237 237
 
238 238
 void disp_fan_speed() {
239
-  sprintf_P(public_buf_l, PSTR("%d%%"), thermalManager.fanSpeedPercent(0));
239
+  sprintf_P(public_buf_l, PSTR("%d%%"), (int)thermalManager.fanSpeedPercent(0));
240 240
   lv_label_set_text(labelFan, public_buf_l);
241 241
 }
242 242
 

+ 1
- 5
Marlin/src/lcd/extui/malyan_lcd.cpp ファイルの表示

@@ -178,11 +178,7 @@ void process_lcd_eb_command(const char *command) {
178 178
         #else
179 179
           0, 0,
180 180
         #endif
181
-        #if ENABLED(SDSUPPORT)
182
-          done_pct,
183
-        #else
184
-          0,
185
-        #endif
181
+        TERN(SDSUPPORT, done_pct, 0),
186 182
         elapsed_buffer
187 183
       );
188 184
       write_to_lcd(message_buffer);

+ 4
- 12
Marlin/src/lcd/extui/ui_api.cpp ファイルの表示

@@ -296,21 +296,13 @@ namespace ExtUI {
296 296
   }
297 297
 
298 298
   float getTargetFan_percent(const fan_t fan) {
299
-    #if HAS_FAN
300
-      return thermalManager.fanSpeedPercent(fan - FAN0);
301
-    #else
302
-      UNUSED(fan);
303
-      return 0;
304
-    #endif
299
+    UNUSED(fan);
300
+    return TERN0(HAS_FAN, thermalManager.fanSpeedPercent(fan - FAN0));
305 301
   }
306 302
 
307 303
   float getActualFan_percent(const fan_t fan) {
308
-    #if HAS_FAN
309
-      return thermalManager.scaledFanSpeedPercent(fan - FAN0);
310
-    #else
311
-      UNUSED(fan);
312
-      return 0;
313
-    #endif
304
+    UNUSED(fan);
305
+    return TERN0(HAS_FAN, thermalManager.scaledFanSpeedPercent(fan - FAN0));
314 306
   }
315 307
 
316 308
   float getAxisPosition_mm(const axis_t axis) {

+ 21
- 21
Marlin/src/lcd/extui/ui_api.h ファイルの表示

@@ -102,11 +102,11 @@ namespace ExtUI {
102 102
   #if HAS_TRINAMIC_CONFIG
103 103
     float getAxisCurrent_mA(const axis_t);
104 104
     float getAxisCurrent_mA(const extruder_t);
105
-    void  setAxisCurrent_mA(const_float_t , const axis_t);
106
-    void  setAxisCurrent_mA(const_float_t , const extruder_t);
105
+    void  setAxisCurrent_mA(const_float_t, const axis_t);
106
+    void  setAxisCurrent_mA(const_float_t, const extruder_t);
107 107
 
108 108
      int getTMCBumpSensitivity(const axis_t);
109
-    void setTMCBumpSensitivity(const_float_t , const axis_t);
109
+    void setTMCBumpSensitivity(const_float_t, const axis_t);
110 110
   #endif
111 111
 
112 112
   celsius_float_t getActualTemp_celsius(const heater_t);
@@ -195,18 +195,18 @@ namespace ExtUI {
195 195
     char* getFilamentUsed_str(char buffer[21]);
196 196
   #endif
197 197
 
198
-  void setTargetTemp_celsius(const_float_t , const heater_t);
199
-  void setTargetTemp_celsius(const_float_t , const extruder_t);
200
-  void setTargetFan_percent(const_float_t , const fan_t);
198
+  void setTargetTemp_celsius(const_float_t, const heater_t);
199
+  void setTargetTemp_celsius(const_float_t, const extruder_t);
200
+  void setTargetFan_percent(const_float_t, const fan_t);
201 201
   void coolDown();
202
-  void setAxisPosition_mm(const_float_t , const axis_t, const feedRate_t=0);
203
-  void setAxisPosition_mm(const_float_t , const extruder_t, const feedRate_t=0);
204
-  void setAxisSteps_per_mm(const_float_t , const axis_t);
205
-  void setAxisSteps_per_mm(const_float_t , const extruder_t);
202
+  void setAxisPosition_mm(const_float_t, const axis_t, const feedRate_t=0);
203
+  void setAxisPosition_mm(const_float_t, const extruder_t, const feedRate_t=0);
204
+  void setAxisSteps_per_mm(const_float_t, const axis_t);
205
+  void setAxisSteps_per_mm(const_float_t, const extruder_t);
206 206
   void setAxisMaxFeedrate_mm_s(const feedRate_t, const axis_t);
207 207
   void setAxisMaxFeedrate_mm_s(const feedRate_t, const extruder_t);
208
-  void setAxisMaxAcceleration_mm_s2(const_float_t , const axis_t);
209
-  void setAxisMaxAcceleration_mm_s2(const_float_t , const extruder_t);
208
+  void setAxisMaxAcceleration_mm_s2(const_float_t, const axis_t);
209
+  void setAxisMaxAcceleration_mm_s2(const_float_t, const extruder_t);
210 210
   void setFeedrate_mm_s(const feedRate_t);
211 211
   void setMinFeedrate_mm_s(const feedRate_t);
212 212
   void setMinTravelFeedrate_mm_s(const feedRate_t);
@@ -220,7 +220,7 @@ namespace ExtUI {
220 220
 
221 221
   #if ENABLED(LIN_ADVANCE)
222 222
     float getLinearAdvance_mm_mm_s(const extruder_t);
223
-    void setLinearAdvance_mm_mm_s(const_float_t , const extruder_t);
223
+    void setLinearAdvance_mm_mm_s(const_float_t, const extruder_t);
224 224
   #endif
225 225
 
226 226
   #if HAS_JUNCTION_DEVIATION
@@ -229,8 +229,8 @@ namespace ExtUI {
229 229
   #else
230 230
     float getAxisMaxJerk_mm_s(const axis_t);
231 231
     float getAxisMaxJerk_mm_s(const extruder_t);
232
-    void setAxisMaxJerk_mm_s(const_float_t , const axis_t);
233
-    void setAxisMaxJerk_mm_s(const_float_t , const extruder_t);
232
+    void setAxisMaxJerk_mm_s(const_float_t, const axis_t);
233
+    void setAxisMaxJerk_mm_s(const_float_t, const extruder_t);
234 234
   #endif
235 235
 
236 236
   extruder_t getTool(const uint8_t extruder);
@@ -246,7 +246,7 @@ namespace ExtUI {
246 246
 
247 247
   #if HAS_HOTEND_OFFSET
248 248
     float getNozzleOffset_mm(const axis_t, const extruder_t);
249
-    void setNozzleOffset_mm(const_float_t , const axis_t, const extruder_t);
249
+    void setNozzleOffset_mm(const_float_t, const axis_t, const extruder_t);
250 250
     void normalizeNozzleOffset(const axis_t axis);
251 251
   #endif
252 252
 
@@ -255,12 +255,12 @@ namespace ExtUI {
255 255
 
256 256
   #if HAS_BED_PROBE
257 257
     float getProbeOffset_mm(const axis_t);
258
-    void setProbeOffset_mm(const_float_t , const axis_t);
258
+    void setProbeOffset_mm(const_float_t, const axis_t);
259 259
   #endif
260 260
 
261 261
   #if ENABLED(BACKLASH_GCODE)
262 262
     float getAxisBacklash_mm(const axis_t);
263
-    void setAxisBacklash_mm(const_float_t , const axis_t);
263
+    void setAxisBacklash_mm(const_float_t, const axis_t);
264 264
 
265 265
     float getBacklashCorrection_percent();
266 266
     void setBacklashCorrection_percent(const_float_t );
@@ -297,15 +297,15 @@ namespace ExtUI {
297 297
     float getPIDValues_Kp(const extruder_t);
298 298
     float getPIDValues_Ki(const extruder_t);
299 299
     float getPIDValues_Kd(const extruder_t);
300
-    void setPIDValues(const_float_t , const_float_t , const_float_t , extruder_t);
301
-    void startPIDTune(const_float_t , extruder_t);
300
+    void setPIDValues(const_float_t, const_float_t , const_float_t , extruder_t);
301
+    void startPIDTune(const_float_t, extruder_t);
302 302
   #endif
303 303
 
304 304
   #if ENABLED(PIDTEMPBED)
305 305
     float getBedPIDValues_Kp();
306 306
     float getBedPIDValues_Ki();
307 307
     float getBedPIDValues_Kd();
308
-    void setBedPIDValues(const_float_t , const_float_t , const_float_t );
308
+    void setBedPIDValues(const_float_t, const_float_t , const_float_t );
309 309
     void startBedPIDTune(const_float_t );
310 310
   #endif
311 311
 

+ 2
- 2
Marlin/src/module/temperature.cpp ファイルの表示

@@ -567,7 +567,7 @@ volatile bool Temperature::raw_temps_ready = false;
567 567
     SHV(bias);
568 568
 
569 569
     #if ENABLED(PRINTER_EVENT_LEDS)
570
-      const celsius_float_t start_temp = GHV(temp_chamber.celsius, temp_bed.celsius, temp_hotend[heater_id].celsius);
570
+      const celsius_float_t start_temp = GHV(degChamber(), degBed(), degHotend(heater_id));
571 571
       LEDColor color = ONHEATINGSTART();
572 572
     #endif
573 573
 
@@ -583,7 +583,7 @@ volatile bool Temperature::raw_temps_ready = false;
583 583
         updateTemperaturesFromRawValues();
584 584
 
585 585
         // Get the current temperature and constrain it
586
-        current_temp = GHV(temp_chamber.celsius, temp_bed.celsius, temp_hotend[heater_id].celsius);
586
+        current_temp = GHV(degChamber(), degBed(), degHotend(heater_id));
587 587
         NOLESS(maxT, current_temp);
588 588
         NOMORE(minT, current_temp);
589 589
 

+ 1
- 3
Marlin/src/module/tool_change.cpp ファイルの表示

@@ -1054,8 +1054,6 @@ void tool_change(const uint8_t new_tool, bool no_move/*=false*/) {
1054 1054
         first_tool_is_primed = true;
1055 1055
         TERN_(TOOLCHANGE_FS_INIT_BEFORE_SWAP, toolchange_extruder_ready[old_tool] = true); // Primed and initialized
1056 1056
       }
1057
-    #else
1058
-      constexpr bool first_tool_is_primed = true;
1059 1057
     #endif
1060 1058
 
1061 1059
     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*/) {
1092 1090
           }
1093 1091
           else {
1094 1092
             // For first new tool, change without unloading the old. 'Just prime/init the new'
1095
-            if (first_tool_is_primed)
1093
+            if (TERN1(TOOLCHANGE_FS_PRIME_FIRST_USED, first_tool_is_primed))
1096 1094
               unscaled_e_move(-toolchange_settings.swap_length, MMM_TO_MMS(toolchange_settings.retract_speed));
1097 1095
             TERN_(TOOLCHANGE_FS_PRIME_FIRST_USED, first_tool_is_primed = true); // The first new tool will be primed by toolchanging
1098 1096
           }

読み込み中…
キャンセル
保存