Show the Toshiba FlashAir IP address in the menu.

This commit is contained in:
bubnikv 2016-07-22 10:31:30 +02:00
parent 2e66fdf84a
commit 5c56e472fe
2 changed files with 38 additions and 1 deletions

View File

@ -137,6 +137,7 @@ static void lcd_quick_feedback();//Cause an LCD refresh, and give the user visua
/* Different types of actions that can be used in menu items. */
static void menu_action_back(menuFunc_t data);
#define menu_action_back_RAM menu_action_back
static void menu_action_submenu(menuFunc_t data);
static void menu_action_gcode(const char* pgcode);
static void menu_action_function(menuFunc_t data);
@ -750,6 +751,16 @@ static void lcd_support_menu()
MENU_ITEM(back, PSTR("Date: "), lcd_main_menu);
MENU_ITEM(back, PSTR(__DATE__), lcd_main_menu);
// Show the FlashAir IP address, if the card is available.
uint8_t ip[4];
bool hasIP = card.ToshibaFlashAir_GetIP(ip);
if (hasIP) {
MENU_ITEM(back, PSTR("FlashAir IP Addr:"), lcd_main_menu);
char buf[30];
sprintf_P(buf, PSTR("%d.%d.%d.%d"), ip[0], ip[1], ip[2], ip[3]);
MENU_ITEM(back_RAM, buf, lcd_main_menu);
}
END_MENU();
}
@ -2279,7 +2290,7 @@ static void lcd_main_menu()
}
if ( movesplanned() || IS_SD_PRINTING || is_usb_printing )
if ( moves_planned() || IS_SD_PRINTING || is_usb_printing )
{
MENU_ITEM(submenu, MSG_TUNE, lcd_tune_menu);
} else

View File

@ -916,6 +916,30 @@ static void lcd_implementation_drawmenu_generic(uint8_t row, const char* pstr, c
lcd.print(post_char);
lcd.print(' ');
}
static void lcd_implementation_drawmenu_generic_RAM(uint8_t row, const char* str, char pre_char, char post_char)
{
char c;
//Use all characters in narrow LCDs
#if LCD_WIDTH < 20
uint8_t n = LCD_WIDTH - 1 - 1;
#else
uint8_t n = LCD_WIDTH - 1 - 2;
#endif
lcd.setCursor(0, row);
lcd.print(pre_char);
while( ((c = *str) != '\0') && (n>0) )
{
lcd.print(c);
str++;
n--;
}
while(n--)
lcd.print(' ');
lcd.print(post_char);
lcd.print(' ');
}
static void lcd_implementation_drawmenu_setting_edit_generic(uint8_t row, const char* pstr, char pre_char, char* data)
{
char c;
@ -1147,6 +1171,8 @@ static void lcd_implementation_drawmenu_sddirectory(uint8_t row, const char* pst
}
#define lcd_implementation_drawmenu_back_selected(row, pstr, data) lcd_implementation_drawmenu_generic(row, pstr, LCD_STR_UPLEVEL[0], LCD_STR_UPLEVEL[0])
#define lcd_implementation_drawmenu_back(row, pstr, data) lcd_implementation_drawmenu_generic(row, pstr, ' ', LCD_STR_UPLEVEL[0])
#define lcd_implementation_drawmenu_back_RAM_selected(row, str, data) lcd_implementation_drawmenu_generic_RAM(row, str, LCD_STR_UPLEVEL[0], LCD_STR_UPLEVEL[0])
#define lcd_implementation_drawmenu_back_RAM(row, str, data) lcd_implementation_drawmenu_generic_RAM(row, str, ' ', LCD_STR_UPLEVEL[0])
#define lcd_implementation_drawmenu_submenu_selected(row, pstr, data) lcd_implementation_drawmenu_generic(row, pstr, '>', LCD_STR_ARROW_RIGHT[0])
#define lcd_implementation_drawmenu_submenu(row, pstr, data) lcd_implementation_drawmenu_generic(row, pstr, ' ', LCD_STR_ARROW_RIGHT[0])
#define lcd_implementation_drawmenu_gcode_selected(row, pstr, gcode) lcd_implementation_drawmenu_generic(row, pstr, '>', ' ')