Use a STR_ prefix for non-translated strings

This commit is contained in:
Scott Lahteine
2020-02-26 03:02:03 -06:00
parent 6b9a17be16
commit e78f607ef3
65 changed files with 438 additions and 431 deletions

View File

@ -386,7 +386,7 @@ void Endstops::event_handler() {
#define ENDSTOP_HIT_TEST_Z() _ENDSTOP_HIT_TEST(Z,'Z')
SERIAL_ECHO_START();
SERIAL_ECHOPGM(MSG_ENDSTOPS_HIT);
SERIAL_ECHOPGM(STR_ENDSTOPS_HIT);
ENDSTOP_HIT_TEST_X();
ENDSTOP_HIT_TEST_Y();
ENDSTOP_HIT_TEST_Z();
@ -415,7 +415,7 @@ void Endstops::event_handler() {
static void print_es_state(const bool is_hit, PGM_P const label=nullptr) {
if (label) serialprintPGM(label);
SERIAL_ECHOPGM(": ");
serialprintPGM(is_hit ? PSTR(MSG_ENDSTOP_HIT) : PSTR(MSG_ENDSTOP_OPEN));
serialprintPGM(is_hit ? PSTR(STR_ENDSTOP_HIT) : PSTR(STR_ENDSTOP_OPEN));
SERIAL_EOL();
}
@ -423,7 +423,7 @@ void _O2 Endstops::report_states() {
#if ENABLED(BLTOUCH)
bltouch._set_SW_mode();
#endif
SERIAL_ECHOLNPGM(MSG_M119_REPORT);
SERIAL_ECHOLNPGM(STR_M119_REPORT);
#define ES_REPORT(S) print_es_state(READ(S##_PIN) != S##_ENDSTOP_INVERTING, PSTR(MSG_##S))
#if HAS_X_MIN
ES_REPORT(X_MIN);
@ -474,11 +474,11 @@ void _O2 Endstops::report_states() {
ES_REPORT(Z4_MAX);
#endif
#if HAS_CUSTOM_PROBE_PIN
print_es_state(READ(Z_MIN_PROBE_PIN) != Z_MIN_PROBE_ENDSTOP_INVERTING, PSTR(MSG_Z_PROBE));
print_es_state(READ(Z_MIN_PROBE_PIN) != Z_MIN_PROBE_ENDSTOP_INVERTING, PSTR(STR_Z_PROBE));
#endif
#if HAS_FILAMENT_SENSOR
#if NUM_RUNOUT_SENSORS == 1
print_es_state(READ(FIL_RUNOUT_PIN) != FIL_RUNOUT_INVERTING, PSTR(MSG_FILAMENT_RUNOUT_SENSOR));
print_es_state(READ(FIL_RUNOUT_PIN) != FIL_RUNOUT_INVERTING, PSTR(STR_FILAMENT_RUNOUT_SENSOR));
#else
#define _CASE_RUNOUT(N) case N: pin = FIL_RUNOUT##N##_PIN; break;
for (uint8_t i = 1; i <= NUM_RUNOUT_SENSORS; i++) {
@ -487,7 +487,7 @@ void _O2 Endstops::report_states() {
default: continue;
REPEAT_S(1, INCREMENT(NUM_RUNOUT_SENSORS), _CASE_RUNOUT)
}
SERIAL_ECHOPGM(MSG_FILAMENT_RUNOUT_SENSOR);
SERIAL_ECHOPGM(STR_FILAMENT_RUNOUT_SENSOR);
if (i > 1) SERIAL_CHAR(' ', '0' + i);
print_es_state(extDigitalRead(pin) != FIL_RUNOUT_INVERTING);
}

View File

@ -1018,7 +1018,7 @@ void prepare_move_to_destination() {
#if ENABLED(PREVENT_COLD_EXTRUSION)
ignore_e = thermalManager.tooColdToExtrude(active_extruder);
if (ignore_e) SERIAL_ECHO_MSG(MSG_ERR_COLD_EXTRUDE_STOP);
if (ignore_e) SERIAL_ECHO_MSG(STR_ERR_COLD_EXTRUDE_STOP);
#endif
#if ENABLED(PREVENT_LENGTHY_EXTRUDE)
@ -1030,13 +1030,13 @@ void prepare_move_to_destination() {
MIXER_STEPPER_LOOP(e) {
if (e_delta * collector[e] > (EXTRUDE_MAXLENGTH)) {
ignore_e = true;
SERIAL_ECHO_MSG(MSG_ERR_LONG_EXTRUDE_STOP);
SERIAL_ECHO_MSG(STR_ERR_LONG_EXTRUDE_STOP);
break;
}
}
#else
ignore_e = true;
SERIAL_ECHO_MSG(MSG_ERR_LONG_EXTRUDE_STOP);
SERIAL_ECHO_MSG(STR_ERR_LONG_EXTRUDE_STOP);
#endif
}
#endif

View File

@ -1748,7 +1748,7 @@ bool Planner::_populate_block(block_t * const block, bool split_move,
position_float.e = target_float.e;
#endif
de = 0; // no difference
SERIAL_ECHO_MSG(MSG_ERR_COLD_EXTRUDE_STOP);
SERIAL_ECHO_MSG(STR_ERR_COLD_EXTRUDE_STOP);
}
#endif // PREVENT_COLD_EXTRUSION
#if ENABLED(PREVENT_LENGTHY_EXTRUDE)
@ -1770,7 +1770,7 @@ bool Planner::_populate_block(block_t * const block, bool split_move,
position_float.e = target_float.e;
#endif
de = 0; // no difference
SERIAL_ECHO_MSG(MSG_ERR_LONG_EXTRUDE_STOP);
SERIAL_ECHO_MSG(STR_ERR_LONG_EXTRUDE_STOP);
}
}
#endif // PREVENT_LENGTHY_EXTRUDE

View File

@ -183,7 +183,7 @@ void PrintCounter::saveStats() {
#if HAS_SERVICE_INTERVALS
inline void _service_when(char buffer[], const char * const msg, const uint32_t when) {
SERIAL_ECHOPGM(MSG_STATS);
SERIAL_ECHOPGM(STR_STATS);
serialprintPGM(msg);
SERIAL_ECHOLNPAIR(" in ", duration_t(when).toString(buffer));
}
@ -192,7 +192,7 @@ void PrintCounter::saveStats() {
void PrintCounter::showStats() {
char buffer[21];
SERIAL_ECHOPGM(MSG_STATS);
SERIAL_ECHOPGM(STR_STATS);
SERIAL_ECHOLNPAIR(
"Prints: ", data.totalPrints,
", Finished: ", data.finishedPrints,
@ -200,7 +200,7 @@ void PrintCounter::showStats() {
- ((isRunning() || isPaused()) ? 1 : 0) // Remove 1 from failures with an active counter
);
SERIAL_ECHOPGM(MSG_STATS);
SERIAL_ECHOPGM(STR_STATS);
duration_t elapsed = data.printTime;
elapsed.toString(buffer);
SERIAL_ECHOPAIR("Total time: ", buffer);
@ -217,7 +217,7 @@ void PrintCounter::showStats() {
SERIAL_CHAR(')');
#endif
SERIAL_ECHOPAIR("\n" MSG_STATS "Filament used: ", data.filamentUsed / 1000);
SERIAL_ECHOPAIR("\n" STR_STATS "Filament used: ", data.filamentUsed / 1000);
SERIAL_CHAR('m');
SERIAL_EOL();

View File

@ -392,7 +392,7 @@ bool Probe::set_deployed(const bool deploy) {
_BV(X_AXIS)
#endif
)) {
SERIAL_ERROR_MSG(MSG_STOP_UNHOMED);
SERIAL_ERROR_MSG(STR_STOP_UNHOMED);
stop();
return true;
}
@ -771,7 +771,7 @@ float Probe::probe_at_point(const float &rx, const float &ry, const ProbePtRaise
if (isnan(measured_z)) {
stow();
LCD_MESSAGEPGM(MSG_LCD_PROBING_FAILED);
SERIAL_ERROR_MSG(MSG_ERR_PROBING_FAILED);
SERIAL_ERROR_MSG(STR_ERR_PROBING_FAILED);
}
if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("<<< Probe::probe_at_point");

View File

@ -2462,9 +2462,9 @@ void Stepper::report_positions() {
#endif
#if CORE_IS_XY || CORE_IS_XZ || ENABLED(DELTA) || IS_SCARA
SERIAL_ECHOPAIR(MSG_COUNT_A, pos.x, " B:", pos.y);
SERIAL_ECHOPAIR(STR_COUNT_A, pos.x, " B:", pos.y);
#else
SERIAL_ECHOPAIR(MSG_COUNT_X, pos.x, " Y:", pos.y);
SERIAL_ECHOPAIR(STR_COUNT_X, pos.x, " Y:", pos.y);
#endif
#if CORE_IS_XZ || CORE_IS_YZ || ENABLED(DELTA)
SERIAL_ECHOLNPAIR(" C:", pos.z);

View File

@ -111,6 +111,9 @@
Temperature thermalManager;
const char str_t_thermal_runaway[] PROGMEM = STR_T_THERMAL_RUNAWAY,
str_t_heating_failed[] PROGMEM = STR_T_HEATING_FAILED;
/**
* Macros to include the heater id in temp errors. The compiler's dead-code
* elimination should (hopefully) optimize out the unused strings.
@ -404,14 +407,14 @@ volatile bool Temperature::raw_temps_ready = false;
#endif
if (target > GHV(BED_MAXTEMP - 10, temp_range[heater].maxtemp - 15)) {
SERIAL_ECHOLNPGM(MSG_PID_TEMP_TOO_HIGH);
SERIAL_ECHOLNPGM(STR_PID_TEMP_TOO_HIGH);
#if ENABLED(EXTENSIBLE_UI)
ExtUI::OnPidTuning(ExtUI::result_t::PID_TEMP_TOO_HIGH);
#endif
return;
}
SERIAL_ECHOLNPGM(MSG_PID_AUTOTUNE_START);
SERIAL_ECHOLNPGM(STR_PID_AUTOTUNE_START);
disable_all_heaters();
@ -472,27 +475,27 @@ volatile bool Temperature::raw_temps_ready = false;
LIMIT(bias, 20, max_pow - 20);
d = (bias > max_pow >> 1) ? max_pow - 1 - bias : bias;
SERIAL_ECHOPAIR(MSG_BIAS, bias, MSG_D, d, MSG_T_MIN, minT, MSG_T_MAX, maxT);
SERIAL_ECHOPAIR(STR_BIAS, bias, STR_D_COLON, d, STR_T_MIN, minT, STR_T_MAX, maxT);
if (cycles > 2) {
const float Ku = (4.0f * d) / (float(M_PI) * (maxT - minT) * 0.5f),
Tu = float(t_low + t_high) * 0.001f,
pf = isbed ? 0.2f : 0.6f,
df = isbed ? 1.0f / 3.0f : 1.0f / 8.0f;
SERIAL_ECHOPAIR(MSG_KU, Ku, MSG_TU, Tu);
SERIAL_ECHOPAIR(STR_KU, Ku, STR_TU, Tu);
if (isbed) { // Do not remove this otherwise PID autotune won't work right for the bed!
tune_pid.Kp = Ku * 0.2f;
tune_pid.Ki = 2 * tune_pid.Kp / Tu;
tune_pid.Kd = tune_pid.Kp * Tu / 3;
SERIAL_ECHOLNPGM("\n" " No overshoot"); // Works far better for the bed. Classic and some have bad ringing.
SERIAL_ECHOLNPAIR(MSG_KP, tune_pid.Kp, MSG_KI, tune_pid.Ki, MSG_KD, tune_pid.Kd);
SERIAL_ECHOLNPAIR(STR_KP, tune_pid.Kp, STR_KI, tune_pid.Ki, STR_KD, tune_pid.Kd);
}
else {
tune_pid.Kp = Ku * pf;
tune_pid.Kd = tune_pid.Kp * Tu * df;
tune_pid.Ki = 2 * tune_pid.Kp / Tu;
SERIAL_ECHOLNPGM("\n" MSG_CLASSIC_PID);
SERIAL_ECHOLNPAIR(MSG_KP, tune_pid.Kp, MSG_KI, tune_pid.Ki, MSG_KD, tune_pid.Kd);
SERIAL_ECHOLNPGM("\n" STR_CLASSIC_PID);
SERIAL_ECHOLNPAIR(STR_KP, tune_pid.Kp, STR_KI, tune_pid.Ki, STR_KD, tune_pid.Kd);
}
/**
@ -520,7 +523,7 @@ volatile bool Temperature::raw_temps_ready = false;
#define MAX_OVERSHOOT_PID_AUTOTUNE 30
#endif
if (current_temp > target + MAX_OVERSHOOT_PID_AUTOTUNE) {
SERIAL_ECHOLNPGM(MSG_PID_TEMP_TOO_HIGH);
SERIAL_ECHOLNPGM(STR_PID_TEMP_TOO_HIGH);
#if ENABLED(EXTENSIBLE_UI)
ExtUI::OnPidTuning(ExtUI::result_t::PID_TEMP_TOO_HIGH);
#endif
@ -553,10 +556,10 @@ volatile bool Temperature::raw_temps_ready = false;
if (current_temp > watch_temp_target) heated = true; // - Flag if target temperature reached
}
else if (ELAPSED(ms, temp_change_ms)) // Watch timer expired
_temp_error(heater, PSTR(MSG_T_HEATING_FAILED), GET_TEXT(MSG_HEATING_FAILED_LCD));
_temp_error(heater, str_t_heating_failed, GET_TEXT(MSG_HEATING_FAILED_LCD));
}
else if (current_temp < target - (MAX_OVERSHOOT_PID_AUTOTUNE)) // Heated, then temperature fell too far?
_temp_error(heater, PSTR(MSG_T_THERMAL_RUNAWAY), GET_TEXT(MSG_THERMAL_RUNAWAY));
_temp_error(heater, str_t_thermal_runaway, GET_TEXT(MSG_THERMAL_RUNAWAY));
}
#endif
} // every 2 seconds
@ -569,12 +572,12 @@ volatile bool Temperature::raw_temps_ready = false;
#if ENABLED(EXTENSIBLE_UI)
ExtUI::OnPidTuning(ExtUI::result_t::PID_TUNING_TIMEOUT);
#endif
SERIAL_ECHOLNPGM(MSG_PID_TIMEOUT);
SERIAL_ECHOLNPGM(STR_PID_TIMEOUT);
break;
}
if (cycles > ncycles && cycles > 2) {
SERIAL_ECHOLNPGM(MSG_PID_AUTOTUNE_FINISHED);
SERIAL_ECHOLNPGM(STR_PID_AUTOTUNE_FINISHED);
#if HAS_PID_FOR_BOTH
const char * const estring = GHV(PSTR("bed"), NUL_STR);
@ -782,12 +785,12 @@ void Temperature::_temp_error(const heater_ind_t heater, PGM_P const serial_msg,
) {
SERIAL_ERROR_START();
serialprintPGM(serial_msg);
SERIAL_ECHOPGM(MSG_STOPPED_HEATER);
SERIAL_ECHOPGM(STR_STOPPED_HEATER);
if (heater >= 0) SERIAL_ECHO((int)heater);
#if HAS_HEATED_CHAMBER
else if (heater == H_CHAMBER) SERIAL_ECHOPGM(MSG_HEATER_CHAMBER);
else if (heater == H_CHAMBER) SERIAL_ECHOPGM(STR_HEATER_CHAMBER);
#endif
else SERIAL_ECHOPGM(MSG_HEATER_BED);
else SERIAL_ECHOPGM(STR_HEATER_BED);
SERIAL_EOL();
}
@ -817,11 +820,11 @@ void Temperature::_temp_error(const heater_ind_t heater, PGM_P const serial_msg,
}
void Temperature::max_temp_error(const heater_ind_t heater) {
_temp_error(heater, PSTR(MSG_T_MAXTEMP), GET_TEXT(MSG_ERR_MAXTEMP));
_temp_error(heater, PSTR(STR_T_MAXTEMP), GET_TEXT(MSG_ERR_MAXTEMP));
}
void Temperature::min_temp_error(const heater_ind_t heater) {
_temp_error(heater, PSTR(MSG_T_MINTEMP), GET_TEXT(MSG_ERR_MINTEMP));
_temp_error(heater, PSTR(STR_T_MINTEMP), GET_TEXT(MSG_ERR_MINTEMP));
}
#if HOTENDS
@ -909,18 +912,18 @@ void Temperature::min_temp_error(const heater_ind_t heater) {
if (ee == active_extruder) {
SERIAL_ECHO_START();
SERIAL_ECHOPAIR(
MSG_PID_DEBUG, ee,
MSG_PID_DEBUG_INPUT, temp_hotend[ee].celsius,
MSG_PID_DEBUG_OUTPUT, pid_output
STR_PID_DEBUG, ee,
STR_PID_DEBUG_INPUT, temp_hotend[ee].celsius,
STR_PID_DEBUG_OUTPUT, pid_output
);
#if DISABLED(PID_OPENLOOP)
{
SERIAL_ECHOPAIR(
MSG_PID_DEBUG_PTERM, work_pid[ee].Kp,
MSG_PID_DEBUG_ITERM, work_pid[ee].Ki,
MSG_PID_DEBUG_DTERM, work_pid[ee].Kd
STR_PID_DEBUG_PTERM, work_pid[ee].Kp,
STR_PID_DEBUG_ITERM, work_pid[ee].Ki,
STR_PID_DEBUG_DTERM, work_pid[ee].Kd
#if ENABLED(PID_EXTRUSION_SCALING)
, MSG_PID_DEBUG_CTERM, work_pid[ee].Kc
, STR_PID_DEBUG_CTERM, work_pid[ee].Kc
#endif
);
}
@ -996,9 +999,9 @@ void Temperature::min_temp_error(const heater_ind_t heater) {
SERIAL_ECHOLNPAIR(
" PID_BED_DEBUG : Input ", temp_bed.celsius, " 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,
STR_PID_DEBUG_PTERM, work_pid.Kp,
STR_PID_DEBUG_ITERM, work_pid.Ki,
STR_PID_DEBUG_DTERM, work_pid.Kd,
#endif
);
}
@ -1054,7 +1057,7 @@ void Temperature::manage_heater() {
HOTEND_LOOP() {
#if ENABLED(THERMAL_PROTECTION_HOTENDS)
if (degHotend(e) > temp_range[e].maxtemp)
_temp_error((heater_ind_t)e, PSTR(MSG_T_THERMAL_RUNAWAY), GET_TEXT(MSG_THERMAL_RUNAWAY));
_temp_error((heater_ind_t)e, str_t_thermal_runaway, GET_TEXT(MSG_THERMAL_RUNAWAY));
#endif
#if HEATER_IDLE_HANDLER
@ -1072,7 +1075,7 @@ void Temperature::manage_heater() {
// Make sure temperature is increasing
if (watch_hotend[e].next_ms && ELAPSED(ms, watch_hotend[e].next_ms)) { // Time to check this extruder?
if (degHotend(e) < watch_hotend[e].target) // Failed to increase enough?
_temp_error((heater_ind_t)e, PSTR(MSG_T_HEATING_FAILED), GET_TEXT(MSG_HEATING_FAILED_LCD));
_temp_error((heater_ind_t)e, str_t_heating_failed, GET_TEXT(MSG_HEATING_FAILED_LCD));
else // Start again if the target is still far off
start_watching_hotend(e);
}
@ -1081,7 +1084,7 @@ void Temperature::manage_heater() {
#if ENABLED(TEMP_SENSOR_1_AS_REDUNDANT)
// Make sure measured temperatures are close together
if (ABS(temp_hotend[0].celsius - redundant_temperature) > MAX_REDUNDANT_TEMP_SENSOR_DIFF)
_temp_error(H_E0, PSTR(MSG_REDUNDANCY), GET_TEXT(MSG_ERR_REDUNDANT_TEMP));
_temp_error(H_E0, PSTR(STR_REDUNDANCY), GET_TEXT(MSG_ERR_REDUNDANT_TEMP));
#endif
} // HOTEND_LOOP
@ -1107,14 +1110,14 @@ void Temperature::manage_heater() {
#if ENABLED(THERMAL_PROTECTION_BED)
if (degBed() > BED_MAXTEMP)
_temp_error(H_BED, PSTR(MSG_T_THERMAL_RUNAWAY), GET_TEXT(MSG_THERMAL_RUNAWAY));
_temp_error(H_BED, str_t_thermal_runaway, GET_TEXT(MSG_THERMAL_RUNAWAY));
#endif
#if WATCH_BED
// Make sure temperature is increasing
if (watch_bed.elapsed(ms)) { // Time to check the bed?
if (degBed() < watch_bed.target) // Failed to increase enough?
_temp_error(H_BED, PSTR(MSG_T_HEATING_FAILED), GET_TEXT(MSG_HEATING_FAILED_LCD));
_temp_error(H_BED, str_t_heating_failed, GET_TEXT(MSG_HEATING_FAILED_LCD));
else // Start again if the target is still far off
start_watching_bed();
}
@ -1185,14 +1188,14 @@ void Temperature::manage_heater() {
#if ENABLED(THERMAL_PROTECTION_CHAMBER)
if (degChamber() > CHAMBER_MAXTEMP)
_temp_error(H_CHAMBER, PSTR(MSG_T_THERMAL_RUNAWAY), GET_TEXT(MSG_THERMAL_RUNAWAY));
_temp_error(H_CHAMBER, str_t_thermal_runaway, GET_TEXT(MSG_THERMAL_RUNAWAY));
#endif
#if WATCH_CHAMBER
// Make sure temperature is increasing
if (watch_chamber.elapsed(ms)) { // Time to check the chamber?
if (degChamber() < watch_chamber.target) // Failed to increase enough?
_temp_error(H_CHAMBER, PSTR(MSG_T_HEATING_FAILED), GET_TEXT(MSG_HEATING_FAILED_LCD));
_temp_error(H_CHAMBER, str_t_heating_failed, GET_TEXT(MSG_HEATING_FAILED_LCD));
else
start_watching_chamber(); // Start again if the target is still far off
}
@ -1404,7 +1407,7 @@ void Temperature::manage_heater() {
{
SERIAL_ERROR_START();
SERIAL_ECHO((int)e);
SERIAL_ECHOLNPGM(MSG_INVALID_EXTRUDER_NUM);
SERIAL_ECHOLNPGM(STR_INVALID_EXTRUDER_NUM);
kill();
return 0;
}
@ -2067,7 +2070,7 @@ void Temperature::init() {
sm.state = TRRunaway;
case TRRunaway:
_temp_error(heater_id, PSTR(MSG_T_THERMAL_RUNAWAY), GET_TEXT(MSG_THERMAL_RUNAWAY));
_temp_error(heater_id, str_t_thermal_runaway, GET_TEXT(MSG_THERMAL_RUNAWAY));
}
}

View File

@ -700,7 +700,7 @@ inline void fast_line_to_current(const AxisEnum fr_axis) { _line_to_current(fr_a
inline void invalid_extruder_error(const uint8_t e) {
SERIAL_ECHO_START();
SERIAL_CHAR('T'); SERIAL_ECHO(int(e));
SERIAL_CHAR(' '); SERIAL_ECHOLNPGM(MSG_INVALID_EXTRUDER);
SERIAL_CHAR(' '); SERIAL_ECHOLNPGM(STR_INVALID_EXTRUDER);
}
#endif
@ -843,7 +843,7 @@ void tool_change(const uint8_t new_tool, bool no_move/*=false*/) {
#endif
if (should_swap) {
if (too_cold) {
SERIAL_ECHO_MSG(MSG_ERR_HOTEND_TOO_COLD);
SERIAL_ECHO_MSG(STR_ERR_HOTEND_TOO_COLD);
#if ENABLED(SINGLENOZZLE)
active_extruder = new_tool;
return;
@ -1073,7 +1073,7 @@ void tool_change(const uint8_t new_tool, bool no_move/*=false*/) {
#endif
SERIAL_ECHO_START();
SERIAL_ECHOLNPAIR(MSG_ACTIVE_EXTRUDER, int(active_extruder));
SERIAL_ECHOLNPAIR(STR_ACTIVE_EXTRUDER, int(active_extruder));
#endif // EXTRUDERS > 1
}