"N/A" toggle support and format update

This commit is contained in:
leptun 2019-08-19 10:20:17 +03:00
parent 596ffe1dc2
commit 5a3f14b752
11 changed files with 35 additions and 22 deletions

View File

@ -184,10 +184,11 @@ static void menu_draw_item_puts_P(char type_char, const char* str)
lcd_printf_P(PSTR("%c%-18.18S%c"), menu_selection_mark(), str, type_char);
}
static void menu_draw_toggle_puts_P(const char* str, const char* toggle)
static void menu_draw_toggle_puts_P(const char* str, char* toggle)
{
menu_draw_item_puts_P(LCD_STR_REFRESH[0], str);
lcd_set_cursor(LCD_WIDTH - 4 - strlen_P(toggle), menu_row);
menu_draw_item_puts_P((toggle == NULL)?LCD_STR_ARROW_RIGHT[0]:LCD_STR_REFRESH[0], str);
if (toggle == NULL) toggle = _T(MSG_NA);
lcd_set_cursor(LCD_WIDTH - 3 - strlen_P(toggle), menu_row);
lcd_printf_P(PSTR("[%S]"), toggle);
}
@ -381,12 +382,20 @@ uint8_t menu_item_toggle_P(const char* str, const char* toggle, menu_func_t func
if (lcd_draw_update) menu_draw_toggle_puts_P(str, toggle);
if (menu_clicked && (lcd_encoder == menu_item))
{
menu_clicked = false;
lcd_consume_click();
lcd_update_enabled = 0;
if (func) func();
lcd_update_enabled = 1;
return menu_item_ret();
if (toggle == NULL) // print N/A warning message
{
menu_submenu(func);
return menu_item_ret();
}
else // do the actual toggling
{
menu_clicked = false;
lcd_consume_click();
lcd_update_enabled = 0;
if (func) func();
lcd_update_enabled = 1;
return menu_item_ret();
}
}
}
menu_item++;

View File

@ -106,6 +106,8 @@ const char MSG_V2_CALIBRATION[] PROGMEM_I1 = ISTR("First layer cal."); ////c=17
const char WELCOME_MSG[] PROGMEM_I1 = ISTR(CUSTOM_MENDEL_NAME " OK."); ////c=20
const char MSG_OFF[] PROGMEM_I1 = ISTR("Off"); ////
const char MSG_ON[] PROGMEM_I1 = ISTR("On"); ////
const char MSG_NA[] PROGMEM_I1 = ISTR("N/A"); ////
//not internationalized messages
const char MSG_SD_WORKDIR_FAIL[] PROGMEM_N1 = "workDir open failed"; ////
const char MSG_BROWNOUT_RESET[] PROGMEM_N1 = " Brown out Reset"; ////

View File

@ -106,6 +106,8 @@ extern const char MSG_V2_CALIBRATION[];
extern const char WELCOME_MSG[];
extern const char MSG_OFF[];
extern const char MSG_ON[];
extern const char MSG_NA[];
//not internationalized messages
extern const char MSG_BROWNOUT_RESET[];
extern const char MSG_EXTERNAL_RESET[];

View File

@ -2970,7 +2970,7 @@ static void lcd_menu_xyz_y_min()
for (uint8_t i = 0; i < 2; i++)
{
lcd_set_cursor(11,2+i);
if (distanceMin[i] >= 200) lcd_puts_P(_N("N/A"));
if (distanceMin[i] >= 200) lcd_puts_P(_T(MSG_NA));
else lcd_printf_P(_N("%6.2fmm"), distanceMin[i]);
}
if (lcd_clicked())
@ -3010,7 +3010,7 @@ static void lcd_menu_xyz_skew()
}
else{
lcd_set_cursor(15,0);
lcd_puts_P(_N("N/A"));
lcd_puts_P(_T(MSG_NA));
}
if (lcd_clicked())
menu_goto(lcd_menu_xyz_offset, 0, true, true);
@ -3910,13 +3910,13 @@ static void lcd_print_state(uint8_t state)
{
switch (state) {
case STATE_ON:
lcd_puts_P(_i(" 1"));
lcd_puts_P(_N(" 1"));
break;
case STATE_OFF:
lcd_puts_P(_i(" 0"));
lcd_puts_P(_N(" 0"));
break;
default:
lcd_puts_P(_i("N/A"));
lcd_puts_P(_T(MSG_NA));
break;
}
}

View File

@ -481,7 +481,7 @@
#MSG_NO_CARD
"No SD card"
#
#MSG_NA
"N/A"
#MSG_NO

View File

@ -642,7 +642,7 @@
"No SD card"
"Zadna SD karta"
#
#MSG_NA
"N/A"
"\x00"

View File

@ -642,7 +642,7 @@
"No SD card"
"Keine SD Karte"
#
#MSG_NA
"N/A"
"N.V."

View File

@ -642,9 +642,9 @@
"No SD card"
"No hay tarjeta SD"
#
#MSG_NA
"N/A"
"No disponible"
"N/D"
#MSG_NO
"No"

View File

@ -642,7 +642,7 @@
"No SD card"
"Pas de carte SD"
#
#MSG_NA
"N/A"
"\x00"

View File

@ -642,7 +642,7 @@
"No SD card"
"Nessuna SD"
#
#MSG_NA
"N/A"
"\x00"

View File

@ -642,7 +642,7 @@
"No SD card"
"Brak karty SD"
#
#MSG_NA
"N/A"
"N/D"