Only start a new command if the previous one finished
... that means with or without an error and remember the Command's request message - to identify the responsespull/83/head
parent
e0ea47595f
commit
a982381728
|
|
@ -219,8 +219,11 @@ void ReportRunningCommand() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void PlanCommand(const mp::RequestMsg &rq) {
|
void PlanCommand(const mp::RequestMsg &rq) {
|
||||||
if (currentCommand->Error() == ErrorCode::OK) {
|
if (currentCommand->State() == ProgressCode::OK) {
|
||||||
// we are allowed to start a new command as the previous one is in the OK finished state
|
// We are allowed to start a new command as the previous one is in the OK finished state
|
||||||
|
// The previous command may be in an error state, but as long as it is in ProgressCode::OK (aka finished)
|
||||||
|
// we are safe here. It is the responsibility of the printer to ask for a command error code
|
||||||
|
// before issuing another one - if needed.
|
||||||
switch (rq.code) {
|
switch (rq.code) {
|
||||||
case mp::RequestMsgCodes::Cut:
|
case mp::RequestMsgCodes::Cut:
|
||||||
currentCommand = &logic::cutFilament;
|
currentCommand = &logic::cutFilament;
|
||||||
|
|
@ -241,6 +244,7 @@ void PlanCommand(const mp::RequestMsg &rq) {
|
||||||
currentCommand = &logic::noCommand;
|
currentCommand = &logic::noCommand;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
currentCommandRq = rq; // save the Current Command Request for indentification of responses
|
||||||
currentCommand->Reset(rq.value);
|
currentCommand->Reset(rq.value);
|
||||||
ReportCommandAccepted(rq, mp::ResponseMsgParamCodes::Accepted);
|
ReportCommandAccepted(rq, mp::ResponseMsgParamCodes::Accepted);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue