Browse Source

Merge pull request #4226 from thinkyhead/rc_emergency_command_parser

MarlinSerial emergency-command parser (with M108)
Scott Lahteine 9 years ago
parent
commit
98d0167a57
29 changed files with 294 additions and 56 deletions
  1. 6
    0
      Marlin/Conditionals.h
  2. 6
    0
      Marlin/Configuration_adv.h
  3. 2
    3
      Marlin/Marlin.h
  4. 106
    0
      Marlin/MarlinSerial.cpp
  5. 9
    0
      Marlin/MarlinSerial.h
  6. 49
    41
      Marlin/Marlin_main.cpp
  7. 7
    0
      Marlin/SanityCheck.h
  8. 1
    4
      Marlin/endstops.cpp
  9. 6
    0
      Marlin/example_configurations/Cartesio/Configuration_adv.h
  10. 6
    0
      Marlin/example_configurations/Felix/Configuration_adv.h
  11. 6
    0
      Marlin/example_configurations/Hephestos/Configuration_adv.h
  12. 6
    0
      Marlin/example_configurations/Hephestos_2/Configuration_adv.h
  13. 6
    0
      Marlin/example_configurations/K8200/Configuration_adv.h
  14. 6
    0
      Marlin/example_configurations/K8400/Configuration_adv.h
  15. 6
    0
      Marlin/example_configurations/RigidBot/Configuration_adv.h
  16. 6
    0
      Marlin/example_configurations/SCARA/Configuration_adv.h
  17. 6
    0
      Marlin/example_configurations/TAZ4/Configuration_adv.h
  18. 6
    0
      Marlin/example_configurations/WITBOX/Configuration_adv.h
  19. 6
    0
      Marlin/example_configurations/delta/biv2.5/Configuration_adv.h
  20. 6
    0
      Marlin/example_configurations/delta/generic/Configuration_adv.h
  21. 6
    0
      Marlin/example_configurations/delta/kossel_mini/Configuration_adv.h
  22. 6
    0
      Marlin/example_configurations/delta/kossel_pro/Configuration_adv.h
  23. 6
    0
      Marlin/example_configurations/delta/kossel_xl/Configuration_adv.h
  24. 6
    0
      Marlin/example_configurations/makibox/Configuration_adv.h
  25. 6
    0
      Marlin/example_configurations/tvrrug/Round2/Configuration_adv.h
  26. 1
    1
      Marlin/language.h
  27. 4
    1
      Marlin/temperature.cpp
  28. 1
    4
      Marlin/ultralcd.cpp
  29. 0
    2
      Marlin/ultralcd.h

+ 6
- 0
Marlin/Conditionals.h View File

@@ -284,6 +284,12 @@
284 284
     #define HardwareSerial_h // trick to disable the standard HWserial
285 285
   #endif
286 286
 
287
+  #if ENABLED(EMERGENCY_PARSER)
288
+    #define EMERGENCY_PARSER_CAPABILITIES " EMERGENCY_CODES:M108,M112,M410"
289
+  #else
290
+    #define EMERGENCY_PARSER_CAPABILITIES ""
291
+  #endif
292
+
287 293
   #include "Arduino.h"
288 294
 
289 295
   /**

+ 6
- 0
Marlin/Configuration_adv.h View File

@@ -520,6 +520,12 @@ const unsigned int dropsegments = 5; //everything with less than this number of
520 520
 #define MAX_CMD_SIZE 96
521 521
 #define BUFSIZE 4
522 522
 
523
+// Enable an emergency-command parser to intercept certain commands as they
524
+// enter the serial receive buffer, so they cannot be blocked.
525
+// Currently handles M108, M112, M410
526
+// Does not work on boards using AT90USB (USBCON) processors!
527
+//#define EMERGENCY_PARSER
528
+
523 529
 // Bad Serial-connections can miss a received command by sending an 'ok'
524 530
 // Therefore some clients abort after 30 seconds in a timeout.
525 531
 // Some other clients start sending commands while receiving a 'wait'.

+ 2
- 3
Marlin/Marlin.h View File

@@ -230,9 +230,7 @@ void ok_to_send();
230 230
 void reset_bed_level();
231 231
 void kill(const char*);
232 232
 
233
-#if DISABLED(DELTA) && DISABLED(SCARA)
234
-  void set_current_position_from_planner();
235
-#endif
233
+void quickstop_stepper();
236 234
 
237 235
 #if ENABLED(FILAMENT_RUNOUT_SENSOR)
238 236
   void handle_filament_runout();
@@ -288,6 +286,7 @@ extern float sw_endstop_min[3]; // axis[n].sw_endstop_min
288 286
 extern float sw_endstop_max[3]; // axis[n].sw_endstop_max
289 287
 extern bool axis_known_position[3]; // axis[n].is_known
290 288
 extern bool axis_homed[3]; // axis[n].is_homed
289
+extern volatile bool wait_for_heatup;
291 290
 
292 291
 // GCode support for external objects
293 292
 bool code_seen(char);

+ 106
- 0
Marlin/MarlinSerial.cpp View File

@@ -30,6 +30,7 @@
30 30
 
31 31
 #include "Marlin.h"
32 32
 #include "MarlinSerial.h"
33
+#include "stepper.h"
33 34
 
34 35
 #ifndef USBCON
35 36
 // this next line disables the entire HardwareSerial.cpp,
@@ -54,6 +55,10 @@ FORCE_INLINE void store_char(unsigned char c) {
54 55
       rx_buffer.head = i;
55 56
     }
56 57
   CRITICAL_SECTION_END;
58
+
59
+  #if ENABLED(EMERGENCY_PARSER)
60
+    emergency_parser(c);
61
+  #endif
57 62
 }
58 63
 
59 64
 
@@ -310,3 +315,104 @@ MarlinSerial customizedSerial;
310 315
 #if defined(USBCON) && ENABLED(BLUETOOTH)
311 316
   HardwareSerial bluetoothSerial;
312 317
 #endif
318
+
319
+#if ENABLED(EMERGENCY_PARSER)
320
+
321
+  // Currently looking for: M108, M112, M410
322
+  // If you alter the parser please don't forget to update the capabilities in Conditionals.h
323
+
324
+  void emergency_parser(unsigned char c) {
325
+
326
+    enum e_parser_state {
327
+      state_RESET,
328
+      state_N,
329
+      state_M,
330
+      state_M1,
331
+      state_M10,
332
+      state_M108,
333
+      state_M11,
334
+      state_M112,
335
+      state_M4,
336
+      state_M41,
337
+      state_M410,
338
+      state_IGNORE // to '\n'
339
+    };
340
+
341
+    static e_parser_state state = state_RESET;
342
+
343
+    switch (state) {
344
+      case state_RESET:
345
+        switch (c) {
346
+          case ' ': break;
347
+          case 'N': state = state_N;      break;
348
+          case 'M': state = state_M;      break;
349
+          default: state = state_IGNORE;
350
+        }
351
+        break;
352
+
353
+      case state_N:
354
+        switch (c) {
355
+          case '0': case '1': case '2':
356
+          case '3': case '4': case '5':
357
+          case '6': case '7': case '8':
358
+          case '9': case '-': case ' ':   break;
359
+          case 'M': state = state_M;      break;
360
+          default:  state = state_IGNORE;
361
+        }
362
+        break;
363
+
364
+      case state_M:
365
+        switch (c) {
366
+          case ' ': break;
367
+          case '1': state = state_M1;     break;
368
+          case '4': state = state_M4;     break;
369
+          default: state = state_IGNORE;
370
+        }
371
+        break;
372
+
373
+      case state_M1:
374
+        switch (c) {
375
+          case '0': state = state_M10;    break;
376
+          case '1': state = state_M11;    break;
377
+          default: state = state_IGNORE;
378
+        }
379
+        break;
380
+
381
+      case state_M10:
382
+        state = (c == '8') ? state_M108 : state_IGNORE;
383
+        break;
384
+
385
+      case state_M11:
386
+        state = (c == '2') ? state_M112 : state_IGNORE;
387
+        break;
388
+
389
+      case state_M4:
390
+        state = (c == '1') ? state_M41 : state_IGNORE;
391
+        break;
392
+
393
+      case state_M41:
394
+        state = (c == '0') ? state_M410 : state_IGNORE;
395
+        break;
396
+
397
+      case state_IGNORE:
398
+        if (c == '\n') state = state_RESET;
399
+        break;
400
+
401
+      default:
402
+        if (c == '\n') {
403
+          switch (state) {
404
+            case state_M108:
405
+              wait_for_heatup = false;
406
+              break;
407
+            case state_M112:
408
+              kill(PSTR(MSG_KILLED));
409
+              break;
410
+            case state_M410:
411
+              quickstop_stepper();
412
+              break;
413
+          }
414
+          state = state_RESET;
415
+        }
416
+    }
417
+  }
418
+#endif

+ 9
- 0
Marlin/MarlinSerial.h View File

@@ -101,6 +101,11 @@ struct ring_buffer {
101 101
   extern ring_buffer rx_buffer;
102 102
 #endif
103 103
 
104
+#if ENABLED(EMERGENCY_PARSER)
105
+  #include "language.h"
106
+  void emergency_parser(unsigned char c);
107
+#endif
108
+
104 109
 class MarlinSerial { //: public Stream
105 110
 
106 111
   public:
@@ -141,6 +146,10 @@ class MarlinSerial { //: public Stream
141 146
             rx_buffer.head = i;
142 147
           }
143 148
         CRITICAL_SECTION_END;
149
+
150
+        #if ENABLED(EMERGENCY_PARSER)
151
+          emergency_parser(c);
152
+        #endif
144 153
       }
145 154
     }
146 155
 

+ 49
- 41
Marlin/Marlin_main.cpp View File

@@ -160,7 +160,7 @@
160 160
  * M105 - Read current temp
161 161
  * M106 - Fan on
162 162
  * M107 - Fan off
163
- * M108 - Cancel heatup and wait for the hotend and bed, this G-code is asynchronously handled in the get_serial_commands() parser
163
+ * M108 - Stop the waiting for heaters in M109, M190, M303. Does not affect the target temperature.
164 164
  * M109 - Sxxx Wait for extruder current temp to reach target temp. Waits only when heating
165 165
  *        Rxxx Wait for extruder current temp to reach target temp. Waits when heating and cooling
166 166
  *        IF AUTOTEMP is enabled, S<mintemp> B<maxtemp> F<factor>. Exit autotemp by any M109 without F
@@ -332,7 +332,7 @@ uint8_t active_extruder = 0;
332 332
 // Relative Mode. Enable with G91, disable with G90.
333 333
 static bool relative_mode = false;
334 334
 
335
-bool wait_for_heatup = true;
335
+volatile bool wait_for_heatup = true;
336 336
 
337 337
 const char errormagic[] PROGMEM = "Error:";
338 338
 const char echomagic[] PROGMEM = "echo:";
@@ -1105,9 +1105,12 @@ inline void get_serial_commands() {
1105 1105
         }
1106 1106
       }
1107 1107
 
1108
-      // If command was e-stop process now
1109
-      if (strcmp(command, "M112") == 0) kill(PSTR(MSG_KILLED));
1110
-      if (strcmp(command, "M108") == 0) wait_for_heatup = false;
1108
+      #if DISABLED(EMERGENCY_PARSER)
1109
+        // If command was e-stop process now
1110
+        if (strcmp(command, "M108") == 0) wait_for_heatup = false;
1111
+        if (strcmp(command, "M112") == 0) kill(PSTR(MSG_KILLED));
1112
+        if (strcmp(command, "M410") == 0) { quickstop_stepper(); }
1113
+      #endif
1111 1114
 
1112 1115
       #if defined(NO_TIMEOUTS) && NO_TIMEOUTS > 0
1113 1116
         last_command_time = ms;
@@ -4535,10 +4538,29 @@ inline void gcode_M105() {
4535 4538
 
4536 4539
 #endif // FAN_COUNT > 0
4537 4540
 
4538
-/**
4539
- * M108: Cancel heatup and wait for the hotend and bed, this G-code is asynchronously handled in the get_serial_commands() parser
4540
- */
4541
-inline void gcode_M108() { wait_for_heatup = false; }
4541
+#if DISABLED(EMERGENCY_PARSER)
4542
+
4543
+  /**
4544
+   * M108: Stop the waiting for heaters in M109, M190, M303. Does not affect the target temperature.
4545
+   */
4546
+  inline void gcode_M108() { wait_for_heatup = false; }
4547
+
4548
+
4549
+  /**
4550
+   * M112: Emergency Stop
4551
+   */
4552
+  inline void gcode_M112() { kill(PSTR(MSG_KILLED)); }
4553
+
4554
+
4555
+  /**
4556
+   * M410: Quickstop - Abort all planned moves
4557
+   *
4558
+   * This will stop the carriages mid-move, so most likely they
4559
+   * will be out of sync with the stepper position after this.
4560
+   */
4561
+  inline void gcode_M410() { quickstop_stepper(); }
4562
+
4563
+#endif
4542 4564
 
4543 4565
 /**
4544 4566
  * M109: Sxxx Wait for extruder(s) to reach temperature. Waits only when heating.
@@ -4810,11 +4832,6 @@ inline void gcode_M111() {
4810 4832
   SERIAL_EOL;
4811 4833
 }
4812 4834
 
4813
-/**
4814
- * M112: Emergency Stop
4815
- */
4816
-inline void gcode_M112() { kill(PSTR(MSG_KILLED)); }
4817
-
4818 4835
 #if ENABLED(HOST_KEEPALIVE_FEATURE)
4819 4836
 
4820 4837
   /**
@@ -5970,8 +5987,9 @@ inline void gcode_M400() { stepper.synchronize(); }
5970 5987
 
5971 5988
 #endif // FILAMENT_WIDTH_SENSOR
5972 5989
 
5973
-#if DISABLED(DELTA) && DISABLED(SCARA)
5974
-  void set_current_position_from_planner() {
5990
+void quickstop_stepper() {
5991
+  stepper.quick_stop();
5992
+  #if DISABLED(DELTA) && DISABLED(SCARA)
5975 5993
     stepper.synchronize();
5976 5994
     #if ENABLED(AUTO_BED_LEVELING_FEATURE)
5977 5995
       vector_3 pos = planner.adjusted_position(); // values directly from steppers...
@@ -5984,23 +6002,9 @@ inline void gcode_M400() { stepper.synchronize(); }
5984 6002
       current_position[Z_AXIS] = stepper.get_axis_position_mm(Z_AXIS);
5985 6003
     #endif
5986 6004
     sync_plan_position();                       // ...re-apply to planner position
5987
-  }
5988
-#endif
5989
-
5990
-/**
5991
- * M410: Quickstop - Abort all planned moves
5992
- *
5993
- * This will stop the carriages mid-move, so most likely they
5994
- * will be out of sync with the stepper position after this.
5995
- */
5996
-inline void gcode_M410() {
5997
-  stepper.quick_stop();
5998
-  #if DISABLED(DELTA) && DISABLED(SCARA)
5999
-    set_current_position_from_planner();
6000 6005
   #endif
6001 6006
 }
6002 6007
 
6003
-
6004 6008
 #if ENABLED(MESH_BED_LEVELING)
6005 6009
 
6006 6010
   /**
@@ -6955,9 +6959,21 @@ void process_next_command() {
6955 6959
         gcode_M111();
6956 6960
         break;
6957 6961
 
6958
-      case 112: // M112: Emergency Stop
6959
-        gcode_M112();
6960
-        break;
6962
+      #if DISABLED(EMERGENCY_PARSER)
6963
+
6964
+        case 108: // M108: Cancel Waiting
6965
+          gcode_M108();
6966
+          break;
6967
+
6968
+        case 112: // M112: Emergency Stop
6969
+          gcode_M112();
6970
+          break;
6971
+
6972
+        case 410: // M410 quickstop - Abort all the planned moves.
6973
+          gcode_M410();
6974
+          break;
6975
+
6976
+      #endif
6961 6977
 
6962 6978
       #if ENABLED(HOST_KEEPALIVE_FEATURE)
6963 6979
 
@@ -6976,10 +6992,6 @@ void process_next_command() {
6976 6992
         KEEPALIVE_STATE(NOT_BUSY);
6977 6993
         return; // "ok" already printed
6978 6994
 
6979
-      case 108:
6980
-        gcode_M108();
6981
-        break;
6982
-
6983 6995
       case 109: // M109: Wait for temperature
6984 6996
         gcode_M109();
6985 6997
         break;
@@ -7263,10 +7275,6 @@ void process_next_command() {
7263 7275
           break;
7264 7276
       #endif // ENABLED(FILAMENT_WIDTH_SENSOR)
7265 7277
 
7266
-      case 410: // M410 quickstop - Abort all the planned moves.
7267
-        gcode_M410();
7268
-        break;
7269
-
7270 7278
       #if ENABLED(MESH_BED_LEVELING)
7271 7279
         case 420: // M420 Enable/Disable Mesh Bed Leveling
7272 7280
           gcode_M420();

+ 7
- 0
Marlin/SanityCheck.h View File

@@ -579,6 +579,13 @@
579 579
 #endif
580 580
 
581 581
 /**
582
+ * emergency-command parser
583
+ */
584
+#if ENABLED(EMERGENCY_PARSER) && ENABLED(USBCON)
585
+  #error "EMERGENCY_PARSER does not work on boards with AT90USB processors (USBCON)."
586
+#endif
587
+
588
+ /**
582 589
  * Warnings for old configurations
583 590
  */
584 591
 #if WATCH_TEMP_PERIOD > 500

+ 1
- 4
Marlin/endstops.cpp View File

@@ -186,10 +186,7 @@ void Endstops::report_state() {
186 186
       if (stepper.abort_on_endstop_hit) {
187 187
         card.sdprinting = false;
188 188
         card.closefile();
189
-        stepper.quick_stop();
190
-        #if DISABLED(DELTA) && DISABLED(SCARA)
191
-          set_current_position_from_planner();
192
-        #endif
189
+        quickstop_stepper();
193 190
         thermalManager.disable_all_heaters(); // switch off all heaters.
194 191
       }
195 192
     #endif

+ 6
- 0
Marlin/example_configurations/Cartesio/Configuration_adv.h View File

@@ -520,6 +520,12 @@ const unsigned int dropsegments = 5; //everything with less than this number of
520 520
 #define MAX_CMD_SIZE 96
521 521
 #define BUFSIZE 4
522 522
 
523
+// Enable an emergency-command parser to intercept certain commands as they
524
+// enter the serial receive buffer, so they cannot be blocked.
525
+// Currently handles M108, M112, M410
526
+// Does not work on boards using AT90USB (USBCON) processors!
527
+//#define EMERGENCY_PARSER
528
+
523 529
 // Bad Serial-connections can miss a received command by sending an 'ok'
524 530
 // Therefore some clients abort after 30 seconds in a timeout.
525 531
 // Some other clients start sending commands while receiving a 'wait'.

+ 6
- 0
Marlin/example_configurations/Felix/Configuration_adv.h View File

@@ -520,6 +520,12 @@ const unsigned int dropsegments = 5; //everything with less than this number of
520 520
 #define MAX_CMD_SIZE 96
521 521
 #define BUFSIZE 4
522 522
 
523
+// Enable an emergency-command parser to intercept certain commands as they
524
+// enter the serial receive buffer, so they cannot be blocked.
525
+// Currently handles M108, M112, M410
526
+// Does not work on boards using AT90USB (USBCON) processors!
527
+//#define EMERGENCY_PARSER
528
+
523 529
 // Bad Serial-connections can miss a received command by sending an 'ok'
524 530
 // Therefore some clients abort after 30 seconds in a timeout.
525 531
 // Some other clients start sending commands while receiving a 'wait'.

+ 6
- 0
Marlin/example_configurations/Hephestos/Configuration_adv.h View File

@@ -520,6 +520,12 @@ const unsigned int dropsegments = 5; //everything with less than this number of
520 520
 #define MAX_CMD_SIZE 96
521 521
 #define BUFSIZE 4
522 522
 
523
+// Enable an emergency-command parser to intercept certain commands as they
524
+// enter the serial receive buffer, so they cannot be blocked.
525
+// Currently handles M108, M112, M410
526
+// Does not work on boards using AT90USB (USBCON) processors!
527
+//#define EMERGENCY_PARSER
528
+
523 529
 // Bad Serial-connections can miss a received command by sending an 'ok'
524 530
 // Therefore some clients abort after 30 seconds in a timeout.
525 531
 // Some other clients start sending commands while receiving a 'wait'.

+ 6
- 0
Marlin/example_configurations/Hephestos_2/Configuration_adv.h View File

@@ -520,6 +520,12 @@ const unsigned int dropsegments = 5; //everything with less than this number of
520 520
 #define MAX_CMD_SIZE 96
521 521
 #define BUFSIZE 4
522 522
 
523
+// Enable an emergency-command parser to intercept certain commands as they
524
+// enter the serial receive buffer, so they cannot be blocked.
525
+// Currently handles M108, M112, M410
526
+// Does not work on boards using AT90USB (USBCON) processors!
527
+//#define EMERGENCY_PARSER
528
+
523 529
 // Bad Serial-connections can miss a received command by sending an 'ok'
524 530
 // Therefore some clients abort after 30 seconds in a timeout.
525 531
 // Some other clients start sending commands while receiving a 'wait'.

+ 6
- 0
Marlin/example_configurations/K8200/Configuration_adv.h View File

@@ -526,6 +526,12 @@ const unsigned int dropsegments = 2; //everything with less than this number of
526 526
 #define MAX_CMD_SIZE 96
527 527
 #define BUFSIZE 4
528 528
 
529
+// Enable an emergency-command parser to intercept certain commands as they
530
+// enter the serial receive buffer, so they cannot be blocked.
531
+// Currently handles M108, M112, M410
532
+// Does not work on boards using AT90USB (USBCON) processors!
533
+//#define EMERGENCY_PARSER
534
+
529 535
 // Bad Serial-connections can miss a received command by sending an 'ok'
530 536
 // Therefore some clients abort after 30 seconds in a timeout.
531 537
 // Some other clients start sending commands while receiving a 'wait'.

+ 6
- 0
Marlin/example_configurations/K8400/Configuration_adv.h View File

@@ -520,6 +520,12 @@ const unsigned int dropsegments = 5; //everything with less than this number of
520 520
 #define MAX_CMD_SIZE 96
521 521
 #define BUFSIZE 26
522 522
 
523
+// Enable an emergency-command parser to intercept certain commands as they
524
+// enter the serial receive buffer, so they cannot be blocked.
525
+// Currently handles M108, M112, M410
526
+// Does not work on boards using AT90USB (USBCON) processors!
527
+//#define EMERGENCY_PARSER
528
+
523 529
 // Bad Serial-connections can miss a received command by sending an 'ok'
524 530
 // Therefore some clients abort after 30 seconds in a timeout.
525 531
 // Some other clients start sending commands while receiving a 'wait'.

+ 6
- 0
Marlin/example_configurations/RigidBot/Configuration_adv.h View File

@@ -520,6 +520,12 @@ const unsigned int dropsegments = 5; //everything with less than this number of
520 520
 #define MAX_CMD_SIZE 96
521 521
 #define BUFSIZE 8
522 522
 
523
+// Enable an emergency-command parser to intercept certain commands as they
524
+// enter the serial receive buffer, so they cannot be blocked.
525
+// Currently handles M108, M112, M410
526
+// Does not work on boards using AT90USB (USBCON) processors!
527
+//#define EMERGENCY_PARSER
528
+
523 529
 // Bad Serial-connections can miss a received command by sending an 'ok'
524 530
 // Therefore some clients abort after 30 seconds in a timeout.
525 531
 // Some other clients start sending commands while receiving a 'wait'.

+ 6
- 0
Marlin/example_configurations/SCARA/Configuration_adv.h View File

@@ -520,6 +520,12 @@ const unsigned int dropsegments = 5; //everything with less than this number of
520 520
 #define MAX_CMD_SIZE 96
521 521
 #define BUFSIZE 4
522 522
 
523
+// Enable an emergency-command parser to intercept certain commands as they
524
+// enter the serial receive buffer, so they cannot be blocked.
525
+// Currently handles M108, M112, M410
526
+// Does not work on boards using AT90USB (USBCON) processors!
527
+//#define EMERGENCY_PARSER
528
+
523 529
 // Bad Serial-connections can miss a received command by sending an 'ok'
524 530
 // Therefore some clients abort after 30 seconds in a timeout.
525 531
 // Some other clients start sending commands while receiving a 'wait'.

+ 6
- 0
Marlin/example_configurations/TAZ4/Configuration_adv.h View File

@@ -528,6 +528,12 @@ const unsigned int dropsegments = 5; //everything with less than this number of
528 528
 #define MAX_CMD_SIZE 96
529 529
 #define BUFSIZE 4
530 530
 
531
+// Enable an emergency-command parser to intercept certain commands as they
532
+// enter the serial receive buffer, so they cannot be blocked.
533
+// Currently handles M108, M112, M410
534
+// Does not work on boards using AT90USB (USBCON) processors!
535
+//#define EMERGENCY_PARSER
536
+
531 537
 // Bad Serial-connections can miss a received command by sending an 'ok'
532 538
 // Therefore some clients abort after 30 seconds in a timeout.
533 539
 // Some other clients start sending commands while receiving a 'wait'.

+ 6
- 0
Marlin/example_configurations/WITBOX/Configuration_adv.h View File

@@ -520,6 +520,12 @@ const unsigned int dropsegments = 5; //everything with less than this number of
520 520
 #define MAX_CMD_SIZE 96
521 521
 #define BUFSIZE 4
522 522
 
523
+// Enable an emergency-command parser to intercept certain commands as they
524
+// enter the serial receive buffer, so they cannot be blocked.
525
+// Currently handles M108, M112, M410
526
+// Does not work on boards using AT90USB (USBCON) processors!
527
+//#define EMERGENCY_PARSER
528
+
523 529
 // Bad Serial-connections can miss a received command by sending an 'ok'
524 530
 // Therefore some clients abort after 30 seconds in a timeout.
525 531
 // Some other clients start sending commands while receiving a 'wait'.

+ 6
- 0
Marlin/example_configurations/delta/biv2.5/Configuration_adv.h View File

@@ -522,6 +522,12 @@ const unsigned int dropsegments = 5; //everything with less than this number of
522 522
 #define MAX_CMD_SIZE 96
523 523
 #define BUFSIZE 4
524 524
 
525
+// Enable an emergency-command parser to intercept certain commands as they
526
+// enter the serial receive buffer, so they cannot be blocked.
527
+// Currently handles M108, M112, M410
528
+// Does not work on boards using AT90USB (USBCON) processors!
529
+//#define EMERGENCY_PARSER
530
+
525 531
 // Bad Serial-connections can miss a received command by sending an 'ok'
526 532
 // Therefore some clients abort after 30 seconds in a timeout.
527 533
 // Some other clients start sending commands while receiving a 'wait'.

+ 6
- 0
Marlin/example_configurations/delta/generic/Configuration_adv.h View File

@@ -522,6 +522,12 @@ const unsigned int dropsegments = 5; //everything with less than this number of
522 522
 #define MAX_CMD_SIZE 96
523 523
 #define BUFSIZE 4
524 524
 
525
+// Enable an emergency-command parser to intercept certain commands as they
526
+// enter the serial receive buffer, so they cannot be blocked.
527
+// Currently handles M108, M112, M410
528
+// Does not work on boards using AT90USB (USBCON) processors!
529
+//#define EMERGENCY_PARSER
530
+
525 531
 // Bad Serial-connections can miss a received command by sending an 'ok'
526 532
 // Therefore some clients abort after 30 seconds in a timeout.
527 533
 // Some other clients start sending commands while receiving a 'wait'.

+ 6
- 0
Marlin/example_configurations/delta/kossel_mini/Configuration_adv.h View File

@@ -521,6 +521,12 @@ const unsigned int dropsegments = 5; //everything with less than this number of
521 521
 #define MAX_CMD_SIZE 96
522 522
 #define BUFSIZE 4
523 523
 
524
+// Enable an emergency-command parser to intercept certain commands as they
525
+// enter the serial receive buffer, so they cannot be blocked.
526
+// Currently handles M108, M112, M410
527
+// Does not work on boards using AT90USB (USBCON) processors!
528
+//#define EMERGENCY_PARSER
529
+
524 530
 // Bad Serial-connections can miss a received command by sending an 'ok'
525 531
 // Therefore some clients abort after 30 seconds in a timeout.
526 532
 // Some other clients start sending commands while receiving a 'wait'.

+ 6
- 0
Marlin/example_configurations/delta/kossel_pro/Configuration_adv.h View File

@@ -526,6 +526,12 @@ const unsigned int dropsegments = 5; //everything with less than this number of
526 526
 #define MAX_CMD_SIZE 96
527 527
 #define BUFSIZE 4
528 528
 
529
+// Enable an emergency-command parser to intercept certain commands as they
530
+// enter the serial receive buffer, so they cannot be blocked.
531
+// Currently handles M108, M112, M410
532
+// Does not work on boards using AT90USB (USBCON) processors!
533
+//#define EMERGENCY_PARSER
534
+
529 535
 // Bad Serial-connections can miss a received command by sending an 'ok'
530 536
 // Therefore some clients abort after 30 seconds in a timeout.
531 537
 // Some other clients start sending commands while receiving a 'wait'.

+ 6
- 0
Marlin/example_configurations/delta/kossel_xl/Configuration_adv.h View File

@@ -522,6 +522,12 @@ const unsigned int dropsegments = 5; //everything with less than this number of
522 522
 #define MAX_CMD_SIZE 96
523 523
 #define BUFSIZE 4
524 524
 
525
+// Enable an emergency-command parser to intercept certain commands as they
526
+// enter the serial receive buffer, so they cannot be blocked.
527
+// Currently handles M108, M112, M410
528
+// Does not work on boards using AT90USB (USBCON) processors!
529
+//#define EMERGENCY_PARSER
530
+
525 531
 // Bad Serial-connections can miss a received command by sending an 'ok'
526 532
 // Therefore some clients abort after 30 seconds in a timeout.
527 533
 // Some other clients start sending commands while receiving a 'wait'.

+ 6
- 0
Marlin/example_configurations/makibox/Configuration_adv.h View File

@@ -520,6 +520,12 @@ const unsigned int dropsegments = 5; //everything with less than this number of
520 520
 #define MAX_CMD_SIZE 96
521 521
 #define BUFSIZE 4
522 522
 
523
+// Enable an emergency-command parser to intercept certain commands as they
524
+// enter the serial receive buffer, so they cannot be blocked.
525
+// Currently handles M108, M112, M410
526
+// Does not work on boards using AT90USB (USBCON) processors!
527
+//#define EMERGENCY_PARSER
528
+
523 529
 // Bad Serial-connections can miss a received command by sending an 'ok'
524 530
 // Therefore some clients abort after 30 seconds in a timeout.
525 531
 // Some other clients start sending commands while receiving a 'wait'.

+ 6
- 0
Marlin/example_configurations/tvrrug/Round2/Configuration_adv.h View File

@@ -520,6 +520,12 @@ const unsigned int dropsegments = 5; //everything with less than this number of
520 520
 #define MAX_CMD_SIZE 96
521 521
 #define BUFSIZE 4
522 522
 
523
+// Enable an emergency-command parser to intercept certain commands as they
524
+// enter the serial receive buffer, so they cannot be blocked.
525
+// Currently handles M108, M112, M410
526
+// Does not work on boards using AT90USB (USBCON) processors!
527
+//#define EMERGENCY_PARSER
528
+
523 529
 // Bad Serial-connections can miss a received command by sending an 'ok'
524 530
 // Therefore some clients abort after 30 seconds in a timeout.
525 531
 // Some other clients start sending commands while receiving a 'wait'.

+ 1
- 1
Marlin/language.h View File

@@ -128,7 +128,7 @@
128 128
 #define MSG_INVALID_EXTRUDER                "Invalid extruder"
129 129
 #define MSG_INVALID_SOLENOID                "Invalid solenoid"
130 130
 #define MSG_ERR_NO_THERMISTORS              "No thermistors - no temperature"
131
-#define MSG_M115_REPORT                     "FIRMWARE_NAME:Marlin " DETAILED_BUILD_VERSION " SOURCE_CODE_URL:" SOURCE_CODE_URL " PROTOCOL_VERSION:" PROTOCOL_VERSION " MACHINE_TYPE:" MACHINE_NAME " EXTRUDER_COUNT:" STRINGIFY(EXTRUDERS) " UUID:" MACHINE_UUID "\n"
131
+#define MSG_M115_REPORT                     "FIRMWARE_NAME:Marlin " DETAILED_BUILD_VERSION " SOURCE_CODE_URL:" SOURCE_CODE_URL " PROTOCOL_VERSION:" PROTOCOL_VERSION " MACHINE_TYPE:" MACHINE_NAME " EXTRUDER_COUNT:" STRINGIFY(EXTRUDERS) " UUID:" MACHINE_UUID EMERGENCY_PARSER_CAPABILITIES "\n"
132 132
 #define MSG_COUNT_X                         " Count X: "
133 133
 #define MSG_COUNT_A                         " Count A: "
134 134
 #define MSG_ERR_KILLED                      "Printer halted. kill() called!"

+ 4
- 1
Marlin/temperature.cpp View File

@@ -238,8 +238,10 @@ unsigned char Temperature::soft_pwm[HOTENDS];
238 238
       soft_pwm_bed = bias = d = (MAX_BED_POWER) / 2;
239 239
     #endif
240 240
 
241
+    wait_for_heatup = true;
242
+
241 243
     // PID Tuning loop
242
-    for (;;) {
244
+    while (wait_for_heatup) {
243 245
 
244 246
       millis_t ms = millis();
245 247
 
@@ -421,6 +423,7 @@ unsigned char Temperature::soft_pwm[HOTENDS];
421 423
       }
422 424
       lcd_update();
423 425
     }
426
+    if (!wait_for_heatup) disable_all_heaters();
424 427
   }
425 428
 
426 429
 #endif // HAS_PID_HEATING

+ 1
- 4
Marlin/ultralcd.cpp View File

@@ -556,14 +556,11 @@ static void lcd_status_screen() {
556 556
     static void lcd_sdcard_stop() {
557 557
       card.stopSDPrint();
558 558
       clear_command_queue();
559
-      stepper.quick_stop();
559
+      quickstop_stepper();
560 560
       print_job_timer.stop();
561 561
       thermalManager.autotempShutdown();
562 562
       wait_for_heatup = false;
563 563
       lcd_setstatus(MSG_PRINT_ABORTED, true);
564
-      #if DISABLED(DELTA) && DISABLED(SCARA)
565
-        set_current_position_from_planner();
566
-      #endif // !DELTA && !SCARA
567 564
     }
568 565
 
569 566
   #endif //SDSUPPORT

+ 0
- 2
Marlin/ultralcd.h View File

@@ -95,8 +95,6 @@
95 95
   extern int absPreheatHPBTemp;
96 96
   extern int absPreheatFanSpeed;
97 97
 
98
-  extern bool wait_for_heatup;
99
-
100 98
   #if ENABLED(FILAMENT_LCD_DISPLAY)
101 99
     extern millis_t previous_lcd_status_ms;
102 100
   #endif

Loading…
Cancel
Save