Merge pull request #2397 from odaki/flashair_display_ip
Show the FlashAir IP address
This commit is contained in:
commit
5c3513a6cc
|
|
@ -5974,28 +5974,30 @@ if(eSoundMode!=e_SOUND_MODE_SILENT)
|
||||||
/*!
|
/*!
|
||||||
### M46 - Show the assigned IP address <a href="https://reprap.org/wiki/G-code#M46:_Show_the_assigned_IP_address">M46: Show the assigned IP address.</a>
|
### M46 - Show the assigned IP address <a href="https://reprap.org/wiki/G-code#M46:_Show_the_assigned_IP_address">M46: Show the assigned IP address.</a>
|
||||||
*/
|
*/
|
||||||
/*
|
case 46:
|
||||||
case 46:
|
|
||||||
{
|
{
|
||||||
// M46: Prusa3D: Show the assigned IP address.
|
// M46: Prusa3D: Show the assigned IP address.
|
||||||
uint8_t ip[4];
|
if (card.ToshibaFlashAir_isEnabled()) {
|
||||||
bool hasIP = card.ToshibaFlashAir_GetIP(ip);
|
uint8_t ip[4];
|
||||||
if (hasIP) {
|
bool hasIP = card.ToshibaFlashAir_GetIP(ip);
|
||||||
SERIAL_ECHOPGM("Toshiba FlashAir current IP: ");
|
if (hasIP) {
|
||||||
SERIAL_ECHO(int(ip[0]));
|
// SERIAL_PROTOCOLPGM("Toshiba FlashAir current IP: ");
|
||||||
SERIAL_ECHOPGM(".");
|
SERIAL_PROTOCOL(int(ip[0]));
|
||||||
SERIAL_ECHO(int(ip[1]));
|
SERIAL_PROTOCOLPGM(".");
|
||||||
SERIAL_ECHOPGM(".");
|
SERIAL_PROTOCOL(int(ip[1]));
|
||||||
SERIAL_ECHO(int(ip[2]));
|
SERIAL_PROTOCOLPGM(".");
|
||||||
SERIAL_ECHOPGM(".");
|
SERIAL_PROTOCOL(int(ip[2]));
|
||||||
SERIAL_ECHO(int(ip[3]));
|
SERIAL_PROTOCOLPGM(".");
|
||||||
SERIAL_ECHOLNPGM("");
|
SERIAL_PROTOCOL(int(ip[3]));
|
||||||
|
SERIAL_PROTOCOLPGM("\n");
|
||||||
|
} else {
|
||||||
|
SERIAL_PROTOCOLPGM("?Toshiba FlashAir GetIP failed\n");
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
SERIAL_ECHOLNPGM("Toshiba FlashAir GetIP failed");
|
SERIAL_PROTOCOLPGM("n/a\n");
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
### M47 - Show end stops dialog on the display <a href="https://reprap.org/wiki/G-code#M47:_Show_end_stops_dialog_on_the_display">M47: Show end stops dialog on the display</a>
|
### M47 - Show end stops dialog on the display <a href="https://reprap.org/wiki/G-code#M47:_Show_end_stops_dialog_on_the_display">M47: Show end stops dialog on the display</a>
|
||||||
|
|
|
||||||
|
|
@ -767,6 +767,9 @@ uint8_t Sd2Card::waitStartBlock(void) {
|
||||||
|
|
||||||
// Toshiba FlashAir support, copied from
|
// Toshiba FlashAir support, copied from
|
||||||
// https://flashair-developers.com/en/documents/tutorials/arduino/
|
// https://flashair-developers.com/en/documents/tutorials/arduino/
|
||||||
|
// However, the official website was closed in September 2019.
|
||||||
|
// There is an archived website (written in Japanese).
|
||||||
|
// https://flashair-developers.github.io/website/docs/tutorials/arduino/2.html
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
/** Perform Extention Read. */
|
/** Perform Extention Read. */
|
||||||
|
|
@ -774,7 +777,7 @@ uint8_t Sd2Card::readExt(uint32_t arg, uint8_t* dst, uint16_t count) {
|
||||||
uint16_t i;
|
uint16_t i;
|
||||||
|
|
||||||
// send command and argument.
|
// send command and argument.
|
||||||
if (cardCommand(CMD48, arg)) {
|
if (cardCommand(CMD48, arg) && cardCommand(CMD17, arg)) { // CMD48 for W-03, CMD17 for W-04
|
||||||
error(SD_CARD_ERROR_CMD48);
|
error(SD_CARD_ERROR_CMD48);
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2120,12 +2120,14 @@ static void lcd_support_menu()
|
||||||
// Menu was entered or SD card status has changed (plugged in or removed).
|
// Menu was entered or SD card status has changed (plugged in or removed).
|
||||||
// Initialize its status.
|
// Initialize its status.
|
||||||
_md->status = 1;
|
_md->status = 1;
|
||||||
_md->is_flash_air = card.ToshibaFlashAir_isEnabled() && card.ToshibaFlashAir_GetIP(_md->ip);
|
_md->is_flash_air = card.ToshibaFlashAir_isEnabled();
|
||||||
if (_md->is_flash_air)
|
if (_md->is_flash_air) {
|
||||||
|
card.ToshibaFlashAir_GetIP(_md->ip); // ip[4] filled with 0 if it failed
|
||||||
|
// Prepare IP string from ip[4]
|
||||||
sprintf_P(_md->ip_str, PSTR("%d.%d.%d.%d"),
|
sprintf_P(_md->ip_str, PSTR("%d.%d.%d.%d"),
|
||||||
_md->ip[0], _md->ip[1],
|
_md->ip[0], _md->ip[1],
|
||||||
_md->ip[2], _md->ip[3]);
|
_md->ip[2], _md->ip[3]);
|
||||||
|
}
|
||||||
} else if (_md->is_flash_air &&
|
} else if (_md->is_flash_air &&
|
||||||
_md->ip[0] == 0 && _md->ip[1] == 0 &&
|
_md->ip[0] == 0 && _md->ip[1] == 0 &&
|
||||||
_md->ip[2] == 0 && _md->ip[3] == 0 &&
|
_md->ip[2] == 0 && _md->ip[3] == 0 &&
|
||||||
|
|
@ -2191,7 +2193,11 @@ static void lcd_support_menu()
|
||||||
if (_md->is_flash_air) {
|
if (_md->is_flash_air) {
|
||||||
MENU_ITEM_BACK_P(STR_SEPARATOR);
|
MENU_ITEM_BACK_P(STR_SEPARATOR);
|
||||||
MENU_ITEM_BACK_P(PSTR("FlashAir IP Addr:")); //c=18 r=1
|
MENU_ITEM_BACK_P(PSTR("FlashAir IP Addr:")); //c=18 r=1
|
||||||
///! MENU_ITEM(back_RAM, _md->ip_str, 0);
|
MENU_ITEM_BACK_P(PSTR(" "));
|
||||||
|
if (((menu_item - 1) == menu_line) && lcd_draw_update) {
|
||||||
|
lcd_set_cursor(2, menu_row);
|
||||||
|
lcd_printf_P(PSTR("%s"), _md->ip_str);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef MK1BP
|
#ifndef MK1BP
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue