Browse Source

Misc. code cleanup

Scott Lahteine 4 years ago
parent
commit
206d495ba4

+ 2
- 2
Marlin/src/MarlinCore.cpp View File

390
   }
390
   }
391
 
391
 
392
   inline void finishSDPrinting() {
392
   inline void finishSDPrinting() {
393
-    if (queue.enqueue_one_P(PSTR("M1001"))) {
394
-      marlin_state = MF_RUNNING;
393
+    if (queue.enqueue_one_P(PSTR("M1001"))) { // Keep trying until it gets queued
394
+      marlin_state = MF_RUNNING;              // Signal to stop trying
395
       TERN_(PASSWORD_AFTER_SD_PRINT_END, password.lock_machine());
395
       TERN_(PASSWORD_AFTER_SD_PRINT_END, password.lock_machine());
396
       TERN_(DGUS_LCD_UI_MKS, ScreenHandler.SDPrintingFinished());
396
       TERN_(DGUS_LCD_UI_MKS, ScreenHandler.SDPrintingFinished());
397
     }
397
     }

+ 3
- 7
Marlin/src/gcode/queue.cpp View File

501
           char* gpos = strchr(command, 'G');
501
           char* gpos = strchr(command, 'G');
502
           if (gpos) {
502
           if (gpos) {
503
             switch (strtol(gpos + 1, nullptr, 10)) {
503
             switch (strtol(gpos + 1, nullptr, 10)) {
504
-              case 0: case 1:
505
-              #if ENABLED(ARC_SUPPORT)
506
-                case 2: case 3:
507
-              #endif
508
-              #if ENABLED(BEZIER_CURVE_SUPPORT)
509
-                case 5:
510
-              #endif
504
+              case 0 ... 1:
505
+              TERN_(ARC_SUPPORT, case 2 ... 3:)
506
+              TERN_(BEZIER_CURVE_SUPPORT, case 5:)
511
                 PORT_REDIRECT(SERIAL_PORTMASK(p));     // Reply to the serial port that sent the command
507
                 PORT_REDIRECT(SERIAL_PORTMASK(p));     // Reply to the serial port that sent the command
512
                 SERIAL_ECHOLNPGM(STR_ERR_STOPPED);
508
                 SERIAL_ECHOLNPGM(STR_ERR_STOPPED);
513
                 LCD_MESSAGEPGM(MSG_STOPPED);
509
                 LCD_MESSAGEPGM(MSG_STOPPED);

+ 2
- 2
Marlin/src/lcd/extui/dgus/mks/DGUSScreenHandler.cpp View File

1477
 
1477
 
1478
 void DGUSScreenHandler::DGUS_RunoutInit(void) {
1478
 void DGUSScreenHandler::DGUS_RunoutInit(void) {
1479
   #if PIN_EXISTS(MT_DET_1)
1479
   #if PIN_EXISTS(MT_DET_1)
1480
-    pinMode(MT_DET_1_PIN, INPUT_PULLUP);
1480
+    SET_INPUT_PULLUP(MT_DET_1_PIN);
1481
   #endif
1481
   #endif
1482
   runout_mks.de_count      = 0;
1482
   runout_mks.de_count      = 0;
1483
   runout_mks.de_times      = 10;
1483
   runout_mks.de_times      = 10;
1496
         GotoScreen(MKSLCD_SCREEN_PAUSE);
1496
         GotoScreen(MKSLCD_SCREEN_PAUSE);
1497
 
1497
 
1498
         sendinfoscreen(PSTR("NOTICE"), nullptr, PSTR("Please change filament!"), nullptr, true, true, true, true);
1498
         sendinfoscreen(PSTR("NOTICE"), nullptr, PSTR("Please change filament!"), nullptr, true, true, true, true);
1499
-        // SetupConfirmAction(nullptr);
1499
+        //SetupConfirmAction(nullptr);
1500
         GotoScreen(DGUSLCD_SCREEN_POPUP);
1500
         GotoScreen(DGUSLCD_SCREEN_POPUP);
1501
         break;
1501
         break;
1502
 
1502
 

+ 1
- 3
Marlin/src/lcd/extui/mks_ui/draw_ui.cpp View File

645
         gcode_preview_over = false;
645
         gcode_preview_over = false;
646
 
646
 
647
         card.closefile();
647
         card.closefile();
648
-        char *cur_name;
649
-
650
-        cur_name = strrchr(list_file.file_name[sel_id], '/');
648
+        char *cur_name = strrchr(list_file.file_name[sel_id], '/');
651
 
649
 
652
         SdFile file;
650
         SdFile file;
653
         SdFile *curDir;
651
         SdFile *curDir;

+ 4
- 8
Marlin/src/lcd/extui/mks_ui/wifi_module.cpp View File

1789
         char* command = wifi_line_buffer;
1789
         char* command = wifi_line_buffer;
1790
         while (*command == ' ') command++; // skip any leading spaces
1790
         while (*command == ' ') command++; // skip any leading spaces
1791
 
1791
 
1792
-          // Movement commands alert when stopped
1793
-          if (IsStopped()) {
1792
+        // Movement commands alert when stopped
1793
+        if (IsStopped()) {
1794
           char* gpos = strchr(command, 'G');
1794
           char* gpos = strchr(command, 'G');
1795
           if (gpos) {
1795
           if (gpos) {
1796
             switch (strtol(gpos + 1, nullptr, 10)) {
1796
             switch (strtol(gpos + 1, nullptr, 10)) {
1797
               case 0 ... 1:
1797
               case 0 ... 1:
1798
-              #if ENABLED(ARC_SUPPORT)
1799
-                case 2 ... 3:
1800
-              #endif
1801
-              #if ENABLED(BEZIER_CURVE_SUPPORT)
1802
-                case 5:
1803
-              #endif
1798
+              TERN_(ARC_SUPPORT, case 2 ... 3:)
1799
+              TERN_(BEZIER_CURVE_SUPPORT, case 5:)
1804
                 SERIAL_ECHOLNPGM(STR_ERR_STOPPED);
1800
                 SERIAL_ECHOLNPGM(STR_ERR_STOPPED);
1805
                 LCD_MESSAGEPGM(MSG_STOPPED);
1801
                 LCD_MESSAGEPGM(MSG_STOPPED);
1806
                 break;
1802
                 break;

Loading…
Cancel
Save