Allow SERIAL_ECHOPAIR to take up to 12 pairs (#13311)

This commit is contained in:
Scott Lahteine
2019-03-05 06:46:19 -06:00
committed by GitHub
parent 4771e372a1
commit cfdb38eda4
30 changed files with 474 additions and 611 deletions

View File

@ -456,37 +456,26 @@ uint8_t Temperature::soft_pwm_amount[HOTENDS];
bias = constrain(bias, 20, max_pow - 20);
d = (bias > max_pow >> 1) ? max_pow - 1 - bias : bias;
SERIAL_ECHOPAIR(MSG_BIAS, bias);
SERIAL_ECHOPAIR(MSG_D, d);
SERIAL_ECHOPAIR(MSG_T_MIN, min);
SERIAL_ECHOPAIR(MSG_T_MAX, max);
SERIAL_ECHOPAIR(MSG_BIAS, bias, MSG_D, d, MSG_T_MIN, min, MSG_T_MAX, max);
if (cycles > 2) {
float Ku = (4.0f * d) / (float(M_PI) * (max - min) * 0.5f),
Tu = ((float)(t_low + t_high) * 0.001f);
SERIAL_ECHOPAIR(MSG_KU, Ku);
SERIAL_ECHOPAIR(MSG_TU, Tu);
tune_pid.Kp = 0.6f * Ku;
tune_pid.Ki = 2 * tune_pid.Kp / Tu;
tune_pid.Kd = tune_pid.Kp * Tu * 0.125f;
SERIAL_ECHOPAIR(MSG_KU, Ku, MSG_TU, Tu);
SERIAL_ECHOLNPGM("\n" MSG_CLASSIC_PID);
SERIAL_ECHOPAIR(MSG_KP, tune_pid.Kp);
SERIAL_ECHOPAIR(MSG_KI, tune_pid.Ki);
SERIAL_ECHOLNPAIR(MSG_KD, tune_pid.Kd);
SERIAL_ECHOLNPAIR(MSG_KP, tune_pid.Kp, MSG_KI, tune_pid.Ki, MSG_KD, tune_pid.Kd);
/**
tune_pid.Kp = 0.33*Ku;
tune_pid.Ki = tune_pid.Kp/Tu;
tune_pid.Kd = tune_pid.Kp*Tu/3;
SERIAL_ECHOLNPGM(" Some overshoot");
SERIAL_ECHOPAIR(" Kp: ", tune_pid.Kp);
SERIAL_ECHOPAIR(" Ki: ", tune_pid.Ki);
SERIAL_ECHOPAIR(" Kd: ", tune_pid.Kd);
SERIAL_ECHOLNPAIR(" Kp: ", tune_pid.Kp, " Ki: ", tune_pid.Ki, " Kd: ", tune_pid.Kd, " No overshoot");
tune_pid.Kp = 0.2*Ku;
tune_pid.Ki = 2*tune_pid.Kp/Tu;
tune_pid.Kd = tune_pid.Kp*Tu/3;
SERIAL_ECHOLNPGM(" No overshoot");
SERIAL_ECHOPAIR(" Kp: ", tune_pid.Kp);
SERIAL_ECHOPAIR(" Ki: ", tune_pid.Ki);
SERIAL_ECHOPAIR(" Kd: ", tune_pid.Kd);
SERIAL_ECHOPAIR(" Kp: ", tune_pid.Kp, " Ki: ", tune_pid.Ki, " Kd: ", tune_pid.Kd);
*/
}
}
@ -807,16 +796,20 @@ float Temperature::get_pid_output(const int8_t e) {
#if ENABLED(PID_DEBUG)
SERIAL_ECHO_START();
SERIAL_ECHOPAIR(MSG_PID_DEBUG, HOTEND_INDEX);
SERIAL_ECHOPAIR(MSG_PID_DEBUG_INPUT, current_temperature[HOTEND_INDEX]);
SERIAL_ECHOPAIR(MSG_PID_DEBUG_OUTPUT, pid_output);
SERIAL_ECHOPAIR(
MSG_PID_DEBUG, HOTEND_INDEX,
MSG_PID_DEBUG_INPUT, current_temperature[HOTEND_INDEX],
MSG_PID_DEBUG_OUTPUT, pid_output
);
#if DISABLED(PID_OPENLOOP)
SERIAL_ECHOPAIR(MSG_PID_DEBUG_PTERM, work_pid[HOTEND_INDEX].Kp);
SERIAL_ECHOPAIR(MSG_PID_DEBUG_ITERM, work_pid[HOTEND_INDEX].Ki);
SERIAL_ECHOPAIR(MSG_PID_DEBUG_DTERM, work_pid[HOTEND_INDEX].Kd);
#if ENABLED(PID_EXTRUSION_SCALING)
SERIAL_ECHOPAIR(MSG_PID_DEBUG_CTERM, work_pid[HOTEND_INDEX].Kc);
#endif
SERIAL_ECHOPAIR(
MSG_PID_DEBUG_PTERM, work_pid[HOTEND_INDEX].Kp,
MSG_PID_DEBUG_ITERM, work_pid[HOTEND_INDEX].Ki,
MSG_PID_DEBUG_DTERM, work_pid[HOTEND_INDEX].Kd
#if ENABLED(PID_EXTRUSION_SCALING),
MSG_PID_DEBUG_CTERM, work_pid[HOTEND_INDEX].Kc
#endif
);
#endif
SERIAL_EOL();
#endif // PID_DEBUG
@ -869,13 +862,14 @@ float Temperature::get_pid_output(const int8_t e) {
#if ENABLED(PID_BED_DEBUG)
SERIAL_ECHO_START();
SERIAL_ECHOPAIR(" PID_BED_DEBUG : Input ", current_temperature_bed);
SERIAL_ECHOPAIR(" Output ", pid_output);
#if DISABLED(PID_OPENLOOP)
SERIAL_ECHOPAIR(MSG_PID_DEBUG_PTERM, work_pid.Kp);
SERIAL_ECHOPAIR(MSG_PID_DEBUG_ITERM, work_pid.Ki);
SERIAL_ECHOLNPAIR(MSG_PID_DEBUG_DTERM, work_pid.Kd);
#endif
SERIAL_ECHOLNPAIR(
" PID_BED_DEBUG : Input ", current_temperature_bed, " Output ", pid_output,
#if DISABLED(PID_OPENLOOP)
MSG_PID_DEBUG_PTERM, work_pid.Kp,
MSG_PID_DEBUG_ITERM, work_pid.Ki,
MSG_PID_DEBUG_DTERM, work_pid.Kd,
#endif
);
#endif
return pid_output;
@ -1622,10 +1616,7 @@ void Temperature::init() {
SERIAL_ECHO_START();
SERIAL_ECHOPGM("Thermal Thermal Runaway Running. Heater ID: ");
if (heater_id < 0) SERIAL_ECHOPGM("bed"); else SERIAL_ECHO(heater_id);
SERIAL_ECHOPAIR(" ; State:", *state);
SERIAL_ECHOPAIR(" ; Timer:", *timer);
SERIAL_ECHOPAIR(" ; Temperature:", current);
SERIAL_ECHOPAIR(" ; Target Temp:", target);
SERIAL_ECHOPAIR(" ; State:", *state, " ; Timer:", *timer, " ; Temperature:", current, " ; Target Temp:", target);
if (heater_id >= 0)
SERIAL_ECHOPAIR(" ; Idle Timeout:", heater_idle_timeout_exceeded[heater_id]);
else