Don't switch unnecessarily. Also "\n" the ";S" request
This commit is contained in:
parent
e2856ba4f5
commit
2c2926882a
|
|
@ -3287,25 +3287,23 @@ void gcode_M701()
|
||||||
static void gcode_PRUSA_SN()
|
static void gcode_PRUSA_SN()
|
||||||
{
|
{
|
||||||
uint8_t selectedSerialPort_bak = selectedSerialPort;
|
uint8_t selectedSerialPort_bak = selectedSerialPort;
|
||||||
|
char SN[20];
|
||||||
selectedSerialPort = 0;
|
selectedSerialPort = 0;
|
||||||
putchar(';');
|
SERIAL_ECHOLNRPGM(PSTR(";S"));
|
||||||
putchar('S');
|
uint8_t numbersRead = 0;
|
||||||
int 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 = selectedSerialPort_bak;
|
|
||||||
putchar(serial_char);
|
|
||||||
numbersRead++;
|
numbersRead++;
|
||||||
selectedSerialPort = 0;
|
|
||||||
}
|
}
|
||||||
if (timeout.expired(100u)) break;
|
if (timeout.expired(100u)) break;
|
||||||
}
|
}
|
||||||
|
SN[numbersRead] = 0;
|
||||||
selectedSerialPort = selectedSerialPort_bak;
|
selectedSerialPort = selectedSerialPort_bak;
|
||||||
putchar('\n');
|
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.
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue