Browse Source

Add an emergency-command parser to MarlinSerial (supporting M108)

Add an emergency-command parser to MarlinSerial's RX interrupt.

The parser tries to find and execute M108,M112,M410 before the commands disappear in the RX-buffer.

To avoid false positives for M117, comments and commands followed by filenames (M23, M28, M30, M32, M33) are filtered.

This enables Marlin to receive and react on the Emergency command at all times - regardless of whether the buffers are full or not. It remains to convince hosts to send the commands. To inform the hosts about the new feature a new entry in the M115-report was made. "`EMERGENCY_CODES:M112,M108,M410;`".

The parser is fast. It only ever needs two switch decisions and one assignment of the new state for every character.

One problem remains. If the host has sent an incomplete line before sending an emergency command the emergency command could be omitted when the parser is in `state_IGNORE`.
In that case the host should send "\ncommand\n"

Also introduces M108 to break the waiting for the heaters in M109, M190 and M303.

Rename `cancel_heatup` to `wait_for_heatup` to better see the purpose.
AnHardt 9 years ago
parent
commit
a129078927

+ 6
- 0
Marlin/Conditionals.h View File

284
     #define HardwareSerial_h // trick to disable the standard HWserial
284
     #define HardwareSerial_h // trick to disable the standard HWserial
285
   #endif
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
   #include "Arduino.h"
293
   #include "Arduino.h"
288
 
294
 
289
   /**
295
   /**

+ 6
- 0
Marlin/Configuration_adv.h View File

520
 #define MAX_CMD_SIZE 96
520
 #define MAX_CMD_SIZE 96
521
 #define BUFSIZE 4
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
 // Bad Serial-connections can miss a received command by sending an 'ok'
529
 // Bad Serial-connections can miss a received command by sending an 'ok'
524
 // Therefore some clients abort after 30 seconds in a timeout.
530
 // Therefore some clients abort after 30 seconds in a timeout.
525
 // Some other clients start sending commands while receiving a 'wait'.
531
 // Some other clients start sending commands while receiving a 'wait'.

+ 1
- 0
Marlin/Marlin.h View File

288
 extern float sw_endstop_max[3]; // axis[n].sw_endstop_max
288
 extern float sw_endstop_max[3]; // axis[n].sw_endstop_max
289
 extern bool axis_known_position[3]; // axis[n].is_known
289
 extern bool axis_known_position[3]; // axis[n].is_known
290
 extern bool axis_homed[3]; // axis[n].is_homed
290
 extern bool axis_homed[3]; // axis[n].is_homed
291
+extern bool wait_for_heatup;
291
 
292
 
292
 // GCode support for external objects
293
 // GCode support for external objects
293
 bool code_seen(char);
294
 bool code_seen(char);

+ 158
- 0
Marlin/MarlinSerial.cpp View File

30
 
30
 
31
 #include "Marlin.h"
31
 #include "Marlin.h"
32
 #include "MarlinSerial.h"
32
 #include "MarlinSerial.h"
33
+#include "stepper.h"
33
 
34
 
34
 #ifndef USBCON
35
 #ifndef USBCON
35
 // this next line disables the entire HardwareSerial.cpp,
36
 // this next line disables the entire HardwareSerial.cpp,
54
       rx_buffer.head = i;
55
       rx_buffer.head = i;
55
     }
56
     }
56
   CRITICAL_SECTION_END;
57
   CRITICAL_SECTION_END;
58
+
59
+  #if ENABLED(EMERGENCY_PARSER)
60
+    emergency_parser(c);
61
+  #endif
57
 }
62
 }
58
 
63
 
59
 
64
 
310
 #if defined(USBCON) && ENABLED(BLUETOOTH)
315
 #if defined(USBCON) && ENABLED(BLUETOOTH)
311
   HardwareSerial bluetoothSerial;
316
   HardwareSerial bluetoothSerial;
312
 #endif
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_M,
329
+      state_M1,
330
+      state_M10,
331
+      state_M11,
332
+      state_M2,
333
+      state_M3,
334
+      state_M4,
335
+      state_M41,
336
+      state_IGNORE // to '\n'
337
+    };
338
+
339
+    static e_parser_state state = state_RESET;
340
+
341
+    switch (state) {
342
+      case state_RESET:
343
+        switch (c) {
344
+          case 'M':
345
+            state = state_M;
346
+            break;
347
+          case ';':
348
+            state = state_IGNORE;
349
+            break;
350
+          default: state = state_RESET;
351
+        }
352
+      break;
353
+
354
+      case state_M:
355
+        switch (c) {
356
+          case '1':
357
+            state = state_M1;
358
+            break;
359
+          case '2':
360
+            state = state_M2;
361
+            break;
362
+          case '3':
363
+            state = state_M3;
364
+            break;
365
+          case '4':
366
+            state = state_M4;
367
+            break;
368
+          case ';':
369
+            state = state_IGNORE;
370
+            break;
371
+          default: state = state_RESET;
372
+        }
373
+      break;
374
+
375
+      case state_M1:
376
+        switch (c) {
377
+          case '0':
378
+            state = state_M10;
379
+            break;
380
+          case '1':
381
+            state = state_M11;
382
+            break;
383
+          case ';':
384
+            state = state_IGNORE;
385
+            break;
386
+          default: state = state_RESET;
387
+        }
388
+      break;
389
+
390
+      case state_M2:
391
+        switch (c) {
392
+          case '3': // M23
393
+          case '8': // M28
394
+          case ';':
395
+            state = state_IGNORE;
396
+            break;
397
+          default: state = state_RESET;
398
+        }
399
+      break;
400
+
401
+      case state_M3:
402
+        switch (c) {
403
+          case '0': // M30
404
+          case '2': // M32
405
+          case '3': // M33
406
+          case ';':
407
+            state = state_IGNORE;
408
+            break;
409
+          default: state = state_RESET;
410
+        }
411
+      break;
412
+
413
+      case state_M10:
414
+        switch (c) {
415
+          case '8': // M108
416
+            { state = state_RESET; wait_for_heatup = false; }
417
+            break;
418
+          case ';':
419
+            state = state_IGNORE;
420
+            break;
421
+          default: state = state_RESET;
422
+        }
423
+      break;
424
+
425
+      case state_M11:
426
+        switch (c) {
427
+          case '2': // M112
428
+            state = state_RESET; kill(PSTR(MSG_KILLED));
429
+            break;
430
+          case '7': // M117
431
+          case ';':
432
+            state = state_IGNORE;
433
+            break;
434
+          default: state = state_RESET;
435
+        }
436
+      break;
437
+
438
+      case state_M4:
439
+        switch (c) {
440
+          case '1':
441
+            state = state_M41;
442
+            break;
443
+          case ';':
444
+            state = state_IGNORE;
445
+            break;
446
+          default: state = state_RESET;
447
+        }
448
+      break;
449
+
450
+      case state_M41:
451
+        switch (c) {
452
+          case '0':
453
+            { state = state_RESET; stepper.quick_stop(); }
454
+            break;
455
+          case ';':
456
+            state = state_IGNORE;
457
+            break;
458
+          default: state = state_RESET;
459
+        }
460
+      break;
461
+
462
+      case state_IGNORE:
463
+        if (c == '\n') state = state_RESET;
464
+      break;
465
+
466
+      default:
467
+        state = state_RESET;
468
+    }
469
+  }
470
+#endif

+ 9
- 0
Marlin/MarlinSerial.h View File

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

+ 41
- 24
Marlin/Marlin_main.cpp View File

160
  * M105 - Read current temp
160
  * M105 - Read current temp
161
  * M106 - Fan on
161
  * M106 - Fan on
162
  * M107 - Fan off
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
  * M109 - Sxxx Wait for extruder current temp to reach target temp. Waits only when heating
164
  * M109 - Sxxx Wait for extruder current temp to reach target temp. Waits only when heating
165
  *        Rxxx Wait for extruder current temp to reach target temp. Waits when heating and cooling
165
  *        Rxxx Wait for extruder current temp to reach target temp. Waits when heating and cooling
166
  *        IF AUTOTEMP is enabled, S<mintemp> B<maxtemp> F<factor>. Exit autotemp by any M109 without F
166
  *        IF AUTOTEMP is enabled, S<mintemp> B<maxtemp> F<factor>. Exit autotemp by any M109 without F
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) stepper.quick_stop();
1113
+      #endif
1111
 
1114
 
1112
       #if defined(NO_TIMEOUTS) && NO_TIMEOUTS > 0
1115
       #if defined(NO_TIMEOUTS) && NO_TIMEOUTS > 0
1113
         last_command_time = ms;
1116
         last_command_time = ms;
4533
 
4536
 
4534
 #endif // FAN_COUNT > 0
4537
 #endif // FAN_COUNT > 0
4535
 
4538
 
4536
-/**
4537
- * M108: Cancel heatup and wait for the hotend and bed, this G-code is asynchronously handled in the get_serial_commands() parser
4538
- */
4539
-inline void gcode_M108() { wait_for_heatup = false; }
4539
+#if DISABLED(EMERGENCY_PARSER)
4540
+
4541
+  /**
4542
+   * M108: Stop the waiting for heaters in M109, M190, M303. Does not affect the target temperature.
4543
+   */
4544
+  inline void gcode_M108() { wait_for_heatup = false; }
4545
+
4546
+#endif
4540
 
4547
 
4541
 /**
4548
 /**
4542
  * M109: Sxxx Wait for extruder(s) to reach temperature. Waits only when heating.
4549
  * M109: Sxxx Wait for extruder(s) to reach temperature. Waits only when heating.
4811
 /**
4818
 /**
4812
  * M112: Emergency Stop
4819
  * M112: Emergency Stop
4813
  */
4820
  */
4814
-inline void gcode_M112() { kill(PSTR(MSG_KILLED)); }
4821
+#if DISABLED(EMERGENCY_PARSER)
4822
+  inline void gcode_M112() { kill(PSTR(MSG_KILLED)); }
4823
+#endif
4815
 
4824
 
4816
 #if ENABLED(HOST_KEEPALIVE_FEATURE)
4825
 #if ENABLED(HOST_KEEPALIVE_FEATURE)
4817
 
4826
 
5991
  * This will stop the carriages mid-move, so most likely they
6000
  * This will stop the carriages mid-move, so most likely they
5992
  * will be out of sync with the stepper position after this.
6001
  * will be out of sync with the stepper position after this.
5993
  */
6002
  */
5994
-inline void gcode_M410() {
5995
-  stepper.quick_stop();
5996
-  #if DISABLED(DELTA) && DISABLED(SCARA)
5997
-    set_current_position_from_planner();
5998
-  #endif
5999
-}
6000
 
6003
 
6004
+#if DISABLED(EMERGENCY_PARSER)
6005
+  inline void gcode_M410() {
6006
+    stepper.quick_stop();
6007
+    #if DISABLED(DELTA) && DISABLED(SCARA)
6008
+      set_current_position_from_planner();
6009
+    #endif
6010
+  }
6011
+#endif
6001
 
6012
 
6002
 #if ENABLED(MESH_BED_LEVELING)
6013
 #if ENABLED(MESH_BED_LEVELING)
6003
 
6014
 
6953
         gcode_M111();
6964
         gcode_M111();
6954
         break;
6965
         break;
6955
 
6966
 
6956
-      case 112: // M112: Emergency Stop
6957
-        gcode_M112();
6958
-        break;
6967
+      #if DISABLED(EMERGENCY_PARSER)
6968
+        case 112: // M112: Emergency Stop
6969
+          gcode_M112();
6970
+          break;
6971
+      #endif
6959
 
6972
 
6960
       #if ENABLED(HOST_KEEPALIVE_FEATURE)
6973
       #if ENABLED(HOST_KEEPALIVE_FEATURE)
6961
 
6974
 
6974
         KEEPALIVE_STATE(NOT_BUSY);
6987
         KEEPALIVE_STATE(NOT_BUSY);
6975
         return; // "ok" already printed
6988
         return; // "ok" already printed
6976
 
6989
 
6977
-      case 108:
6978
-        gcode_M108();
6979
-        break;
6990
+      #if DISABLED(EMERGENCY_PARSER)
6991
+        case 108:
6992
+          gcode_M108();
6993
+          break;
6994
+      #endif
6980
 
6995
 
6981
       case 109: // M109: Wait for temperature
6996
       case 109: // M109: Wait for temperature
6982
         gcode_M109();
6997
         gcode_M109();
7261
           break;
7276
           break;
7262
       #endif // ENABLED(FILAMENT_WIDTH_SENSOR)
7277
       #endif // ENABLED(FILAMENT_WIDTH_SENSOR)
7263
 
7278
 
7264
-      case 410: // M410 quickstop - Abort all the planned moves.
7265
-        gcode_M410();
7266
-        break;
7279
+      #if DISABLED(EMERGENCY_PARSER)
7280
+        case 410: // M410 quickstop - Abort all the planned moves.
7281
+          gcode_M410();
7282
+          break;
7283
+      #endif
7267
 
7284
 
7268
       #if ENABLED(MESH_BED_LEVELING)
7285
       #if ENABLED(MESH_BED_LEVELING)
7269
         case 420: // M420 Enable/Disable Mesh Bed Leveling
7286
         case 420: // M420 Enable/Disable Mesh Bed Leveling

+ 7
- 0
Marlin/SanityCheck.h View File

579
 #endif
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
  * Warnings for old configurations
589
  * Warnings for old configurations
583
  */
590
  */
584
 #if WATCH_TEMP_PERIOD > 500
591
 #if WATCH_TEMP_PERIOD > 500

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

520
 #define MAX_CMD_SIZE 96
520
 #define MAX_CMD_SIZE 96
521
 #define BUFSIZE 4
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
 // Bad Serial-connections can miss a received command by sending an 'ok'
529
 // Bad Serial-connections can miss a received command by sending an 'ok'
524
 // Therefore some clients abort after 30 seconds in a timeout.
530
 // Therefore some clients abort after 30 seconds in a timeout.
525
 // Some other clients start sending commands while receiving a 'wait'.
531
 // Some other clients start sending commands while receiving a 'wait'.

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

520
 #define MAX_CMD_SIZE 96
520
 #define MAX_CMD_SIZE 96
521
 #define BUFSIZE 4
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
 // Bad Serial-connections can miss a received command by sending an 'ok'
529
 // Bad Serial-connections can miss a received command by sending an 'ok'
524
 // Therefore some clients abort after 30 seconds in a timeout.
530
 // Therefore some clients abort after 30 seconds in a timeout.
525
 // Some other clients start sending commands while receiving a 'wait'.
531
 // Some other clients start sending commands while receiving a 'wait'.

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

520
 #define MAX_CMD_SIZE 96
520
 #define MAX_CMD_SIZE 96
521
 #define BUFSIZE 4
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
 // Bad Serial-connections can miss a received command by sending an 'ok'
529
 // Bad Serial-connections can miss a received command by sending an 'ok'
524
 // Therefore some clients abort after 30 seconds in a timeout.
530
 // Therefore some clients abort after 30 seconds in a timeout.
525
 // Some other clients start sending commands while receiving a 'wait'.
531
 // Some other clients start sending commands while receiving a 'wait'.

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

520
 #define MAX_CMD_SIZE 96
520
 #define MAX_CMD_SIZE 96
521
 #define BUFSIZE 4
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
 // Bad Serial-connections can miss a received command by sending an 'ok'
529
 // Bad Serial-connections can miss a received command by sending an 'ok'
524
 // Therefore some clients abort after 30 seconds in a timeout.
530
 // Therefore some clients abort after 30 seconds in a timeout.
525
 // Some other clients start sending commands while receiving a 'wait'.
531
 // Some other clients start sending commands while receiving a 'wait'.

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

526
 #define MAX_CMD_SIZE 96
526
 #define MAX_CMD_SIZE 96
527
 #define BUFSIZE 4
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
 // Bad Serial-connections can miss a received command by sending an 'ok'
535
 // Bad Serial-connections can miss a received command by sending an 'ok'
530
 // Therefore some clients abort after 30 seconds in a timeout.
536
 // Therefore some clients abort after 30 seconds in a timeout.
531
 // Some other clients start sending commands while receiving a 'wait'.
537
 // Some other clients start sending commands while receiving a 'wait'.

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

520
 #define MAX_CMD_SIZE 96
520
 #define MAX_CMD_SIZE 96
521
 #define BUFSIZE 26
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
 // Bad Serial-connections can miss a received command by sending an 'ok'
529
 // Bad Serial-connections can miss a received command by sending an 'ok'
524
 // Therefore some clients abort after 30 seconds in a timeout.
530
 // Therefore some clients abort after 30 seconds in a timeout.
525
 // Some other clients start sending commands while receiving a 'wait'.
531
 // Some other clients start sending commands while receiving a 'wait'.

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

520
 #define MAX_CMD_SIZE 96
520
 #define MAX_CMD_SIZE 96
521
 #define BUFSIZE 8
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
 // Bad Serial-connections can miss a received command by sending an 'ok'
529
 // Bad Serial-connections can miss a received command by sending an 'ok'
524
 // Therefore some clients abort after 30 seconds in a timeout.
530
 // Therefore some clients abort after 30 seconds in a timeout.
525
 // Some other clients start sending commands while receiving a 'wait'.
531
 // Some other clients start sending commands while receiving a 'wait'.

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

520
 #define MAX_CMD_SIZE 96
520
 #define MAX_CMD_SIZE 96
521
 #define BUFSIZE 4
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
 // Bad Serial-connections can miss a received command by sending an 'ok'
529
 // Bad Serial-connections can miss a received command by sending an 'ok'
524
 // Therefore some clients abort after 30 seconds in a timeout.
530
 // Therefore some clients abort after 30 seconds in a timeout.
525
 // Some other clients start sending commands while receiving a 'wait'.
531
 // Some other clients start sending commands while receiving a 'wait'.

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

528
 #define MAX_CMD_SIZE 96
528
 #define MAX_CMD_SIZE 96
529
 #define BUFSIZE 4
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
 // Bad Serial-connections can miss a received command by sending an 'ok'
537
 // Bad Serial-connections can miss a received command by sending an 'ok'
532
 // Therefore some clients abort after 30 seconds in a timeout.
538
 // Therefore some clients abort after 30 seconds in a timeout.
533
 // Some other clients start sending commands while receiving a 'wait'.
539
 // Some other clients start sending commands while receiving a 'wait'.

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

520
 #define MAX_CMD_SIZE 96
520
 #define MAX_CMD_SIZE 96
521
 #define BUFSIZE 4
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
 // Bad Serial-connections can miss a received command by sending an 'ok'
529
 // Bad Serial-connections can miss a received command by sending an 'ok'
524
 // Therefore some clients abort after 30 seconds in a timeout.
530
 // Therefore some clients abort after 30 seconds in a timeout.
525
 // Some other clients start sending commands while receiving a 'wait'.
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
 #define MAX_CMD_SIZE 96
522
 #define MAX_CMD_SIZE 96
523
 #define BUFSIZE 4
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
 // Bad Serial-connections can miss a received command by sending an 'ok'
531
 // Bad Serial-connections can miss a received command by sending an 'ok'
526
 // Therefore some clients abort after 30 seconds in a timeout.
532
 // Therefore some clients abort after 30 seconds in a timeout.
527
 // Some other clients start sending commands while receiving a 'wait'.
533
 // Some other clients start sending commands while receiving a 'wait'.

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

522
 #define MAX_CMD_SIZE 96
522
 #define MAX_CMD_SIZE 96
523
 #define BUFSIZE 4
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
 // Bad Serial-connections can miss a received command by sending an 'ok'
531
 // Bad Serial-connections can miss a received command by sending an 'ok'
526
 // Therefore some clients abort after 30 seconds in a timeout.
532
 // Therefore some clients abort after 30 seconds in a timeout.
527
 // Some other clients start sending commands while receiving a 'wait'.
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
 #define MAX_CMD_SIZE 96
521
 #define MAX_CMD_SIZE 96
522
 #define BUFSIZE 4
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
 // Bad Serial-connections can miss a received command by sending an 'ok'
530
 // Bad Serial-connections can miss a received command by sending an 'ok'
525
 // Therefore some clients abort after 30 seconds in a timeout.
531
 // Therefore some clients abort after 30 seconds in a timeout.
526
 // Some other clients start sending commands while receiving a 'wait'.
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
 #define MAX_CMD_SIZE 96
526
 #define MAX_CMD_SIZE 96
527
 #define BUFSIZE 4
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
 // Bad Serial-connections can miss a received command by sending an 'ok'
535
 // Bad Serial-connections can miss a received command by sending an 'ok'
530
 // Therefore some clients abort after 30 seconds in a timeout.
536
 // Therefore some clients abort after 30 seconds in a timeout.
531
 // Some other clients start sending commands while receiving a 'wait'.
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
 #define MAX_CMD_SIZE 96
522
 #define MAX_CMD_SIZE 96
523
 #define BUFSIZE 4
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
 // Bad Serial-connections can miss a received command by sending an 'ok'
531
 // Bad Serial-connections can miss a received command by sending an 'ok'
526
 // Therefore some clients abort after 30 seconds in a timeout.
532
 // Therefore some clients abort after 30 seconds in a timeout.
527
 // Some other clients start sending commands while receiving a 'wait'.
533
 // Some other clients start sending commands while receiving a 'wait'.

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

520
 #define MAX_CMD_SIZE 96
520
 #define MAX_CMD_SIZE 96
521
 #define BUFSIZE 4
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
 // Bad Serial-connections can miss a received command by sending an 'ok'
529
 // Bad Serial-connections can miss a received command by sending an 'ok'
524
 // Therefore some clients abort after 30 seconds in a timeout.
530
 // Therefore some clients abort after 30 seconds in a timeout.
525
 // Some other clients start sending commands while receiving a 'wait'.
531
 // Some other clients start sending commands while receiving a 'wait'.

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

520
 #define MAX_CMD_SIZE 96
520
 #define MAX_CMD_SIZE 96
521
 #define BUFSIZE 4
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
 // Bad Serial-connections can miss a received command by sending an 'ok'
529
 // Bad Serial-connections can miss a received command by sending an 'ok'
524
 // Therefore some clients abort after 30 seconds in a timeout.
530
 // Therefore some clients abort after 30 seconds in a timeout.
525
 // Some other clients start sending commands while receiving a 'wait'.
531
 // Some other clients start sending commands while receiving a 'wait'.

+ 1
- 1
Marlin/language.h View File

128
 #define MSG_INVALID_EXTRUDER                "Invalid extruder"
128
 #define MSG_INVALID_EXTRUDER                "Invalid extruder"
129
 #define MSG_INVALID_SOLENOID                "Invalid solenoid"
129
 #define MSG_INVALID_SOLENOID                "Invalid solenoid"
130
 #define MSG_ERR_NO_THERMISTORS              "No thermistors - no temperature"
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
 #define MSG_COUNT_X                         " Count X: "
132
 #define MSG_COUNT_X                         " Count X: "
133
 #define MSG_COUNT_A                         " Count A: "
133
 #define MSG_COUNT_A                         " Count A: "
134
 #define MSG_ERR_KILLED                      "Printer halted. kill() called!"
134
 #define MSG_ERR_KILLED                      "Printer halted. kill() called!"

+ 4
- 1
Marlin/temperature.cpp View File

238
       soft_pwm_bed = bias = d = (MAX_BED_POWER) / 2;
238
       soft_pwm_bed = bias = d = (MAX_BED_POWER) / 2;
239
     #endif
239
     #endif
240
 
240
 
241
+    wait_for_heatup = true;
242
+
241
     // PID Tuning loop
243
     // PID Tuning loop
242
-    for (;;) {
244
+    while (wait_for_heatup) {
243
 
245
 
244
       millis_t ms = millis();
246
       millis_t ms = millis();
245
 
247
 
421
       }
423
       }
422
       lcd_update();
424
       lcd_update();
423
     }
425
     }
426
+    if (!wait_for_heatup) disable_all_heaters();
424
   }
427
   }
425
 
428
 
426
 #endif // HAS_PID_HEATING
429
 #endif // HAS_PID_HEATING

Loading…
Cancel
Save