浏览代码

M303 followup

- Put 'D' before other params for clean exit.
- Use serial on/off for debug status.
Scott Lahteine 5 年前
父节点
当前提交
f2ed18d150
共有 2 个文件被更改,包括 20 次插入17 次删除
  1. 1
    1
      Marlin/Configuration.h
  2. 19
    16
      Marlin/src/gcode/temp/M303.cpp

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

473
 #if ENABLED(PIDTEMP)
473
 #if ENABLED(PIDTEMP)
474
   //#define PID_EDIT_MENU         // Add PID editing to the "Advanced Settings" menu. (~700 bytes of PROGMEM)
474
   //#define PID_EDIT_MENU         // Add PID editing to the "Advanced Settings" menu. (~700 bytes of PROGMEM)
475
   //#define PID_AUTOTUNE_MENU     // Add PID auto-tuning to the "Advanced Settings" menu. (~250 bytes of PROGMEM)
475
   //#define PID_AUTOTUNE_MENU     // Add PID auto-tuning to the "Advanced Settings" menu. (~250 bytes of PROGMEM)
476
-  //#define PID_DEBUG             // Sends debug data to the serial port.  Use M303 D to toggle activation.
476
+  //#define PID_DEBUG             // Sends debug data to the serial port. Use 'M303 D' to toggle activation.
477
   //#define PID_OPENLOOP 1        // Puts PID in open loop. M104/M140 sets the output power from 0 to PID_MAX
477
   //#define PID_OPENLOOP 1        // Puts PID in open loop. M104/M140 sets the output power from 0 to PID_MAX
478
   //#define SLOW_PWM_HEATERS      // PWM with very low frequency (roughly 0.125Hz=8s) and minimum state time of approximately 1s useful for heaters driven by a relay
478
   //#define SLOW_PWM_HEATERS      // PWM with very low frequency (roughly 0.125Hz=8s) and minimum state time of approximately 1s useful for heaters driven by a relay
479
   //#define PID_PARAMS_PER_HOTEND // Uses separate PID parameters for each extruder (useful for mismatched extruders)
479
   //#define PID_PARAMS_PER_HOTEND // Uses separate PID parameters for each extruder (useful for mismatched extruders)

+ 19
- 16
Marlin/src/gcode/temp/M303.cpp 查看文件

34
 /**
34
 /**
35
  * M303: PID relay autotune
35
  * M303: PID relay autotune
36
  *
36
  *
37
- *       S<temperature> sets the target temperature. (default 150C / 70C)
38
- *       E<extruder> (-1 for the bed) (default 0)
39
- *       C<cycles> Minimum 3. Default 5.
40
- *       U<bool> with a non-zero value will apply the result to current settings
41
- *       D Toggles PID_DEBUG flag. No other action happens even if more parameters are specified.
37
+ *  S<temperature>  Set the target temperature. (Default: 150C / 70C)
38
+ *  E<extruder>     Extruder number to tune, or -1 for the bed. (Default: E0)
39
+ *  C<cycles>       Number of times to repeat the procedure. (Minimum: 3, Default: 5)
40
+ *  U<bool>         Flag to apply the result to the current PID values
41
+ *
42
+ * With PID_DEBUG:
43
+ *  D               Toggle PID debugging and EXIT without further action.
42
  */
44
  */
43
 
45
 
44
 #if ENABLED(PID_DEBUG)
46
 #if ENABLED(PID_DEBUG)
45
-  bool PID_Debug_Flag = 0;
47
+  bool pid_debug_flag = 0;
46
 #endif
48
 #endif
47
 
49
 
48
 void GcodeSuite::M303() {
50
 void GcodeSuite::M303() {
51
+
52
+  #if ENABLED(PID_DEBUG)
53
+    if (parser.seen('D')) {
54
+      pid_debug_flag = !pid_debug_flag;
55
+      SERIAL_ECHO_START();
56
+      SERIAL_ECHOPGM("PID Debug ");
57
+      serialprintln_onoff(pid_debug_flag);
58
+      return;
59
+    }
60
+  #endif
61
+
49
   #if ENABLED(PIDTEMPBED)
62
   #if ENABLED(PIDTEMPBED)
50
     #define SI H_BED
63
     #define SI H_BED
51
   #else
64
   #else
69
   const bool u = parser.boolval('U');
82
   const bool u = parser.boolval('U');
70
   const int16_t temp = parser.celsiusval('S', e < 0 ? 70 : 150);
83
   const int16_t temp = parser.celsiusval('S', e < 0 ? 70 : 150);
71
 
84
 
72
-  #if ENABLED(PID_DEBUG)
73
-    bool d = parser.boolval('D');
74
-    if (d) {
75
-      PID_Debug_Flag = !PID_Debug_Flag;
76
-      SERIAL_ECHOPGM("PID Debug set to: ");
77
-      SERIAL_ECHOLN( PID_Debug_Flag );
78
-      return;
79
-    }
80
-  #endif
81
-
82
   #if DISABLED(BUSY_WHILE_HEATING)
85
   #if DISABLED(BUSY_WHILE_HEATING)
83
     KEEPALIVE_STATE(NOT_BUSY);
86
     KEEPALIVE_STATE(NOT_BUSY);
84
   #endif
87
   #endif

正在加载...
取消
保存