Browse Source

M46 "Show the assigned IP address" activated

According to the reprap wiki, M46 has been assigned to display its assigned IP address, but has been disabled.
Now that Toshiba FlashAir IP address processing is working, I activate the M46 code so that I can read the IP address information via serial.
odaki 4 years ago
parent
commit
99545a006c
1 changed files with 19 additions and 15 deletions
  1. 19 15
      Firmware/Marlin_main.cpp

+ 19 - 15
Firmware/Marlin_main.cpp

@@ -5584,28 +5584,32 @@ if(eSoundMode!=e_SOUND_MODE_SILENT)
     }
 	break;
 
-    /*
+    //! ### M46 - Show the assigned IP address (Prusa specific)
+    // --------------------------------------------------------------------
     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 (Prusa specific)
     // ----------------------------------------------------