瀏覽代碼

Merge pull request #3414 from thinkyhead/rc_host_timeout_mods

Host Keepalive configurable timeout with 2s default
Scott Lahteine 8 年之前
父節點
當前提交
50c3140040

+ 4
- 1
Marlin/Configuration.h 查看文件

721
 // Host Keepalive
721
 // Host Keepalive
722
 //
722
 //
723
 // By default Marlin will send a busy status message to the host
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
 //#define DISABLE_HOST_KEEPALIVE // Enable this option if your host doesn't like keepalive messages.
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
 // M100 Free Memory Watcher
732
 // M100 Free Memory Watcher

+ 4
- 0
Marlin/Marlin.h 查看文件

327
   extern float zprobe_zoffset;
327
   extern float zprobe_zoffset;
328
 #endif
328
 #endif
329
 
329
 
330
+#if ENABLED(HOST_KEEPALIVE_FEATURE)
331
+  extern uint8_t host_keepalive_interval;
332
+#endif
333
+
330
 #if ENABLED(PREVENT_DANGEROUS_EXTRUDE)
334
 #if ENABLED(PREVENT_DANGEROUS_EXTRUDE)
331
   extern float extrude_min_temp;
335
   extern float extrude_min_temp;
332
 #endif
336
 #endif

+ 24
- 1
Marlin/Marlin_main.cpp 查看文件

155
  * M110 - Set the current line number
155
  * M110 - Set the current line number
156
  * M111 - Set debug flags with S<mask>. See flag bits defined in Marlin.h.
156
  * M111 - Set debug flags with S<mask>. See flag bits defined in Marlin.h.
157
  * M112 - Emergency stop
157
  * M112 - Emergency stop
158
+ * M113 - Get or set the timeout interval for Host Keepalive "busy" messages
158
  * M114 - Output current position to serial port
159
  * M114 - Output current position to serial port
159
  * M115 - Capabilities string
160
  * M115 - Capabilities string
160
  * M117 - Display a message on the controller screen
161
  * M117 - Display a message on the controller screen
456
 
457
 
457
   static MarlinBusyState busy_state = NOT_BUSY;
458
   static MarlinBusyState busy_state = NOT_BUSY;
458
   static millis_t next_busy_signal_ms = -1;
459
   static millis_t next_busy_signal_ms = -1;
460
+  uint8_t host_keepalive_interval = DEFAULT_KEEPALIVE_INTERVAL;
459
   #define KEEPALIVE_STATE(n) do{ busy_state = n; }while(0)
461
   #define KEEPALIVE_STATE(n) do{ busy_state = n; }while(0)
460
 #else
462
 #else
461
   #define host_keepalive() ;
463
   #define host_keepalive() ;
2297
           break;
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
 #endif //HOST_KEEPALIVE_FEATURE
2305
 #endif //HOST_KEEPALIVE_FEATURE
4427
  */
4429
  */
4428
 inline void gcode_M112() { kill(PSTR(MSG_KILLED)); }
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
 #if ENABLED(BARICUDA)
4453
 #if ENABLED(BARICUDA)
4431
 
4454
 
4432
   #if HAS_HEATER_1
4455
   #if HAS_HEATER_1

+ 4
- 1
Marlin/example_configurations/Felix/Configuration.h 查看文件

704
 // Host Keepalive
704
 // Host Keepalive
705
 //
705
 //
706
 // By default Marlin will send a busy status message to the host
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
 //#define DISABLE_HOST_KEEPALIVE // Enable this option if your host doesn't like keepalive messages.
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
 // M100 Free Memory Watcher
715
 // M100 Free Memory Watcher

+ 4
- 1
Marlin/example_configurations/Felix/Configuration_DUAL.h 查看文件

701
 // Host Keepalive
701
 // Host Keepalive
702
 //
702
 //
703
 // By default Marlin will send a busy status message to the host
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
 //#define DISABLE_HOST_KEEPALIVE // Enable this option if your host doesn't like keepalive messages.
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
 // M100 Free Memory Watcher
712
 // M100 Free Memory Watcher

+ 4
- 1
Marlin/example_configurations/Hephestos/Configuration.h 查看文件

713
 // Host Keepalive
713
 // Host Keepalive
714
 //
714
 //
715
 // By default Marlin will send a busy status message to the host
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
 //#define DISABLE_HOST_KEEPALIVE // Enable this option if your host doesn't like keepalive messages.
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
 // M100 Free Memory Watcher
724
 // M100 Free Memory Watcher

+ 4
- 1
Marlin/example_configurations/Hephestos_2/Configuration.h 查看文件

715
 // Host Keepalive
715
 // Host Keepalive
716
 //
716
 //
717
 // By default Marlin will send a busy status message to the host
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
 //#define DISABLE_HOST_KEEPALIVE // Enable this option if your host doesn't like keepalive messages.
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
 // M100 Free Memory Watcher
726
 // M100 Free Memory Watcher

+ 4
- 1
Marlin/example_configurations/K8200/Configuration.h 查看文件

738
 // Host Keepalive
738
 // Host Keepalive
739
 //
739
 //
740
 // By default Marlin will send a busy status message to the host
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
 //#define DISABLE_HOST_KEEPALIVE // Enable this option if your host doesn't like keepalive messages.
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
 // M100 Free Memory Watcher
749
 // M100 Free Memory Watcher

+ 4
- 1
Marlin/example_configurations/RepRapWorld/Megatronics/Configuration.h 查看文件

721
 // Host Keepalive
721
 // Host Keepalive
722
 //
722
 //
723
 // By default Marlin will send a busy status message to the host
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
 //#define DISABLE_HOST_KEEPALIVE // Enable this option if your host doesn't like keepalive messages.
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
 // M100 Free Memory Watcher
732
 // M100 Free Memory Watcher

+ 4
- 1
Marlin/example_configurations/RigidBot/Configuration.h 查看文件

716
 // Host Keepalive
716
 // Host Keepalive
717
 //
717
 //
718
 // By default Marlin will send a busy status message to the host
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
 //#define DISABLE_HOST_KEEPALIVE // Enable this option if your host doesn't like keepalive messages.
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
 // M100 Free Memory Watcher
727
 // M100 Free Memory Watcher

+ 4
- 1
Marlin/example_configurations/SCARA/Configuration.h 查看文件

729
 // Host Keepalive
729
 // Host Keepalive
730
 //
730
 //
731
 // By default Marlin will send a busy status message to the host
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
 //#define DISABLE_HOST_KEEPALIVE // Enable this option if your host doesn't like keepalive messages.
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
 // M100 Free Memory Watcher
740
 // M100 Free Memory Watcher

+ 4
- 1
Marlin/example_configurations/TAZ4/Configuration.h 查看文件

742
 // Host Keepalive
742
 // Host Keepalive
743
 //
743
 //
744
 // By default Marlin will send a busy status message to the host
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
 //#define DISABLE_HOST_KEEPALIVE // Enable this option if your host doesn't like keepalive messages.
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
 // M100 Free Memory Watcher
753
 // M100 Free Memory Watcher

+ 4
- 1
Marlin/example_configurations/WITBOX/Configuration.h 查看文件

713
 // Host Keepalive
713
 // Host Keepalive
714
 //
714
 //
715
 // By default Marlin will send a busy status message to the host
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
 //#define DISABLE_HOST_KEEPALIVE // Enable this option if your host doesn't like keepalive messages.
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
 // M100 Free Memory Watcher
724
 // M100 Free Memory Watcher

+ 4
- 1
Marlin/example_configurations/adafruit/ST7565/Configuration.h 查看文件

721
 // Host Keepalive
721
 // Host Keepalive
722
 //
722
 //
723
 // By default Marlin will send a busy status message to the host
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
 //#define DISABLE_HOST_KEEPALIVE // Enable this option if your host doesn't like keepalive messages.
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
 // M100 Free Memory Watcher
732
 // M100 Free Memory Watcher

+ 4
- 1
Marlin/example_configurations/delta/biv2.5/Configuration.h 查看文件

843
 // Host Keepalive
843
 // Host Keepalive
844
 //
844
 //
845
 // By default Marlin will send a busy status message to the host
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
 //#define DISABLE_HOST_KEEPALIVE // Enable this option if your host doesn't like keepalive messages.
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
 // M100 Free Memory Watcher
854
 // M100 Free Memory Watcher

+ 4
- 1
Marlin/example_configurations/delta/generic/Configuration.h 查看文件

843
 // Host Keepalive
843
 // Host Keepalive
844
 //
844
 //
845
 // By default Marlin will send a busy status message to the host
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
 //#define DISABLE_HOST_KEEPALIVE // Enable this option if your host doesn't like keepalive messages.
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
 // M100 Free Memory Watcher
854
 // M100 Free Memory Watcher

+ 4
- 1
Marlin/example_configurations/delta/kossel_mini/Configuration.h 查看文件

847
 // Host Keepalive
847
 // Host Keepalive
848
 //
848
 //
849
 // By default Marlin will send a busy status message to the host
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
 //#define DISABLE_HOST_KEEPALIVE // Enable this option if your host doesn't like keepalive messages.
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
 // M100 Free Memory Watcher
858
 // M100 Free Memory Watcher

+ 4
- 1
Marlin/example_configurations/delta/kossel_pro/Configuration.h 查看文件

840
 // Host Keepalive
840
 // Host Keepalive
841
 //
841
 //
842
 // By default Marlin will send a busy status message to the host
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
 //#define DISABLE_HOST_KEEPALIVE // Enable this option if your host doesn't like keepalive messages.
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
 // M100 Free Memory Watcher
851
 // M100 Free Memory Watcher

+ 4
- 1
Marlin/example_configurations/delta/kossel_xl/Configuration.h 查看文件

757
 // Host Keepalive
757
 // Host Keepalive
758
 //
758
 //
759
 // By default Marlin will send a busy status message to the host
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
 //#define DISABLE_HOST_KEEPALIVE // Enable this option if your host doesn't like keepalive messages.
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
 // M100 Free Memory Watcher
768
 // M100 Free Memory Watcher

+ 4
- 1
Marlin/example_configurations/makibox/Configuration.h 查看文件

724
 // Host Keepalive
724
 // Host Keepalive
725
 //
725
 //
726
 // By default Marlin will send a busy status message to the host
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
 //#define DISABLE_HOST_KEEPALIVE // Enable this option if your host doesn't like keepalive messages.
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
 // M100 Free Memory Watcher
735
 // M100 Free Memory Watcher

+ 4
- 1
Marlin/example_configurations/tvrrug/Round2/Configuration.h 查看文件

715
 // Host Keepalive
715
 // Host Keepalive
716
 //
716
 //
717
 // By default Marlin will send a busy status message to the host
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
 //#define DISABLE_HOST_KEEPALIVE // Enable this option if your host doesn't like keepalive messages.
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
 // M100 Free Memory Watcher
726
 // M100 Free Memory Watcher

Loading…
取消
儲存