If an old firmware is detected, make sure the protocol is actually stopped
The printer shouldn't continue endlessly asking for a version if an old MMU is detected. Also if the protocol is supposed to be turned off, it shouldn't be sending S0 queries.
This commit is contained in:
parent
9f3f0baa47
commit
eb8ec9f8b9
|
|
@ -124,8 +124,6 @@ struct OldMMUFWDetector {
|
||||||
return State::MatchingPart;
|
return State::MatchingPart;
|
||||||
} else if(ok == 1 && c == 'k'){
|
} else if(ok == 1 && c == 'k'){
|
||||||
++ok;
|
++ok;
|
||||||
return State::MatchingPart;
|
|
||||||
} else if(ok == 2 && c == '\n'){
|
|
||||||
return State::Matched;
|
return State::Matched;
|
||||||
}
|
}
|
||||||
return State::SomethingElse;
|
return State::SomethingElse;
|
||||||
|
|
@ -154,10 +152,8 @@ StepStatus ProtocolLogic::ExpectingMessage() {
|
||||||
// consume old MMU FW's data if any -> avoid confusion of protocol decoder
|
// consume old MMU FW's data if any -> avoid confusion of protocol decoder
|
||||||
auto old = oldMMUh4x0r.Detect(c);
|
auto old = oldMMUh4x0r.Detect(c);
|
||||||
if( old == OldMMUFWDetector::State::Matched ){
|
if( old == OldMMUFWDetector::State::Matched ){
|
||||||
// hack bad FW version - BEWARE - we silently assume that the first query is an "S0"
|
// Old MMU FW 1.0.6 detected. Firmwares are incompatible.
|
||||||
// The old MMU FW responds with "ok\n" and we fake the response to a bad FW version at this spot
|
return VersionMismatch;
|
||||||
rsp = ResponseMsg(RequestMsg(RequestMsgCodes::Version, 0), ResponseMsgParamCodes::Accepted, 0);
|
|
||||||
return MessageReady;
|
|
||||||
} else if( old == OldMMUFWDetector::State::MatchingPart ){
|
} else if( old == OldMMUFWDetector::State::MatchingPart ){
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
@ -171,7 +167,7 @@ StepStatus ProtocolLogic::ExpectingMessage() {
|
||||||
if (bytesConsumed != 0) {
|
if (bytesConsumed != 0) {
|
||||||
RecordUARTActivity(); // something has happened on the UART, update the timeout record
|
RecordUARTActivity(); // something has happened on the UART, update the timeout record
|
||||||
return Processing; // consumed some bytes, but message still not ready
|
return Processing; // consumed some bytes, but message still not ready
|
||||||
} else if (Elapsed(linkLayerTimeout)) {
|
} else if (Elapsed(linkLayerTimeout) && currentScope != Scope::Stopped) {
|
||||||
return CommunicationTimeout;
|
return CommunicationTimeout;
|
||||||
}
|
}
|
||||||
return Processing;
|
return Processing;
|
||||||
|
|
@ -794,7 +790,6 @@ StepStatus ProtocolLogic::Step() {
|
||||||
break;
|
break;
|
||||||
case VersionMismatch:
|
case VersionMismatch:
|
||||||
LogError(PSTR("Version mismatch"));
|
LogError(PSTR("Version mismatch"));
|
||||||
Stop(); // cannot continue
|
|
||||||
break;
|
break;
|
||||||
case ProtocolError:
|
case ProtocolError:
|
||||||
currentStatus = HandleProtocolError();
|
currentStatus = HandleProtocolError();
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue