A single SERIAL_ECHO macro type (#12557)

This commit is contained in:
Scott Lahteine
2018-11-29 16:58:58 -06:00
committed by GitHub
parent 69d869c3d9
commit c986239837
86 changed files with 1016 additions and 1356 deletions

View File

@ -228,7 +228,7 @@ uint8_t Temperature::soft_pwm_amount[HOTENDS];
#if HAS_PID_HEATING
inline void say_default_() { SERIAL_PROTOCOLPGM("#define DEFAULT_"); }
inline void say_default_() { SERIAL_ECHOPGM("#define DEFAULT_"); }
/**
* PID Autotuning (M303)
@ -343,37 +343,37 @@ 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_PROTOCOLPAIR(MSG_BIAS, bias);
SERIAL_PROTOCOLPAIR(MSG_D, d);
SERIAL_PROTOCOLPAIR(MSG_T_MIN, min);
SERIAL_PROTOCOLPAIR(MSG_T_MAX, max);
SERIAL_ECHOPAIR(MSG_BIAS, bias);
SERIAL_ECHOPAIR(MSG_D, d);
SERIAL_ECHOPAIR(MSG_T_MIN, min);
SERIAL_ECHOPAIR(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_PROTOCOLPAIR(MSG_KU, Ku);
SERIAL_PROTOCOLPAIR(MSG_TU, Tu);
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_PROTOCOLLNPGM("\n" MSG_CLASSIC_PID);
SERIAL_PROTOCOLPAIR(MSG_KP, tune_pid.Kp);
SERIAL_PROTOCOLPAIR(MSG_KI, tune_pid.Ki);
SERIAL_PROTOCOLLNPAIR(MSG_KD, tune_pid.Kd);
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);
/**
tune_pid.Kp = 0.33*Ku;
tune_pid.Ki = tune_pid.Kp/Tu;
tune_pid.Kd = tune_pid.Kp*Tu/3;
SERIAL_PROTOCOLLNPGM(" Some overshoot");
SERIAL_PROTOCOLPAIR(" Kp: ", tune_pid.Kp);
SERIAL_PROTOCOLPAIR(" Ki: ", tune_pid.Ki);
SERIAL_PROTOCOLPAIR(" Kd: ", tune_pid.Kd);
SERIAL_ECHOLNPGM(" Some overshoot");
SERIAL_ECHOPAIR(" Kp: ", tune_pid.Kp);
SERIAL_ECHOPAIR(" Ki: ", tune_pid.Ki);
SERIAL_ECHOPAIR(" Kd: ", tune_pid.Kd);
tune_pid.Kp = 0.2*Ku;
tune_pid.Ki = 2*tune_pid.Kp/Tu;
tune_pid.Kd = tune_pid.Kp*Tu/3;
SERIAL_PROTOCOLLNPGM(" No overshoot");
SERIAL_PROTOCOLPAIR(" Kp: ", tune_pid.Kp);
SERIAL_PROTOCOLPAIR(" Ki: ", tune_pid.Ki);
SERIAL_PROTOCOLPAIR(" Kd: ", tune_pid.Kd);
SERIAL_ECHOLNPGM(" No overshoot");
SERIAL_ECHOPAIR(" Kp: ", tune_pid.Kp);
SERIAL_ECHOPAIR(" Ki: ", tune_pid.Ki);
SERIAL_ECHOPAIR(" Kd: ", tune_pid.Kd);
*/
}
}
@ -389,7 +389,7 @@ uint8_t Temperature::soft_pwm_amount[HOTENDS];
#define MAX_OVERSHOOT_PID_AUTOTUNE 20
#endif
if (current > target + MAX_OVERSHOOT_PID_AUTOTUNE) {
SERIAL_PROTOCOLLNPGM(MSG_PID_TEMP_TOO_HIGH);
SERIAL_ECHOLNPGM(MSG_PID_TEMP_TOO_HIGH);
break;
}
@ -432,26 +432,26 @@ uint8_t Temperature::soft_pwm_amount[HOTENDS];
#define MAX_CYCLE_TIME_PID_AUTOTUNE 20L
#endif
if (((ms - t1) + (ms - t2)) > (MAX_CYCLE_TIME_PID_AUTOTUNE * 60L * 1000L)) {
SERIAL_PROTOCOLLNPGM(MSG_PID_TIMEOUT);
SERIAL_ECHOLNPGM(MSG_PID_TIMEOUT);
break;
}
if (cycles > ncycles) {
SERIAL_PROTOCOLLNPGM(MSG_PID_AUTOTUNE_FINISHED);
SERIAL_ECHOLNPGM(MSG_PID_AUTOTUNE_FINISHED);
#if HAS_PID_FOR_BOTH
const char * const estring = GHV(PSTR("bed"), PSTR(""));
say_default_(); serialprintPGM(estring); SERIAL_PROTOCOLLNPAIR("Kp ", tune_pid.Kp);
say_default_(); serialprintPGM(estring); SERIAL_PROTOCOLLNPAIR("Ki ", tune_pid.Ki);
say_default_(); serialprintPGM(estring); SERIAL_PROTOCOLLNPAIR("Kd ", tune_pid.Kd);
say_default_(); serialprintPGM(estring); SERIAL_ECHOLNPAIR("Kp ", tune_pid.Kp);
say_default_(); serialprintPGM(estring); SERIAL_ECHOLNPAIR("Ki ", tune_pid.Ki);
say_default_(); serialprintPGM(estring); SERIAL_ECHOLNPAIR("Kd ", tune_pid.Kd);
#elif ENABLED(PIDTEMP)
say_default_(); SERIAL_PROTOCOLLNPAIR("Kp ", tune_pid.Kp);
say_default_(); SERIAL_PROTOCOLLNPAIR("Ki ", tune_pid.Ki);
say_default_(); SERIAL_PROTOCOLLNPAIR("Kd ", tune_pid.Kd);
say_default_(); SERIAL_ECHOLNPAIR("Kp ", tune_pid.Kp);
say_default_(); SERIAL_ECHOLNPAIR("Ki ", tune_pid.Ki);
say_default_(); SERIAL_ECHOLNPAIR("Kd ", tune_pid.Kd);
#else
say_default_(); SERIAL_PROTOCOLLNPAIR("bedKp ", tune_pid.Kp);
say_default_(); SERIAL_PROTOCOLLNPAIR("bedKi ", tune_pid.Ki);
say_default_(); SERIAL_PROTOCOLLNPAIR("bedKd ", tune_pid.Kd);
say_default_(); SERIAL_ECHOLNPAIR("bedKp ", tune_pid.Kp);
say_default_(); SERIAL_ECHOLNPAIR("bedKi ", tune_pid.Ki);
say_default_(); SERIAL_ECHOLNPAIR("bedKd ", tune_pid.Kd);
#endif
#define _SET_BED_PID() do { \
@ -564,8 +564,8 @@ void Temperature::_temp_error(const int8_t heater, PGM_P const serial_msg, PGM_P
if (IsRunning()) {
SERIAL_ERROR_START();
serialprintPGM(serial_msg);
SERIAL_ERRORPGM(MSG_STOPPED_HEATER);
if (heater >= 0) SERIAL_ERRORLN((int)heater); else SERIAL_ERRORLNPGM(MSG_HEATER_BED);
SERIAL_ECHOPGM(MSG_STOPPED_HEATER);
if (heater >= 0) SERIAL_ECHOLN((int)heater); else SERIAL_ECHOLNPGM(MSG_HEATER_BED);
}
#if DISABLED(BOGUS_TEMPERATURE_FAILSAFE_OVERRIDE)
if (!killed) {
@ -940,8 +940,8 @@ float Temperature::analog_to_celsius_hotend(const int raw, const uint8_t e) {
#endif
{
SERIAL_ERROR_START();
SERIAL_ERROR((int)e);
SERIAL_ERRORLNPGM(MSG_INVALID_EXTRUDER_NUM);
SERIAL_ECHO((int)e);
SERIAL_ECHOLNPGM(MSG_INVALID_EXTRUDER_NUM);
kill();
return 0.0;
}
@ -1684,17 +1684,17 @@ void Temperature::disable_all_heaters() {
if (max6675_temp & MAX6675_ERROR_MASK) {
SERIAL_ERROR_START();
SERIAL_ERRORPGM("Temp measurement error! ");
SERIAL_ECHOPGM("Temp measurement error! ");
#if MAX6675_ERROR_MASK == 7
SERIAL_ERRORPGM("MAX31855 ");
SERIAL_ECHOPGM("MAX31855 ");
if (max6675_temp & 1)
SERIAL_ERRORLNPGM("Open Circuit");
SERIAL_ECHOLNPGM("Open Circuit");
else if (max6675_temp & 2)
SERIAL_ERRORLNPGM("Short to GND");
SERIAL_ECHOLNPGM("Short to GND");
else if (max6675_temp & 4)
SERIAL_ERRORLNPGM("Short to VCC");
SERIAL_ECHOLNPGM("Short to VCC");
#else
SERIAL_ERRORLNPGM("MAX6675");
SERIAL_ECHOLNPGM("MAX6675");
#endif
// Thermocouple open
@ -2365,8 +2365,8 @@ void Temperature::isr() {
UNUSED(e);
#endif
SERIAL_PROTOCOLCHAR_P(port, ' ');
SERIAL_PROTOCOLCHAR_P(port,
SERIAL_CHAR_P(port, ' ');
SERIAL_CHAR_P(port,
#if HAS_TEMP_CHAMBER && HAS_HEATED_BED && HAS_TEMP_HOTEND
e == -2 ? 'C' : e == -1 ? 'B' : 'T'
#elif HAS_HEATED_BED && HAS_TEMP_HOTEND
@ -2378,14 +2378,14 @@ void Temperature::isr() {
#endif
);
#if HOTENDS > 1
if (e >= 0) SERIAL_PROTOCOLCHAR_P(port, '0' + e);
if (e >= 0) SERIAL_CHAR_P(port, '0' + e);
#endif
SERIAL_PROTOCOLCHAR_P(port, ':');
SERIAL_PROTOCOL_P(port, c);
SERIAL_PROTOCOLPAIR_P(port, " /" , t);
SERIAL_CHAR_P(port, ':');
SERIAL_ECHO_P(port, c);
SERIAL_ECHOPAIR_P(port, " /" , t);
#if ENABLED(SHOW_TEMP_ADC_VALUES)
SERIAL_PROTOCOLPAIR_P(port, " (", r / OVERSAMPLENR);
SERIAL_PROTOCOLCHAR_P(port, ')');
SERIAL_ECHOPAIR_P(port, " (", r / OVERSAMPLENR);
SERIAL_CHAR_P(port, ')');
#endif
delay(2);
}
@ -2435,17 +2435,17 @@ void Temperature::isr() {
, e
);
#endif
SERIAL_PROTOCOLPGM_P(port, " @:");
SERIAL_PROTOCOL_P(port, getHeaterPower(target_extruder));
SERIAL_ECHOPGM_P(port, " @:");
SERIAL_ECHO_P(port, getHeaterPower(target_extruder));
#if HAS_HEATED_BED
SERIAL_PROTOCOLPGM_P(port, " B@:");
SERIAL_PROTOCOL_P(port, getHeaterPower(-1));
SERIAL_ECHOPGM_P(port, " B@:");
SERIAL_ECHO_P(port, getHeaterPower(-1));
#endif
#if HOTENDS > 1
HOTEND_LOOP() {
SERIAL_PROTOCOLPAIR_P(port, " @", e);
SERIAL_PROTOCOLCHAR_P(port, ':');
SERIAL_PROTOCOL_P(port, getHeaterPower(e));
SERIAL_ECHOPAIR_P(port, " @", e);
SERIAL_CHAR_P(port, ':');
SERIAL_ECHO_P(port, getHeaterPower(e));
}
#endif
}
@ -2528,11 +2528,11 @@ void Temperature::isr() {
next_temp_ms = now + 1000UL;
print_heater_states(target_extruder);
#if TEMP_RESIDENCY_TIME > 0
SERIAL_PROTOCOLPGM(" W:");
SERIAL_ECHOPGM(" W:");
if (residency_start_ms)
SERIAL_PROTOCOL(long((((TEMP_RESIDENCY_TIME) * 1000UL) - (now - residency_start_ms)) / 1000UL));
SERIAL_ECHO(long((((TEMP_RESIDENCY_TIME) * 1000UL) - (now - residency_start_ms)) / 1000UL));
else
SERIAL_PROTOCOLCHAR('?');
SERIAL_CHAR('?');
#endif
SERIAL_EOL();
}
@ -2651,11 +2651,11 @@ void Temperature::isr() {
next_temp_ms = now + 1000UL;
print_heater_states(active_extruder);
#if TEMP_BED_RESIDENCY_TIME > 0
SERIAL_PROTOCOLPGM(" W:");
SERIAL_ECHOPGM(" W:");
if (residency_start_ms)
SERIAL_PROTOCOL(long((((TEMP_BED_RESIDENCY_TIME) * 1000UL) - (now - residency_start_ms)) / 1000UL));
SERIAL_ECHO(long((((TEMP_BED_RESIDENCY_TIME) * 1000UL) - (now - residency_start_ms)) / 1000UL));
else
SERIAL_PROTOCOLCHAR('?');
SERIAL_CHAR('?');
#endif
SERIAL_EOL();
}