Преглед на файлове

🎨 Misc. cleanup, comments

Scott Lahteine преди 2 години
родител
ревизия
1bd921d6a6

+ 1
- 1
Marlin/Configuration.h Целия файл

@@ -390,7 +390,7 @@
390 390
     #define POWER_TIMEOUT              30 // (s) Turn off power if the machine is idle for this duration
391 391
     //#define POWER_OFF_DELAY          60 // (s) Delay of poweroff after M81 command. Useful to let fans run for extra time.
392 392
   #endif
393
-  #if EITHER(AUTO_POWER_CONTROL, POWER_OFF_WAIT_FOR_COOLDOWN) 
393
+  #if EITHER(AUTO_POWER_CONTROL, POWER_OFF_WAIT_FOR_COOLDOWN)
394 394
     //#define AUTO_POWER_E_TEMP        50 // (°C) PSU on if any extruder is over this temperature
395 395
     //#define AUTO_POWER_CHAMBER_TEMP  30 // (°C) PSU on if the chamber is over this temperature
396 396
     //#define AUTO_POWER_COOLER_TEMP   26 // (°C) PSU on if the cooler is over this temperature

+ 5
- 5
Marlin/src/feature/easythreed_ui.cpp Целия файл

@@ -194,11 +194,11 @@ void EasythreedUI::printButton() {
194 194
                 print_key_flag = PF_START;
195 195
                 return;                                             // Bail out
196 196
             }
197
-            card.ls();                                            // List all files to serial output
198
-            const uint16_t filecnt = card.countFilesInWorkDir();  // Count printable files in cwd
199
-            if (filecnt == 0) return;                             // None are printable?
200
-            card.selectFileByIndex(filecnt);                      // Select the last file according to current sort options
201
-            card.openAndPrintFile(card.filename);                 // Start printing it
197
+            card.ls();                                              // List all files to serial output
198
+            const uint16_t filecnt = card.countFilesInWorkDir();    // Count printable files in cwd
199
+            if (filecnt == 0) return;                               // None are printable?
200
+            card.selectFileByIndex(filecnt);                        // Select the last file according to current sort options
201
+            card.openAndPrintFile(card.filename);                   // Start printing it
202 202
             break;
203 203
           }
204 204
           case PF_PAUSE: {                                          // Pause printing (not currently firing)

+ 1
- 1
Marlin/src/feature/power.h Целия файл

@@ -36,7 +36,7 @@ class Power {
36 36
     static void init();
37 37
     static void power_on();
38 38
     static void power_off();
39
-    
39
+
40 40
     #if EITHER(POWER_OFF_TIMER, POWER_OFF_WAIT_FOR_COOLDOWN)
41 41
       #if ENABLED(POWER_OFF_TIMER)
42 42
         static millis_t power_off_time;

+ 6
- 0
Marlin/src/gcode/bedlevel/abl/G29.cpp Целия файл

@@ -290,6 +290,9 @@ G29_TYPE GcodeSuite::G29() {
290 290
                     ry = RAW_Y_POSITION(parser.linearval('Y', NAN));
291 291
         int8_t i = parser.byteval('I', -1), j = parser.byteval('J', -1);
292 292
 
293
+        #pragma GCC diagnostic push
294
+        #pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
295
+
293 296
         if (!isnan(rx) && !isnan(ry)) {
294 297
           // Get nearest i / j from rx / ry
295 298
           i = (rx - bilinear_start.x + 0.5 * abl.gridSpacing.x) / abl.gridSpacing.x;
@@ -297,6 +300,9 @@ G29_TYPE GcodeSuite::G29() {
297 300
           LIMIT(i, 0, (GRID_MAX_POINTS_X) - 1);
298 301
           LIMIT(j, 0, (GRID_MAX_POINTS_Y) - 1);
299 302
         }
303
+
304
+        #pragma GCC diagnostic pop
305
+
300 306
         if (WITHIN(i, 0, (GRID_MAX_POINTS_X) - 1) && WITHIN(j, 0, (GRID_MAX_POINTS_Y) - 1)) {
301 307
           set_bed_leveling_enabled(false);
302 308
           z_values[i][j] = rz;

+ 4
- 1
Marlin/src/lcd/e3v2/creality/dwin.cpp Целия файл

@@ -2760,7 +2760,10 @@ void HMI_Prepare() {
2760 2760
       #endif
2761 2761
 
2762 2762
       #if HAS_HOTEND || HAS_HEATED_BED
2763
-        case PREPARE_CASE_COOL: thermalManager.cooldown(); break;
2763
+        case PREPARE_CASE_COOL:
2764
+          thermalManager.cooldown();
2765
+          ui.reset_status();
2766
+          break;
2764 2767
       #endif
2765 2768
 
2766 2769
       case PREPARE_CASE_LANG:

+ 1
- 1
Marlin/src/lcd/touch/touch_buttons.cpp Целия файл

@@ -79,7 +79,7 @@ uint8_t TouchButtons::read_buttons() {
79 79
 
80 80
     #if ENABLED(TOUCH_SCREEN_CALIBRATION)
81 81
       const calibrationState state = touch_calibration.get_calibration_state();
82
-      if (state >= CALIBRATION_TOP_LEFT && state <= CALIBRATION_BOTTOM_RIGHT) {
82
+      if (WITHIN(state, CALIBRATION_TOP_LEFT, CALIBRATION_BOTTOM_RIGHT)) {
83 83
         if (touch_calibration.handleTouch(x, y)) ui.refresh();
84 84
         return 0;
85 85
       }

+ 9
- 6
Marlin/src/module/endstops.cpp Целия файл

@@ -593,9 +593,6 @@ void _O2 Endstops::report_states() {
593 593
 
594 594
 } // Endstops::report_states
595 595
 
596
-// The following routines are called from an ISR context. It could be the temperature ISR, the
597
-// endstop ISR or the Stepper ISR.
598
-
599 596
 #if HAS_DELTA_SENSORLESS_PROBING
600 597
   #define __ENDSTOP(AXIS, ...) AXIS ##_MAX
601 598
   #define _ENDSTOP_PIN(AXIS, ...) AXIS ##_MAX_PIN
@@ -607,13 +604,18 @@ void _O2 Endstops::report_states() {
607 604
 #endif
608 605
 #define _ENDSTOP(AXIS, MINMAX) __ENDSTOP(AXIS, MINMAX)
609 606
 
610
-// Check endstops - Could be called from Temperature ISR!
607
+/**
608
+ * Called from interrupt context by the Endstop ISR or Stepper ISR!
609
+ * Read endstops to get their current states, register hits for all
610
+ * axes moving in the direction of their endstops, and abort moves.
611
+ */
611 612
 void Endstops::update() {
612 613
 
613
-  #if !ENDSTOP_NOISE_THRESHOLD
614
-    if (!abort_enabled()) return;
614
+  #if !ENDSTOP_NOISE_THRESHOLD      // If not debouncing...
615
+    if (!abort_enabled()) return;   // ...and not enabled, exit.
615 616
   #endif
616 617
 
618
+  // Macros to update / copy the live_state
617 619
   #define UPDATE_ENDSTOP_BIT(AXIS, MINMAX) SET_BIT_TO(live_state, _ENDSTOP(AXIS, MINMAX), (READ(_ENDSTOP_PIN(AXIS, MINMAX)) != _ENDSTOP_INVERTING(AXIS, MINMAX)))
618 620
   #define COPY_LIVE_STATE(SRC_BIT, DST_BIT) SET_BIT_TO(live_state, DST_BIT, TEST(live_state, SRC_BIT))
619 621
 
@@ -1107,6 +1109,7 @@ void Endstops::update() {
1107 1109
 
1108 1110
 #if ENABLED(SPI_ENDSTOPS)
1109 1111
 
1112
+  // Called from idle() to read Trinamic stall states
1110 1113
   bool Endstops::tmc_spi_homing_check() {
1111 1114
     bool hit = false;
1112 1115
     #if X_SPI_SENSORLESS

+ 3
- 7
Marlin/src/module/stepper.cpp Целия файл

@@ -2346,13 +2346,9 @@ uint32_t Stepper::block_phase_isr() {
2346 2346
         #endif
2347 2347
       #endif // LASER_POWER_INLINE
2348 2348
 
2349
-      // At this point, we must ensure the movement about to execute isn't
2350
-      // trying to force the head against a limit switch. If using interrupt-
2351
-      // driven change detection, and already against a limit then no call to
2352
-      // the endstop_triggered method will be done and the movement will be
2353
-      // done against the endstop. So, check the limits here: If the movement
2354
-      // is against the limits, the block will be marked as to be killed, and
2355
-      // on the next call to this ISR, will be discarded.
2349
+      // If the endstop is already pressed, endstop interrupts won't invoke
2350
+      // endstop_triggered and the move will grind. So check here for a
2351
+      // triggered endstop, which marks the block for discard on the next ISR.
2356 2352
       endstops.update();
2357 2353
 
2358 2354
       #if ENABLED(Z_LATE_ENABLE)

+ 14
- 29
Marlin/src/sd/cardreader.cpp Целия файл

@@ -271,9 +271,8 @@ void CardReader::selectByName(SdFile dir, const char * const match) {
271 271
  * good addition.
272 272
  */
273 273
 void CardReader::printListing(
274
-  SdFile parent
274
+  SdFile parent, const char * const prepend
275 275
   OPTARG(LONG_FILENAME_HOST_SUPPORT, const bool includeLongNames/*=false*/)
276
-  , const char * const prepend/*=nullptr*/
277 276
   OPTARG(LONG_FILENAME_HOST_SUPPORT, const char * const prependLong/*=nullptr*/)
278 277
 ) {
279 278
   dir_t p;
@@ -283,61 +282,47 @@ void CardReader::printListing(
283 282
       size_t lenPrepend = prepend ? strlen(prepend) + 1 : 0;
284 283
       // Allocate enough stack space for the full path including / separator
285 284
       char path[lenPrepend + FILENAME_LENGTH];
286
-      if (prepend) {
287
-        strcpy(path, prepend);
288
-        path[lenPrepend - 1] = '/';
289
-      }
285
+      if (prepend) { strcpy(path, prepend); path[lenPrepend - 1] = '/'; }
290 286
       char* dosFilename = path + lenPrepend;
291 287
       createFilename(dosFilename, p);
292 288
 
293 289
       // Get a new directory object using the full path
294 290
       // and dive recursively into it.
295 291
       SdFile child; // child.close() in destructor
296
-      if (child.open(&parent, dosFilename, O_READ))
292
+      if (child.open(&parent, dosFilename, O_READ)) {
297 293
         #if ENABLED(LONG_FILENAME_HOST_SUPPORT)
298 294
           if (includeLongNames) {
299 295
             size_t lenPrependLong = prependLong ? strlen(prependLong) + 1 : 0;
300 296
             // Allocate enough stack space for the full long path including / separator
301 297
             char pathLong[lenPrependLong + strlen(longFilename) + 1];
302
-            if (prependLong) {
303
-              strcpy(pathLong, prependLong);
304
-              pathLong[lenPrependLong - 1] = '/';
305
-            }
298
+            if (prependLong) { strcpy(pathLong, prependLong); pathLong[lenPrependLong - 1] = '/'; }
306 299
             strcpy(pathLong + lenPrependLong, longFilename);
307
-            printListing(child, true, path, pathLong);
300
+            printListing(child, path, true, pathLong);
308 301
           }
309 302
           else
310
-            printListing(child, false, path);
303
+            printListing(child, path);
311 304
         #else
312 305
           printListing(child, path);
313 306
         #endif
307
+      }
314 308
       else {
315 309
         SERIAL_ECHO_MSG(STR_SD_CANT_OPEN_SUBDIR, dosFilename);
316 310
         return;
317 311
       }
318 312
     }
319 313
     else if (is_dir_or_gcode(p)) {
320
-      if (prepend) {
321
-        SERIAL_ECHO(prepend);
322
-        SERIAL_CHAR('/');
323
-      }
314
+      if (prepend) { SERIAL_ECHO(prepend); SERIAL_CHAR('/'); }
324 315
       SERIAL_ECHO(createFilename(filename, p));
325 316
       SERIAL_CHAR(' ');
317
+      SERIAL_ECHO(p.fileSize);
326 318
       #if ENABLED(LONG_FILENAME_HOST_SUPPORT)
327
-        if (!includeLongNames)
328
-      #endif
329
-          SERIAL_ECHOLN(p.fileSize);
330
-      #if ENABLED(LONG_FILENAME_HOST_SUPPORT)
331
-        else {
332
-          SERIAL_ECHO(p.fileSize);
319
+        if (includeLongNames) {
333 320
           SERIAL_CHAR(' ');
334
-          if (prependLong) {
335
-            SERIAL_ECHO(prependLong);
336
-            SERIAL_CHAR('/');
337
-          }
338
-          SERIAL_ECHOLN(longFilename[0] ? longFilename : "???");
321
+          if (prependLong) { SERIAL_ECHO(prependLong); SERIAL_CHAR('/'); }
322
+          SERIAL_ECHO(longFilename[0] ? longFilename : "???");
339 323
         }
340 324
       #endif
325
+      SERIAL_EOL();
341 326
     }
342 327
   }
343 328
 }
@@ -348,7 +333,7 @@ void CardReader::printListing(
348 333
 void CardReader::ls(TERN_(LONG_FILENAME_HOST_SUPPORT, bool includeLongNames/*=false*/)) {
349 334
   if (flag.mounted) {
350 335
     root.rewind();
351
-    printListing(root OPTARG(LONG_FILENAME_HOST_SUPPORT, includeLongNames));
336
+    printListing(root, nullptr OPTARG(LONG_FILENAME_HOST_SUPPORT, includeLongNames));
352 337
   }
353 338
 }
354 339
 

+ 1
- 2
Marlin/src/sd/cardreader.h Целия файл

@@ -336,9 +336,8 @@ private:
336 336
   static void selectByIndex(SdFile dir, const uint8_t index);
337 337
   static void selectByName(SdFile dir, const char * const match);
338 338
   static void printListing(
339
-    SdFile parent
339
+    SdFile parent, const char * const prepend
340 340
     OPTARG(LONG_FILENAME_HOST_SUPPORT, const bool includeLongNames=false)
341
-    , const char * const prepend=nullptr
342 341
     OPTARG(LONG_FILENAME_HOST_SUPPORT, const char * const prependLong=nullptr)
343 342
   );
344 343
 

Loading…
Отказ
Запис