diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index 1b29c88fe..9da891d87 100755 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -5974,28 +5974,30 @@ if(eSoundMode!=e_SOUND_MODE_SILENT) /*! ### M46 - Show the assigned IP address M46: Show the assigned IP address. */ - /* - case 46: + case 46: { // M46: Prusa3D: Show the assigned IP address. - uint8_t ip[4]; - bool hasIP = card.ToshibaFlashAir_GetIP(ip); - if (hasIP) { - SERIAL_ECHOPGM("Toshiba FlashAir current IP: "); - SERIAL_ECHO(int(ip[0])); - SERIAL_ECHOPGM("."); - SERIAL_ECHO(int(ip[1])); - SERIAL_ECHOPGM("."); - SERIAL_ECHO(int(ip[2])); - SERIAL_ECHOPGM("."); - SERIAL_ECHO(int(ip[3])); - SERIAL_ECHOLNPGM(""); + if (card.ToshibaFlashAir_isEnabled()) { + uint8_t ip[4]; + bool hasIP = card.ToshibaFlashAir_GetIP(ip); + if (hasIP) { + // SERIAL_PROTOCOLPGM("Toshiba FlashAir current IP: "); + SERIAL_PROTOCOL(int(ip[0])); + SERIAL_PROTOCOLPGM("."); + SERIAL_PROTOCOL(int(ip[1])); + SERIAL_PROTOCOLPGM("."); + SERIAL_PROTOCOL(int(ip[2])); + SERIAL_PROTOCOLPGM("."); + SERIAL_PROTOCOL(int(ip[3])); + SERIAL_PROTOCOLPGM("\n"); + } else { + SERIAL_PROTOCOLPGM("?Toshiba FlashAir GetIP failed\n"); + } } else { - SERIAL_ECHOLNPGM("Toshiba FlashAir GetIP failed"); + SERIAL_PROTOCOLPGM("n/a\n"); } break; } - */ /*! ### M47 - Show end stops dialog on the display M47: Show end stops dialog on the display diff --git a/Firmware/Sd2Card.cpp b/Firmware/Sd2Card.cpp index 449590f17..d1d350563 100644 --- a/Firmware/Sd2Card.cpp +++ b/Firmware/Sd2Card.cpp @@ -767,6 +767,9 @@ uint8_t Sd2Card::waitStartBlock(void) { // Toshiba FlashAir support, copied from // 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. */ @@ -774,7 +777,7 @@ uint8_t Sd2Card::readExt(uint32_t arg, uint8_t* dst, uint16_t count) { uint16_t i; // 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); goto fail; } diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index 0ce3344ac..a12db7f48 100755 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -2120,12 +2120,14 @@ static void lcd_support_menu() // Menu was entered or SD card status has changed (plugged in or removed). // Initialize its status. _md->status = 1; - _md->is_flash_air = card.ToshibaFlashAir_isEnabled() && card.ToshibaFlashAir_GetIP(_md->ip); - if (_md->is_flash_air) + _md->is_flash_air = card.ToshibaFlashAir_isEnabled(); + 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"), _md->ip[0], _md->ip[1], _md->ip[2], _md->ip[3]); - + } } else if (_md->is_flash_air && _md->ip[0] == 0 && _md->ip[1] == 0 && _md->ip[2] == 0 && _md->ip[3] == 0 && @@ -2191,7 +2193,11 @@ static void lcd_support_menu() if (_md->is_flash_air) { MENU_ITEM_BACK_P(STR_SEPARATOR); 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