Browse Source

Make the serial number available to the user

Alex Voinea 3 years ago
parent
commit
e2856ba4f5
1 changed files with 18 additions and 29 deletions
  1. 18 29
      Firmware/Marlin_main.cpp

+ 18 - 29
Firmware/Marlin_main.cpp

@@ -3286,37 +3286,26 @@ void gcode_M701()
  */
 static void gcode_PRUSA_SN()
 {
-    if (farm_mode) {
-        selectedSerialPort = 0;
-        putchar(';');
-        putchar('S');
-        int numbersRead = 0;
-        ShortTimer timeout;
-        timeout.start();
-
-        while (numbersRead < 19) {
-            while (MSerial.available() > 0) {
-                uint8_t serial_char = MSerial.read();
-                selectedSerialPort = 1;
-                putchar(serial_char);
-                numbersRead++;
-                selectedSerialPort = 0;
-            }
-            if (timeout.expired(100u)) break;
+    uint8_t selectedSerialPort_bak = selectedSerialPort;
+    selectedSerialPort = 0;
+    putchar(';');
+    putchar('S');
+    int numbersRead = 0;
+    ShortTimer timeout;
+    timeout.start();
+
+    while (numbersRead < 19) {
+        while (MSerial.available() > 0) {
+            uint8_t serial_char = MSerial.read();
+            selectedSerialPort = selectedSerialPort_bak;
+            putchar(serial_char);
+            numbersRead++;
+            selectedSerialPort = 0;
         }
-        selectedSerialPort = 1;
-        putchar('\n');
-#if 0
-        for (int b = 0; b < 3; b++) {
-            _tone(BEEPER, 110);
-            _delay(50);
-            _noTone(BEEPER);
-            _delay(50);
-        }
-#endif
-    } else {
-        puts_P(_N("Not in farm mode."));
+        if (timeout.expired(100u)) break;
     }
+    selectedSerialPort = selectedSerialPort_bak;
+    putchar('\n');
 }
 //! Detection of faulty RAMBo 1.1b boards equipped with bigger capacitors
 //! at the TACH_1 pin, which causes bad detection of print fan speed.