Fix printer resets in farm mode if command "PRUSA SN" is received and 32U2 processor is not responding.
This commit is contained in:
parent
08740356b8
commit
388d6eea36
1 changed files with 39 additions and 25 deletions
|
@ -2508,14 +2508,25 @@ void gcode_M701()
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* @brief Get serial number from 32U2 processor
|
* @brief Get serial number from 32U2 processor
|
||||||
|
*
|
||||||
|
* Typical format of S/N is:CZPX0917X003XC13518
|
||||||
|
*
|
||||||
|
* Command operates only in farm mode, if not in farm mode, "Not in farm mode." is written to MYSERIAL.
|
||||||
|
*
|
||||||
|
* Send command ;S to serial port 0 to retrieve serial number stored in 32U2 processor,
|
||||||
|
* reply is transmitted to serial port 1 character by character.
|
||||||
|
* Operation takes typically 23 ms. If the retransmit is not finished until 100 ms,
|
||||||
|
* it is interrupted, so less, or no characters are retransmitted, only newline character is send
|
||||||
|
* in any case.
|
||||||
*/
|
*/
|
||||||
static void gcode_PRUSA_SN()
|
static void gcode_PRUSA_SN()
|
||||||
{
|
{
|
||||||
if (farm_mode) {
|
if (farm_mode) {
|
||||||
selectedSerialPort = 0;
|
selectedSerialPort = 0;
|
||||||
MSerial.write(";S");
|
MSerial.write(";S");
|
||||||
// S/N is:CZPX0917X003XC13518
|
|
||||||
int numbersRead = 0;
|
int numbersRead = 0;
|
||||||
|
Timer timeout;
|
||||||
|
timeout.start();
|
||||||
|
|
||||||
while (numbersRead < 19) {
|
while (numbersRead < 19) {
|
||||||
while (MSerial.available() > 0) {
|
while (MSerial.available() > 0) {
|
||||||
|
@ -2525,15 +2536,18 @@ static void gcode_PRUSA_SN()
|
||||||
numbersRead++;
|
numbersRead++;
|
||||||
selectedSerialPort = 0;
|
selectedSerialPort = 0;
|
||||||
}
|
}
|
||||||
|
if (timeout.expired(100)) break;
|
||||||
}
|
}
|
||||||
selectedSerialPort = 1;
|
selectedSerialPort = 1;
|
||||||
MSerial.write('\n');
|
MSerial.write('\n');
|
||||||
/*for (int b = 0; b < 3; b++) {
|
#if 0
|
||||||
|
for (int b = 0; b < 3; b++) {
|
||||||
tone(BEEPER, 110);
|
tone(BEEPER, 110);
|
||||||
delay(50);
|
delay(50);
|
||||||
noTone(BEEPER);
|
noTone(BEEPER);
|
||||||
delay(50);
|
delay(50);
|
||||||
}*/
|
}
|
||||||
|
#endif
|
||||||
} else {
|
} else {
|
||||||
MYSERIAL.println("Not in farm mode.");
|
MYSERIAL.println("Not in farm mode.");
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue