Browse Source

Merge pull request #3414 from thinkyhead/rc_host_timeout_mods

Host Keepalive configurable timeout with 2s default
Scott Lahteine 8 years ago
parent
commit
50c3140040

+ 4
- 1
Marlin/Configuration.h View File

@@ -721,9 +721,12 @@ const bool Z_MIN_PROBE_ENDSTOP_INVERTING = false; // set to true to invert the l
721 721
 // Host Keepalive
722 722
 //
723 723
 // By default Marlin will send a busy status message to the host
724
-// every 10 seconds when it can't accept commands.
724
+// every couple of seconds when it can't accept commands.
725 725
 //
726 726
 //#define DISABLE_HOST_KEEPALIVE // Enable this option if your host doesn't like keepalive messages.
727
+#if DISABLED(DISABLE_HOST_KEEPALIVE)
728
+  #define DEFAULT_KEEPALIVE_INTERVAL 2 // Number of seconds between "busy" messages. Set with M113.
729
+#endif
727 730
 
728 731
 //
729 732
 // M100 Free Memory Watcher

+ 4
- 0
Marlin/Marlin.h View File

@@ -327,6 +327,10 @@ extern bool axis_homed[3]; // axis[n].is_homed
327 327
   extern float zprobe_zoffset;
328 328
 #endif
329 329
 
330
+#if ENABLED(HOST_KEEPALIVE_FEATURE)
331
+  extern uint8_t host_keepalive_interval;
332
+#endif
333
+
330 334
 #if ENABLED(PREVENT_DANGEROUS_EXTRUDE)
331 335
   extern float extrude_min_temp;
332 336
 #endif

+ 24
- 1
Marlin/Marlin_main.cpp View File

@@ -155,6 +155,7 @@
155 155
  * M110 - Set the current line number
156 156
  * M111 - Set debug flags with S<mask>. See flag bits defined in Marlin.h.
157 157
  * M112 - Emergency stop
158
+ * M113 - Get or set the timeout interval for Host Keepalive "busy" messages
158 159
  * M114 - Output current position to serial port
159 160
  * M115 - Capabilities string
160 161
  * M117 - Display a message on the controller screen
@@ -456,6 +457,7 @@ static bool send_ok[BUFSIZE];
456 457
 
457 458
   static MarlinBusyState busy_state = NOT_BUSY;
458 459
   static millis_t next_busy_signal_ms = -1;
460
+  uint8_t host_keepalive_interval = DEFAULT_KEEPALIVE_INTERVAL;
459 461
   #define KEEPALIVE_STATE(n) do{ busy_state = n; }while(0)
460 462
 #else
461 463
   #define host_keepalive() ;
@@ -2297,7 +2299,7 @@ void unknown_command_error() {
2297 2299
           break;
2298 2300
       }
2299 2301
     }
2300
-    next_busy_signal_ms = ms + 10000UL; // "busy: ..." message every 10s
2302
+    next_busy_signal_ms = host_keepalive_interval ? ms + 1000UL * host_keepalive_interval : -1;
2301 2303
   }
2302 2304
 
2303 2305
 #endif //HOST_KEEPALIVE_FEATURE
@@ -4427,6 +4429,27 @@ inline void gcode_M111() {
4427 4429
  */
4428 4430
 inline void gcode_M112() { kill(PSTR(MSG_KILLED)); }
4429 4431
 
4432
+#if ENABLED(HOST_KEEPALIVE_FEATURE)
4433
+
4434
+  /**
4435
+   * M113: Get or set Host Keepalive interval (0 to disable)
4436
+   *
4437
+   *   S<seconds> Optional. Set the keepalive interval.
4438
+   */
4439
+  inline void gcode_M113() {
4440
+    if (code_seen('S')) {
4441
+      host_keepalive_interval = (uint8_t)code_value_short();
4442
+      NOMORE(host_keepalive_interval, 60);
4443
+    }
4444
+    else {
4445
+      SERIAL_ECHO_START;
4446
+      SERIAL_ECHOPAIR("M113 S", (unsigned long)host_keepalive_interval);
4447
+      SERIAL_EOL;
4448
+    }
4449
+  }
4450
+
4451
+#endif
4452
+
4430 4453
 #if ENABLED(BARICUDA)
4431 4454
 
4432 4455
   #if HAS_HEATER_1

+ 4
- 1
Marlin/example_configurations/Felix/Configuration.h View File

@@ -704,9 +704,12 @@ const bool Z_MIN_PROBE_ENDSTOP_INVERTING = false; // set to true to invert the l
704 704
 // Host Keepalive
705 705
 //
706 706
 // By default Marlin will send a busy status message to the host
707
-// every 10 seconds when it can't accept commands.
707
+// every couple of seconds when it can't accept commands.
708 708
 //
709 709
 //#define DISABLE_HOST_KEEPALIVE // Enable this option if your host doesn't like keepalive messages.
710
+#if DISABLED(DISABLE_HOST_KEEPALIVE)
711
+  #define DEFAULT_KEEPALIVE_INTERVAL 2 // Number of seconds between "busy" messages. Set with M113.
712
+#endif
710 713
 
711 714
 //
712 715
 // M100 Free Memory Watcher

+ 4
- 1
Marlin/example_configurations/Felix/Configuration_DUAL.h View File

@@ -701,9 +701,12 @@ const bool Z_MIN_PROBE_ENDSTOP_INVERTING = false; // set to true to invert the l
701 701
 // Host Keepalive
702 702
 //
703 703
 // By default Marlin will send a busy status message to the host
704
-// every 10 seconds when it can't accept commands.
704
+// every couple of seconds when it can't accept commands.
705 705
 //
706 706
 //#define DISABLE_HOST_KEEPALIVE // Enable this option if your host doesn't like keepalive messages.
707
+#if DISABLED(DISABLE_HOST_KEEPALIVE)
708
+  #define DEFAULT_KEEPALIVE_INTERVAL 2 // Number of seconds between "busy" messages. Set with M113.
709
+#endif
707 710
 
708 711
 //
709 712
 // M100 Free Memory Watcher

+ 4
- 1
Marlin/example_configurations/Hephestos/Configuration.h View File

@@ -713,9 +713,12 @@ const bool Z_MIN_PROBE_ENDSTOP_INVERTING = true; // set to true to invert the lo
713 713
 // Host Keepalive
714 714
 //
715 715
 // By default Marlin will send a busy status message to the host
716
-// every 10 seconds when it can't accept commands.
716
+// every couple of seconds when it can't accept commands.
717 717
 //
718 718
 //#define DISABLE_HOST_KEEPALIVE // Enable this option if your host doesn't like keepalive messages.
719
+#if DISABLED(DISABLE_HOST_KEEPALIVE)
720
+  #define DEFAULT_KEEPALIVE_INTERVAL 2 // Number of seconds between "busy" messages. Set with M113.
721
+#endif
719 722
 
720 723
 //
721 724
 // M100 Free Memory Watcher

+ 4
- 1
Marlin/example_configurations/Hephestos_2/Configuration.h View File

@@ -715,9 +715,12 @@ const bool Z_MIN_PROBE_ENDSTOP_INVERTING = false; // set to true to invert the l
715 715
 // Host Keepalive
716 716
 //
717 717
 // By default Marlin will send a busy status message to the host
718
-// every 10 seconds when it can't accept commands.
718
+// every couple of seconds when it can't accept commands.
719 719
 //
720 720
 //#define DISABLE_HOST_KEEPALIVE // Enable this option if your host doesn't like keepalive messages.
721
+#if DISABLED(DISABLE_HOST_KEEPALIVE)
722
+  #define DEFAULT_KEEPALIVE_INTERVAL 2 // Number of seconds between "busy" messages. Set with M113.
723
+#endif
721 724
 
722 725
 //
723 726
 // M100 Free Memory Watcher

+ 4
- 1
Marlin/example_configurations/K8200/Configuration.h View File

@@ -738,9 +738,12 @@ const bool Z_MIN_PROBE_ENDSTOP_INVERTING = false; // set to true to invert the l
738 738
 // Host Keepalive
739 739
 //
740 740
 // By default Marlin will send a busy status message to the host
741
-// every 10 seconds when it can't accept commands.
741
+// every couple of seconds when it can't accept commands.
742 742
 //
743 743
 //#define DISABLE_HOST_KEEPALIVE // Enable this option if your host doesn't like keepalive messages.
744
+#if DISABLED(DISABLE_HOST_KEEPALIVE)
745
+  #define DEFAULT_KEEPALIVE_INTERVAL 2 // Number of seconds between "busy" messages. Set with M113.
746
+#endif
744 747
 
745 748
 //
746 749
 // M100 Free Memory Watcher

+ 4
- 1
Marlin/example_configurations/RepRapWorld/Megatronics/Configuration.h View File

@@ -721,9 +721,12 @@ const bool Z_MIN_PROBE_ENDSTOP_INVERTING = false; // set to true to invert the l
721 721
 // Host Keepalive
722 722
 //
723 723
 // By default Marlin will send a busy status message to the host
724
-// every 10 seconds when it can't accept commands.
724
+// every couple of seconds when it can't accept commands.
725 725
 //
726 726
 //#define DISABLE_HOST_KEEPALIVE // Enable this option if your host doesn't like keepalive messages.
727
+#if DISABLED(DISABLE_HOST_KEEPALIVE)
728
+  #define DEFAULT_KEEPALIVE_INTERVAL 2 // Number of seconds between "busy" messages. Set with M113.
729
+#endif
727 730
 
728 731
 //
729 732
 // M100 Free Memory Watcher

+ 4
- 1
Marlin/example_configurations/RigidBot/Configuration.h View File

@@ -716,9 +716,12 @@ const bool Z_MIN_PROBE_ENDSTOP_INVERTING = false; // set to true to invert the l
716 716
 // Host Keepalive
717 717
 //
718 718
 // By default Marlin will send a busy status message to the host
719
-// every 10 seconds when it can't accept commands.
719
+// every couple of seconds when it can't accept commands.
720 720
 //
721 721
 //#define DISABLE_HOST_KEEPALIVE // Enable this option if your host doesn't like keepalive messages.
722
+#if DISABLED(DISABLE_HOST_KEEPALIVE)
723
+  #define DEFAULT_KEEPALIVE_INTERVAL 2 // Number of seconds between "busy" messages. Set with M113.
724
+#endif
722 725
 
723 726
 //
724 727
 // M100 Free Memory Watcher

+ 4
- 1
Marlin/example_configurations/SCARA/Configuration.h View File

@@ -729,9 +729,12 @@ const bool Z_MIN_PROBE_ENDSTOP_INVERTING = false; // set to true to invert the l
729 729
 // Host Keepalive
730 730
 //
731 731
 // By default Marlin will send a busy status message to the host
732
-// every 10 seconds when it can't accept commands.
732
+// every couple of seconds when it can't accept commands.
733 733
 //
734 734
 //#define DISABLE_HOST_KEEPALIVE // Enable this option if your host doesn't like keepalive messages.
735
+#if DISABLED(DISABLE_HOST_KEEPALIVE)
736
+  #define DEFAULT_KEEPALIVE_INTERVAL 2 // Number of seconds between "busy" messages. Set with M113.
737
+#endif
735 738
 
736 739
 //
737 740
 // M100 Free Memory Watcher

+ 4
- 1
Marlin/example_configurations/TAZ4/Configuration.h View File

@@ -742,9 +742,12 @@ const bool Z_MIN_PROBE_ENDSTOP_INVERTING = false; // set to true to invert the l
742 742
 // Host Keepalive
743 743
 //
744 744
 // By default Marlin will send a busy status message to the host
745
-// every 10 seconds when it can't accept commands.
745
+// every couple of seconds when it can't accept commands.
746 746
 //
747 747
 //#define DISABLE_HOST_KEEPALIVE // Enable this option if your host doesn't like keepalive messages.
748
+#if DISABLED(DISABLE_HOST_KEEPALIVE)
749
+  #define DEFAULT_KEEPALIVE_INTERVAL 2 // Number of seconds between "busy" messages. Set with M113.
750
+#endif
748 751
 
749 752
 //
750 753
 // M100 Free Memory Watcher

+ 4
- 1
Marlin/example_configurations/WITBOX/Configuration.h View File

@@ -713,9 +713,12 @@ const bool Z_MIN_PROBE_ENDSTOP_INVERTING = true; // set to true to invert the lo
713 713
 // Host Keepalive
714 714
 //
715 715
 // By default Marlin will send a busy status message to the host
716
-// every 10 seconds when it can't accept commands.
716
+// every couple of seconds when it can't accept commands.
717 717
 //
718 718
 //#define DISABLE_HOST_KEEPALIVE // Enable this option if your host doesn't like keepalive messages.
719
+#if DISABLED(DISABLE_HOST_KEEPALIVE)
720
+  #define DEFAULT_KEEPALIVE_INTERVAL 2 // Number of seconds between "busy" messages. Set with M113.
721
+#endif
719 722
 
720 723
 //
721 724
 // M100 Free Memory Watcher

+ 4
- 1
Marlin/example_configurations/adafruit/ST7565/Configuration.h View File

@@ -721,9 +721,12 @@ const bool Z_MIN_PROBE_ENDSTOP_INVERTING = false; // set to true to invert the l
721 721
 // Host Keepalive
722 722
 //
723 723
 // By default Marlin will send a busy status message to the host
724
-// every 10 seconds when it can't accept commands.
724
+// every couple of seconds when it can't accept commands.
725 725
 //
726 726
 //#define DISABLE_HOST_KEEPALIVE // Enable this option if your host doesn't like keepalive messages.
727
+#if DISABLED(DISABLE_HOST_KEEPALIVE)
728
+  #define DEFAULT_KEEPALIVE_INTERVAL 2 // Number of seconds between "busy" messages. Set with M113.
729
+#endif
727 730
 
728 731
 //
729 732
 // M100 Free Memory Watcher

+ 4
- 1
Marlin/example_configurations/delta/biv2.5/Configuration.h View File

@@ -843,9 +843,12 @@ const bool Z_MIN_PROBE_ENDSTOP_INVERTING = true; // set to true to invert the lo
843 843
 // Host Keepalive
844 844
 //
845 845
 // By default Marlin will send a busy status message to the host
846
-// every 10 seconds when it can't accept commands.
846
+// every couple of seconds when it can't accept commands.
847 847
 //
848 848
 //#define DISABLE_HOST_KEEPALIVE // Enable this option if your host doesn't like keepalive messages.
849
+#if DISABLED(DISABLE_HOST_KEEPALIVE)
850
+  #define DEFAULT_KEEPALIVE_INTERVAL 2 // Number of seconds between "busy" messages. Set with M113.
851
+#endif
849 852
 
850 853
 //
851 854
 // M100 Free Memory Watcher

+ 4
- 1
Marlin/example_configurations/delta/generic/Configuration.h View File

@@ -843,9 +843,12 @@ const bool Z_MIN_PROBE_ENDSTOP_INVERTING = true; // set to true to invert the lo
843 843
 // Host Keepalive
844 844
 //
845 845
 // By default Marlin will send a busy status message to the host
846
-// every 10 seconds when it can't accept commands.
846
+// every couple of seconds when it can't accept commands.
847 847
 //
848 848
 //#define DISABLE_HOST_KEEPALIVE // Enable this option if your host doesn't like keepalive messages.
849
+#if DISABLED(DISABLE_HOST_KEEPALIVE)
850
+  #define DEFAULT_KEEPALIVE_INTERVAL 2 // Number of seconds between "busy" messages. Set with M113.
851
+#endif
849 852
 
850 853
 //
851 854
 // M100 Free Memory Watcher

+ 4
- 1
Marlin/example_configurations/delta/kossel_mini/Configuration.h View File

@@ -847,9 +847,12 @@ const bool Z_MIN_PROBE_ENDSTOP_INVERTING = false; // set to true to invert the l
847 847
 // Host Keepalive
848 848
 //
849 849
 // By default Marlin will send a busy status message to the host
850
-// every 10 seconds when it can't accept commands.
850
+// every couple of seconds when it can't accept commands.
851 851
 //
852 852
 //#define DISABLE_HOST_KEEPALIVE // Enable this option if your host doesn't like keepalive messages.
853
+#if DISABLED(DISABLE_HOST_KEEPALIVE)
854
+  #define DEFAULT_KEEPALIVE_INTERVAL 2 // Number of seconds between "busy" messages. Set with M113.
855
+#endif
853 856
 
854 857
 //
855 858
 // M100 Free Memory Watcher

+ 4
- 1
Marlin/example_configurations/delta/kossel_pro/Configuration.h View File

@@ -840,9 +840,12 @@ const bool Z_MIN_PROBE_ENDSTOP_INVERTING = false; // set to true to invert the l
840 840
 // Host Keepalive
841 841
 //
842 842
 // By default Marlin will send a busy status message to the host
843
-// every 10 seconds when it can't accept commands.
843
+// every couple of seconds when it can't accept commands.
844 844
 //
845 845
 //#define DISABLE_HOST_KEEPALIVE // Enable this option if your host doesn't like keepalive messages.
846
+#if DISABLED(DISABLE_HOST_KEEPALIVE)
847
+  #define DEFAULT_KEEPALIVE_INTERVAL 2 // Number of seconds between "busy" messages. Set with M113.
848
+#endif
846 849
 
847 850
 //
848 851
 // M100 Free Memory Watcher

+ 4
- 1
Marlin/example_configurations/delta/kossel_xl/Configuration.h View File

@@ -757,9 +757,12 @@ const bool Z_MIN_PROBE_ENDSTOP_INVERTING = false; // set to true to invert the l
757 757
 // Host Keepalive
758 758
 //
759 759
 // By default Marlin will send a busy status message to the host
760
-// every 10 seconds when it can't accept commands.
760
+// every couple of seconds when it can't accept commands.
761 761
 //
762 762
 //#define DISABLE_HOST_KEEPALIVE // Enable this option if your host doesn't like keepalive messages.
763
+#if DISABLED(DISABLE_HOST_KEEPALIVE)
764
+  #define DEFAULT_KEEPALIVE_INTERVAL 2 // Number of seconds between "busy" messages. Set with M113.
765
+#endif
763 766
 
764 767
 //
765 768
 // M100 Free Memory Watcher

+ 4
- 1
Marlin/example_configurations/makibox/Configuration.h View File

@@ -724,9 +724,12 @@ const bool Z_MIN_PROBE_ENDSTOP_INVERTING = false; // set to true to invert the l
724 724
 // Host Keepalive
725 725
 //
726 726
 // By default Marlin will send a busy status message to the host
727
-// every 10 seconds when it can't accept commands.
727
+// every couple of seconds when it can't accept commands.
728 728
 //
729 729
 //#define DISABLE_HOST_KEEPALIVE // Enable this option if your host doesn't like keepalive messages.
730
+#if DISABLED(DISABLE_HOST_KEEPALIVE)
731
+  #define DEFAULT_KEEPALIVE_INTERVAL 2 // Number of seconds between "busy" messages. Set with M113.
732
+#endif
730 733
 
731 734
 //
732 735
 // M100 Free Memory Watcher

+ 4
- 1
Marlin/example_configurations/tvrrug/Round2/Configuration.h View File

@@ -715,9 +715,12 @@ const bool Z_MIN_PROBE_ENDSTOP_INVERTING = true; // set to true to invert the lo
715 715
 // Host Keepalive
716 716
 //
717 717
 // By default Marlin will send a busy status message to the host
718
-// every 10 seconds when it can't accept commands.
718
+// every couple of seconds when it can't accept commands.
719 719
 //
720 720
 //#define DISABLE_HOST_KEEPALIVE // Enable this option if your host doesn't like keepalive messages.
721
+#if DISABLED(DISABLE_HOST_KEEPALIVE)
722
+  #define DEFAULT_KEEPALIVE_INTERVAL 2 // Number of seconds between "busy" messages. Set with M113.
723
+#endif
721 724
 
722 725
 //
723 726
 // M100 Free Memory Watcher

Loading…
Cancel
Save