Fix [French translation] Wrong display during mesh bed calibration #2218

minor code/doc improvements
This commit is contained in:
DRracer 2019-09-18 12:49:44 +02:00
parent 14933f6b0e
commit e7273ea505
2 changed files with 15 additions and 8 deletions

View File

@ -1674,9 +1674,12 @@ static void lcd_cooldown()
//! It would have been much easier if there was a ':' in the labels. //! It would have been much easier if there was a ':' in the labels.
//! But since the texts like Bed, Nozzle and PINDA are used in other places //! But since the texts like Bed, Nozzle and PINDA are used in other places
//! it is better to reuse these texts even though it requires some extra formatting code. //! it is better to reuse these texts even though it requires some extra formatting code.
//! @param [in] ipgmLabel pointer to string in PROGMEM
//! @param [out] pointer to string in RAM which will receive the formatted text. Must be allocated to appropriate size
//! @param [in] dstSize allocated length of dst
static void pgmtext_with_colon(const char *ipgmLabel, char *dst, uint8_t dstSize){ static void pgmtext_with_colon(const char *ipgmLabel, char *dst, uint8_t dstSize){
uint8_t i = 0; uint8_t i = 0;
for(; i < dstSize - 2; ++i){ // 1 byte less than buffer, we'd be adding a ':' to the end for(; i < dstSize - 2; ++i){ // 2 byte less than buffer, we'd be adding a ':' to the end
uint8_t b = pgm_read_byte(ipgmLabel + i); uint8_t b = pgm_read_byte(ipgmLabel + i);
if( ! b ) if( ! b )
break; break;
@ -1686,7 +1689,7 @@ static void pgmtext_with_colon(const char *ipgmLabel, char *dst, uint8_t dstSize
++i; ++i;
for(; i < dstSize - 1; ++i) // fill the rest with spaces for(; i < dstSize - 1; ++i) // fill the rest with spaces
dst[i] = ' '; dst[i] = ' ';
dst[dstSize-1] = 0; // terminate the string properly dst[dstSize-1] = '\0'; // terminate the string properly
} }
void lcd_menu_extruder_info() // NOT static due to using inside "Marlin_main" module ("manage_inactivity()") void lcd_menu_extruder_info() // NOT static due to using inside "Marlin_main" module ("manage_inactivity()")
@ -1701,9 +1704,10 @@ void lcd_menu_extruder_info() // NOT static due to using ins
// Display Nozzle fan RPM // Display Nozzle fan RPM
lcd_timeoutToStatus.stop(); //infinite timeout lcd_timeoutToStatus.stop(); //infinite timeout
lcd_home(); lcd_home();
char nozzle[12], print[12]; static const size_t maxChars = 12;
pgmtext_with_colon(_i("Nozzle FAN"), nozzle, 12); char nozzle[maxChars], print[maxChars];
pgmtext_with_colon(_i("Print FAN"), print, 12); pgmtext_with_colon(_i("Nozzle FAN"), nozzle, maxChars);
pgmtext_with_colon(_i("Print FAN"), print, maxChars);
lcd_printf_P(_N("%s %4d RPM\n" "%s %4d RPM\n"), nozzle, 60*fan_speed[0], print, 60*fan_speed[1] ); lcd_printf_P(_N("%s %4d RPM\n" "%s %4d RPM\n"), nozzle, 60*fan_speed[0], print, 60*fan_speed[1] );
#ifdef PAT9125 #ifdef PAT9125
@ -1888,9 +1892,12 @@ static void lcd_menu_debug()
#endif /* DEBUG_BUILD */ #endif /* DEBUG_BUILD */
//! @brief common line print for lcd_menu_temperatures //! @brief common line print for lcd_menu_temperatures
//! @param [in] ipgmLabel pointer to string in PROGMEM
//! @param [in] value to be printed behind the label
static void lcd_menu_temperatures_line(const char *ipgmLabel, int value){ static void lcd_menu_temperatures_line(const char *ipgmLabel, int value){
char tmp[15]; static const size_t maxChars = 15;
pgmtext_with_colon(ipgmLabel, tmp, 15); char tmp[maxChars];
pgmtext_with_colon(ipgmLabel, tmp, maxChars);
lcd_printf_P(PSTR(" %s%3d\x01 \n"), tmp, value); // no need to add -14.14 to string alignment lcd_printf_P(PSTR(" %s%3d\x01 \n"), tmp, value); // no need to add -14.14 to string alignment
} }
static void lcd_menu_temperatures() static void lcd_menu_temperatures()

View File

@ -136,7 +136,7 @@
#MSG_CALIBRATE_Z_AUTO c=20 r=2 #MSG_CALIBRATE_Z_AUTO c=20 r=2
"Calibrating Z" "Calibrating Z"
"Calibration de Z" "Calibration Z"
#MSG_MOVE_CARRIAGE_TO_THE_TOP_Z c=20 r=8 #MSG_MOVE_CARRIAGE_TO_THE_TOP_Z c=20 r=8
"Calibrating Z. Rotate the knob to move the Z carriage up to the end stoppers. Click when done." "Calibrating Z. Rotate the knob to move the Z carriage up to the end stoppers. Click when done."