M303 followup

- Put 'D' before other params for clean exit.
- Use serial on/off for debug status.
This commit is contained in:
Scott Lahteine 2020-03-25 15:07:58 -05:00
parent 1986e1cdf8
commit f2ed18d150
2 changed files with 20 additions and 17 deletions

View File

@ -473,7 +473,7 @@
#if ENABLED(PIDTEMP) #if ENABLED(PIDTEMP)
//#define PID_EDIT_MENU // Add PID editing to the "Advanced Settings" menu. (~700 bytes of PROGMEM) //#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_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 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 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) //#define PID_PARAMS_PER_HOTEND // Uses separate PID parameters for each extruder (useful for mismatched extruders)

View File

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