Merge pull request #2806 from leptun/MK3_PRUSA_SN

Make the serial number available to the user
This commit is contained in:
DRracer 2020-09-09 09:54:29 +02:00 committed by GitHub
commit 763d2d9849
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -3293,37 +3293,24 @@ void gcode_M701()
*/ */
static void gcode_PRUSA_SN() static void gcode_PRUSA_SN()
{ {
if (farm_mode) { uint8_t selectedSerialPort_bak = selectedSerialPort;
selectedSerialPort = 0; char SN[20];
putchar(';'); selectedSerialPort = 0;
putchar('S'); SERIAL_ECHOLNRPGM(PSTR(";S"));
int numbersRead = 0; uint8_t numbersRead = 0;
ShortTimer timeout; ShortTimer timeout;
timeout.start(); timeout.start();
while (numbersRead < 19) { while (numbersRead < (sizeof(SN) - 1)) {
while (MSerial.available() > 0) { if (MSerial.available() > 0) {
uint8_t serial_char = MSerial.read(); SN[numbersRead] = MSerial.read();
selectedSerialPort = 1; numbersRead++;
putchar(serial_char);
numbersRead++;
selectedSerialPort = 0;
}
if (timeout.expired(100u)) break;
} }
selectedSerialPort = 1; if (timeout.expired(100u)) break;
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."));
} }
SN[numbersRead] = 0;
selectedSerialPort = selectedSerialPort_bak;
SERIAL_ECHOLN(SN);
} }
//! Detection of faulty RAMBo 1.1b boards equipped with bigger capacitors //! Detection of faulty RAMBo 1.1b boards equipped with bigger capacitors
//! at the TACH_1 pin, which causes bad detection of print fan speed. //! at the TACH_1 pin, which causes bad detection of print fan speed.