Browse Source

M303 followup

- Put 'D' before other params for clean exit.
- Use serial on/off for debug status.
vanilla_fb_2.0.x
Scott Lahteine 5 years ago
parent
commit
f2ed18d150
  1. 2
      Marlin/Configuration.h
  2. 35
      Marlin/src/gcode/temp/M303.cpp

2
Marlin/Configuration.h

@ -473,7 +473,7 @@
#if ENABLED(PIDTEMP)
//#define PID_EDIT_MENU // Add PID editing to the "Advanced Settings" menu. (~700 bytes of PROGMEM)
//#define PID_AUTOTUNE_MENU // Add PID auto-tuning to the "Advanced Settings" menu. (~250 bytes of PROGMEM)
//#define PID_DEBUG // Sends debug data to the serial port. Use M303 D to toggle activation.
//#define PID_DEBUG // Sends debug data to the serial port. Use 'M303 D' to toggle activation.
//#define PID_OPENLOOP 1 // Puts PID in open loop. M104/M140 sets the output power from 0 to PID_MAX
//#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
//#define PID_PARAMS_PER_HOTEND // Uses separate PID parameters for each extruder (useful for mismatched extruders)

35
Marlin/src/gcode/temp/M303.cpp

@ -34,18 +34,31 @@
/**
* M303: PID relay autotune
*
* S<temperature> sets the target temperature. (default 150C / 70C)
* E<extruder> (-1 for the bed) (default 0)
* C<cycles> Minimum 3. Default 5.
* U<bool> with a non-zero value will apply the result to current settings
* D Toggles PID_DEBUG flag. No other action happens even if more parameters are specified.
* S<temperature> Set the target temperature. (Default: 150C / 70C)
* E<extruder> Extruder number to tune, or -1 for the bed. (Default: E0)
* C<cycles> Number of times to repeat the procedure. (Minimum: 3, Default: 5)
* U<bool> Flag to apply the result to the current PID values
*
* With PID_DEBUG:
* D Toggle PID debugging and EXIT without further action.
*/
#if ENABLED(PID_DEBUG)
bool PID_Debug_Flag = 0;
bool pid_debug_flag = 0;
#endif
void GcodeSuite::M303() {
#if ENABLED(PID_DEBUG)
if (parser.seen('D')) {
pid_debug_flag = !pid_debug_flag;
SERIAL_ECHO_START();
SERIAL_ECHOPGM("PID Debug ");
serialprintln_onoff(pid_debug_flag);
return;
}
#endif
#if ENABLED(PIDTEMPBED)
#define SI H_BED
#else
@ -69,16 +82,6 @@ void GcodeSuite::M303() {
const bool u = parser.boolval('U');
const int16_t temp = parser.celsiusval('S', e < 0 ? 70 : 150);
#if ENABLED(PID_DEBUG)
bool d = parser.boolval('D');
if (d) {
PID_Debug_Flag = !PID_Debug_Flag;
SERIAL_ECHOPGM("PID Debug set to: ");
SERIAL_ECHOLN( PID_Debug_Flag );
return;
}
#endif
#if DISABLED(BUSY_WHILE_HEATING)
KEEPALIVE_STATE(NOT_BUSY);
#endif

Loading…
Cancel
Save