Multi-language support (#15453)

This commit is contained in:
Marcio Teixeira
2019-10-09 18:46:10 -06:00
committed by Scott Lahteine
parent dc14d4a13c
commit 6a865a6146
105 changed files with 11537 additions and 11196 deletions

View File

@ -302,7 +302,7 @@ void Endstops::not_homing() {
// If the last move failed to trigger an endstop, call kill
void Endstops::validate_homing_move() {
if (trigger_state()) hit_on_purpose();
else kill(PSTR(MSG_ERR_HOMING_FAILED));
else kill(GET_TEXT(MSG_LCD_HOMING_FAILED));
}
#endif
@ -373,7 +373,7 @@ void Endstops::event_handler() {
SERIAL_EOL();
#if HAS_SPI_LCD
ui.status_printf_P(0, PSTR(S_FMT " %c %c %c %c"), PSTR(MSG_LCD_ENDSTOPS), chrX, chrY, chrZ, chrP);
ui.status_printf_P(0, PSTR(S_FMT " %c %c %c %c"), GET_TEXT(MSG_LCD_ENDSTOPS), chrX, chrY, chrZ, chrP);
#endif
#if BOTH(SD_ABORT_ON_ENDSTOP_HIT, SDSUPPORT)

View File

@ -1053,8 +1053,8 @@ uint8_t axes_need_homing(uint8_t axis_bits/*=0x07*/) {
bool axis_unhomed_error(uint8_t axis_bits/*=0x07*/) {
if ((axis_bits = axes_need_homing(axis_bits))) {
static const char home_first[] PROGMEM = MSG_HOME_FIRST;
char msg[sizeof(home_first)];
PGM_P home_first = GET_TEXT(MSG_HOME_FIRST);
char msg[strlen_P(home_first)+1];
sprintf_P(msg, home_first,
TEST(axis_bits, X_AXIS) ? "X" : "",
TEST(axis_bits, Y_AXIS) ? "Y" : "",

View File

@ -281,7 +281,7 @@ FORCE_INLINE void probe_specific_action(const bool deploy) {
BUZZ(100, 659);
BUZZ(100, 698);
PGM_P const ds_str = deploy ? PSTR(MSG_MANUAL_DEPLOY) : PSTR(MSG_MANUAL_STOW);
PGM_P const ds_str = deploy ? GET_TEXT(MSG_MANUAL_DEPLOY) : GET_TEXT(MSG_MANUAL_STOW);
ui.return_to_status(); // To display the new status message
ui.set_status_P(ds_str, 99);
serialprintPGM(ds_str);
@ -293,7 +293,7 @@ FORCE_INLINE void probe_specific_action(const bool deploy) {
host_prompt_do(PROMPT_USER_CONTINUE, PSTR("Stow Probe"), PSTR("Continue"));
#endif
#if ENABLED(EXTENSIBLE_UI)
ExtUI::onUserConfirmRequired(PSTR("Stow Probe"));
ExtUI::onUserConfirmRequired_P(PSTR("Stow Probe"));
#endif
while (wait_for_user) idle();
ui.reset_status();
@ -406,7 +406,7 @@ bool set_probe_deployed(const bool deploy) {
if (PROBE_STOWED() == deploy) { // Unchanged after deploy/stow action?
if (IsRunning()) {
SERIAL_ERROR_MSG("Z-Probe failed");
LCD_ALERTMESSAGEPGM("Err: ZPROBE");
LCD_ALERTMESSAGEPGM_P(PSTR("Err: ZPROBE"));
}
stop();
return true;
@ -736,7 +736,7 @@ float probe_at_point(const float &rx, const float &ry, const ProbePtRaise raise_
if (isnan(measured_z)) {
STOW_PROBE();
LCD_MESSAGEPGM(MSG_ERR_PROBING_FAILED);
LCD_MESSAGEPGM(MSG_LCD_PROBING_FAILED);
SERIAL_ERROR_MSG(MSG_ERR_PROBING_FAILED);
}

View File

@ -94,17 +94,17 @@ Temperature thermalManager;
*/
#if HAS_HEATED_BED
#define _BED_PSTR(M,E) (E) == H_BED ? PSTR(M) :
#define _BED_PSTR(h) (h) == H_BED ? GET_TEXT(MSG_BED) :
#else
#define _BED_PSTR(M,E)
#define _BED_PSTR(h)
#endif
#if HAS_HEATED_CHAMBER
#define _CHAMBER_PSTR(M,E) (E) == H_CHAMBER ? PSTR(M) :
#define _CHAMBER_PSTR(h) (h) == H_CHAMBER ? GET_TEXT(MSG_CHAMBER) :
#else
#define _CHAMBER_PSTR(M,E)
#define _CHAMBER_PSTR(h)
#endif
#define _E_PSTR(M,E,N) ((HOTENDS) > (N) && (E) == (N)) ? PSTR(LCD_STR_E##N " " M) :
#define TEMP_ERR_PSTR(M,E) _BED_PSTR(M##_BED,E) _CHAMBER_PSTR(M##_CHAMBER,E) _E_PSTR(M,E,1) _E_PSTR(M,E,2) _E_PSTR(M,E,3) _E_PSTR(M,E,4) _E_PSTR(M,E,5) PSTR(LCD_STR_E0 " " M)
#define _E_PSTR(h,N) ((HOTENDS) > N && (h) == N) ? PSTR(LCD_STR_E##N) :
#define HEATER_PSTR(h) _BED_PSTR(h) _CHAMBER_PSTR(h) _E_PSTR(h,1) _E_PSTR(h,2) _E_PSTR(h,3) _E_PSTR(h,4) _E_PSTR(h,5) PSTR(LCD_STR_E0)
// public:
@ -518,10 +518,10 @@ volatile bool Temperature::temp_meas_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), TEMP_ERR_PSTR(MSG_HEATING_FAILED_LCD, heater));
_temp_error(heater, PSTR(MSG_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), TEMP_ERR_PSTR(MSG_THERMAL_RUNAWAY, heater));
_temp_error(heater, PSTR(MSG_T_THERMAL_RUNAWAY), GET_TEXT(MSG_THERMAL_RUNAWAY));
}
#endif
} // every 2 seconds
@ -621,45 +621,34 @@ int16_t Temperature::getHeaterPower(const heater_ind_t heater_id) {
}
}
#define _EFANOVERLAP(A,B) _FANOVERLAP(E##A,B)
#if HAS_AUTO_FAN
#define AUTO_1_IS_0 (E1_AUTO_FAN_PIN == E0_AUTO_FAN_PIN)
#define AUTO_2_IS_0 (E2_AUTO_FAN_PIN == E0_AUTO_FAN_PIN)
#define AUTO_2_IS_1 (E2_AUTO_FAN_PIN == E1_AUTO_FAN_PIN)
#define AUTO_3_IS_0 (E3_AUTO_FAN_PIN == E0_AUTO_FAN_PIN)
#define AUTO_3_IS_1 (E3_AUTO_FAN_PIN == E1_AUTO_FAN_PIN)
#define AUTO_3_IS_2 (E3_AUTO_FAN_PIN == E2_AUTO_FAN_PIN)
#define AUTO_4_IS_0 (E4_AUTO_FAN_PIN == E0_AUTO_FAN_PIN)
#define AUTO_4_IS_1 (E4_AUTO_FAN_PIN == E1_AUTO_FAN_PIN)
#define AUTO_4_IS_2 (E4_AUTO_FAN_PIN == E2_AUTO_FAN_PIN)
#define AUTO_4_IS_3 (E4_AUTO_FAN_PIN == E3_AUTO_FAN_PIN)
#define AUTO_5_IS_0 (E5_AUTO_FAN_PIN == E0_AUTO_FAN_PIN)
#define AUTO_5_IS_1 (E5_AUTO_FAN_PIN == E1_AUTO_FAN_PIN)
#define AUTO_5_IS_2 (E5_AUTO_FAN_PIN == E2_AUTO_FAN_PIN)
#define AUTO_5_IS_3 (E5_AUTO_FAN_PIN == E3_AUTO_FAN_PIN)
#define AUTO_5_IS_4 (E5_AUTO_FAN_PIN == E4_AUTO_FAN_PIN)
#define CHAMBER_FAN_INDEX HOTENDS
void Temperature::checkExtruderAutoFans() {
#define _EFAN(A,B) _EFANOVERLAP(A,B) ? B :
static const uint8_t fanBit[] PROGMEM = {
0
#if HOTENDS > 1
, AUTO_1_IS_0 ? 0 : 1
, _EFAN(1,0) 1
#endif
#if HOTENDS > 2
, AUTO_2_IS_0 ? 0 : AUTO_2_IS_1 ? 1 : 2
, _EFAN(2,0) _EFAN(2,1) 2
#endif
#if HOTENDS > 3
, AUTO_3_IS_0 ? 0 : AUTO_3_IS_1 ? 1 : AUTO_3_IS_2 ? 2 : 3
, _EFAN(3,0) _EFAN(3,1) _EFAN(3,2) 3
#endif
#if HOTENDS > 4
, AUTO_4_IS_0 ? 0 : AUTO_4_IS_1 ? 1 : AUTO_4_IS_2 ? 2 : AUTO_4_IS_3 ? 3 : 4
, _EFAN(4,0) _EFAN(4,1) _EFAN(4,2) _EFAN(4,3) 4
#endif
#if HOTENDS > 5
, AUTO_5_IS_0 ? 0 : AUTO_5_IS_1 ? 1 : AUTO_5_IS_2 ? 2 : AUTO_5_IS_3 ? 3 : AUTO_5_IS_4 ? 4 : 5
, _EFAN(5,0) _EFAN(5,1) _EFAN(5,2) _EFAN(5,3) _EFAN(5,4) 5
#endif
#if HAS_AUTO_CHAMBER_FAN
, AUTO_CHAMBER_IS_0 ? 0 : AUTO_CHAMBER_IS_1 ? 1 : AUTO_CHAMBER_IS_2 ? 2 : AUTO_CHAMBER_IS_3 ? 3 : AUTO_CHAMBER_IS_4 ? 4 : AUTO_CHAMBER_IS_5 ? 5 : 6
#define _CFAN(B) _FANOVERLAP(CHAMBER,B) ? B :
, _CFAN(0) _CFAN(1) _CFAN(2) _CFAN(3) _CFAN(4) _CFAN(5) 6
#endif
};
uint8_t fanState = 0;
@ -731,7 +720,7 @@ int16_t Temperature::getHeaterPower(const heater_ind_t heater_id) {
// Temperature Error Handlers
//
inline void loud_kill(PGM_P const lcd_msg) {
inline void loud_kill(PGM_P const lcd_msg, const heater_ind_t heater) {
Running = false;
#if USE_BEEPER
for (uint8_t i = 20; i--;) {
@ -740,7 +729,7 @@ inline void loud_kill(PGM_P const lcd_msg) {
}
WRITE(BEEPER_PIN, HIGH);
#endif
kill(lcd_msg);
kill(lcd_msg, HEATER_PSTR(heater));
}
void Temperature::_temp_error(const heater_ind_t heater, PGM_P const serial_msg, PGM_P const lcd_msg) {
@ -777,23 +766,23 @@ void Temperature::_temp_error(const heater_ind_t heater, PGM_P const serial_msg,
if (ELAPSED(ms, expire_ms)) ++killed;
break;
case 2:
loud_kill(lcd_msg);
loud_kill(lcd_msg1, heater);
++killed;
break;
}
#elif defined(BOGUS_TEMPERATURE_GRACE_PERIOD)
UNUSED(killed);
#else
if (!killed) { killed = 1; loud_kill(lcd_msg); }
if (!killed) { killed = 1; loud_kill(lcd_msg, heater); }
#endif
}
void Temperature::max_temp_error(const heater_ind_t heater) {
_temp_error(heater, PSTR(MSG_T_MAXTEMP), TEMP_ERR_PSTR(MSG_ERR_MAXTEMP, heater));
_temp_error(heater, PSTR(MSG_T_MAXTEMP), GET_TEXT(MSG_ERR_MAXTEMP));
}
void Temperature::min_temp_error(const heater_ind_t heater) {
_temp_error(heater, PSTR(MSG_T_MINTEMP), TEMP_ERR_PSTR(MSG_ERR_MINTEMP, heater));
_temp_error(heater, PSTR(MSG_T_MINTEMP), GET_TEXT(MSG_ERR_MINTEMP));
}
#if HOTENDS
@ -1019,7 +1008,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), TEMP_ERR_PSTR(MSG_THERMAL_RUNAWAY, e));
_temp_error((heater_ind_t)e, PSTR(MSG_T_THERMAL_RUNAWAY), GET_TEXT(MSG_THERMAL_RUNAWAY));
#endif
#if HEATER_IDLE_HANDLER
@ -1037,7 +1026,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), TEMP_ERR_PSTR(MSG_HEATING_FAILED_LCD, e));
_temp_error((heater_ind_t)e, PSTR(MSG_T_HEATING_FAILED), GET_TEXT(MSG_HEATING_FAILED_LCD));
else // Start again if the target is still far off
start_watching_hotend(e);
}
@ -1046,7 +1035,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), PSTR(MSG_ERR_REDUNDANT_TEMP));
_temp_error(H_E0, PSTR(MSG_REDUNDANCY), GET_TEXT(MSG_ERR_REDUNDANT_TEMP));
#endif
} // HOTEND_LOOP
@ -1072,14 +1061,14 @@ void Temperature::manage_heater() {
#if ENABLED(THERMAL_PROTECTION_BED)
if (degBed() > BED_MAXTEMP)
_temp_error(H_BED, PSTR(MSG_T_THERMAL_RUNAWAY), TEMP_ERR_PSTR(MSG_THERMAL_RUNAWAY, H_BED));
_temp_error(H_BED, PSTR(MSG_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), TEMP_ERR_PSTR(MSG_HEATING_FAILED_LCD, H_BED));
_temp_error(H_BED, PSTR(MSG_T_HEATING_FAILED), GET_TEXT(MSG_HEATING_FAILED_LCD));
else // Start again if the target is still far off
start_watching_bed();
}
@ -1150,14 +1139,14 @@ void Temperature::manage_heater() {
#if ENABLED(THERMAL_PROTECTION_CHAMBER)
if (degChamber() > CHAMBER_MAXTEMP)
_temp_error(H_CHAMBER, PSTR(MSG_T_THERMAL_RUNAWAY), TEMP_ERR_PSTR(MSG_THERMAL_RUNAWAY, H_CHAMBER));
_temp_error(H_CHAMBER, PSTR(MSG_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), TEMP_ERR_PSTR(MSG_HEATING_FAILED_LCD, H_CHAMBER));
_temp_error(H_CHAMBER, PSTR(MSG_T_HEATING_FAILED), GET_TEXT(MSG_HEATING_FAILED_LCD));
else
start_watching_chamber(); // Start again if the target is still far off
}
@ -1685,19 +1674,19 @@ void Temperature::init() {
#if HAS_AUTO_FAN_0
INIT_E_AUTO_FAN_PIN(E0_AUTO_FAN_PIN);
#endif
#if HAS_AUTO_FAN_1 && !AUTO_1_IS_0
#if HAS_AUTO_FAN_1 && !_EFANOVERLAP(1,0)
INIT_E_AUTO_FAN_PIN(E1_AUTO_FAN_PIN);
#endif
#if HAS_AUTO_FAN_2 && !(AUTO_2_IS_0 || AUTO_2_IS_1)
#if HAS_AUTO_FAN_2 && !(_EFANOVERLAP(2,0) || _EFANOVERLAP(2,1))
INIT_E_AUTO_FAN_PIN(E2_AUTO_FAN_PIN);
#endif
#if HAS_AUTO_FAN_3 && !(AUTO_3_IS_0 || AUTO_3_IS_1 || AUTO_3_IS_2)
#if HAS_AUTO_FAN_3 && !(_EFANOVERLAP(3,0) || _EFANOVERLAP(3,1) || _EFANOVERLAP(3,2))
INIT_E_AUTO_FAN_PIN(E3_AUTO_FAN_PIN);
#endif
#if HAS_AUTO_FAN_4 && !(AUTO_4_IS_0 || AUTO_4_IS_1 || AUTO_4_IS_2 || AUTO_4_IS_3)
#if HAS_AUTO_FAN_4 && !(_EFANOVERLAP(4,0) || _EFANOVERLAP(4,1) || _EFANOVERLAP(4,2) || _EFANOVERLAP(4,3))
INIT_E_AUTO_FAN_PIN(E4_AUTO_FAN_PIN);
#endif
#if HAS_AUTO_FAN_5 && !(AUTO_5_IS_0 || AUTO_5_IS_1 || AUTO_5_IS_2 || AUTO_5_IS_3 || AUTO_5_IS_4)
#if HAS_AUTO_FAN_5 && !(_EFANOVERLAP(5,0) || _EFANOVERLAP(5,1) || _EFANOVERLAP(5,2) || _EFANOVERLAP(5,3) || _EFANOVERLAP(5,4))
INIT_E_AUTO_FAN_PIN(E5_AUTO_FAN_PIN);
#endif
#if HAS_AUTO_CHAMBER_FAN && !AUTO_CHAMBER_IS_E
@ -1928,7 +1917,7 @@ void Temperature::init() {
sm.state = TRRunaway;
case TRRunaway:
_temp_error(heater_id, PSTR(MSG_T_THERMAL_RUNAWAY), TEMP_ERR_PSTR(MSG_THERMAL_RUNAWAY, heater_id));
_temp_error(heater_id, PSTR(MSG_T_THERMAL_RUNAWAY), GET_TEXT(MSG_THERMAL_RUNAWAY));
}
}
@ -2923,7 +2912,7 @@ void Temperature::isr() {
#else
PSTR("E " S_FMT)
#endif
, heating ? PSTR(MSG_HEATING) : PSTR(MSG_COOLING)
, heating ? GET_TEXT(MSG_HEATING) : GET_TEXT(MSG_COOLING)
);
}
#endif