Tune Interrupted state based on unit tests
Now finally the printer can restart ToolChange if MMU restarted.
This commit is contained in:
parent
ffbd95b482
commit
fe11b7a247
|
|
@ -311,7 +311,7 @@ void MMU2::update_tool_change_counter_eeprom() {
|
||||||
reset_toolchange_counter();
|
reset_toolchange_counter();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MMU2::MMU2::ToolChangeCommon(uint8_t slot){
|
void MMU2::ToolChangeCommon(uint8_t slot){
|
||||||
tool_change_extruder = slot;
|
tool_change_extruder = slot;
|
||||||
do {
|
do {
|
||||||
for(;;) {
|
for(;;) {
|
||||||
|
|
@ -320,10 +320,15 @@ void MMU2::MMU2::ToolChangeCommon(uint8_t slot){
|
||||||
break;
|
break;
|
||||||
// otherwise: failed to perform the command - unload first and then let it run again
|
// otherwise: failed to perform the command - unload first and then let it run again
|
||||||
unload();
|
unload();
|
||||||
|
// if we run out of retries, we must do something ... may be raise an error screen and allow the user to do something
|
||||||
|
// but honestly - if the MMU restarts during every toolchange,
|
||||||
|
// something else is seriously broken and stopping a print is probably our best option.
|
||||||
}
|
}
|
||||||
// reset current position to whatever the planner thinks it is
|
// reset current position to whatever the planner thinks it is
|
||||||
plan_set_e_position(current_position[E_AXIS]);
|
plan_set_e_position(current_position[E_AXIS]);
|
||||||
} while (0); // while not successfully fed into etruder's PTFE tube
|
} while (0); // while not successfully fed into etruder's PTFE tube
|
||||||
|
// when we run out of feeding retries, we should call an unload + cut before trying again.
|
||||||
|
// + we need some error screen report
|
||||||
|
|
||||||
extruder = slot; //filament change is finished
|
extruder = slot; //filament change is finished
|
||||||
SpoolJoin::spooljoin.setSlot(slot);
|
SpoolJoin::spooljoin.setSlot(slot);
|
||||||
|
|
|
||||||
|
|
@ -347,9 +347,12 @@ StepStatus ProtocolLogic::ProcessCommandQueryResponse() {
|
||||||
if( ReqMsg().code == rsp.request.code && ReqMsg().value == rsp.request.value ){
|
if( ReqMsg().code == rsp.request.code && ReqMsg().value == rsp.request.value ){
|
||||||
progressCode = ProgressCode::OK;
|
progressCode = ProgressCode::OK;
|
||||||
scopeState = ScopeState::Ready;
|
scopeState = ScopeState::Ready;
|
||||||
|
rq = RequestMsg(RequestMsgCodes::unknown, 0); // clear the successfully finished request
|
||||||
return Finished;
|
return Finished;
|
||||||
} else {
|
} else {
|
||||||
// got response to some other command - the originally issued command was interrupted!
|
// got response to some other command - the originally issued command was interrupted!
|
||||||
|
static const char intr[] PROGMEM = "Intr2"; // @@TODO clean up
|
||||||
|
MMU2_ERROR_MSGRPGM(intr);
|
||||||
return Interrupted;
|
return Interrupted;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
|
|
@ -437,11 +440,19 @@ StepStatus ProtocolLogic::IdleStep() {
|
||||||
buttonCode = static_cast<Buttons>(rsp.paramValue);
|
buttonCode = static_cast<Buttons>(rsp.paramValue);
|
||||||
StartReading8bitRegisters();
|
StartReading8bitRegisters();
|
||||||
return ButtonPushed;
|
return ButtonPushed;
|
||||||
|
case ResponseMsgParamCodes::Finished:
|
||||||
|
if( ReqMsg().code != RequestMsgCodes::unknown ){
|
||||||
|
// got reset while doing some other command - the originally issued command was interrupted!
|
||||||
|
// this must be solved by the upper layer, protocol logic doesn't have all the context (like unload before trying again)
|
||||||
|
static const char intr[] PROGMEM = "Intr1"; // @@TODO cleanup
|
||||||
|
MMU2_ERROR_MSGRPGM(intr);
|
||||||
|
IdleRestart();
|
||||||
|
return Interrupted;
|
||||||
|
}
|
||||||
|
[[fallthrough]];
|
||||||
case ResponseMsgParamCodes::Processing:
|
case ResponseMsgParamCodes::Processing:
|
||||||
// @@TODO we may actually use this branch to report progress of manual operation on the MMU
|
// @@TODO we may actually use this branch to report progress of manual operation on the MMU
|
||||||
// The MMU sends e.g. X0 P27 after its restart when the user presses an MMU button to move the Selector
|
// The MMU sends e.g. X0 P27 after its restart when the user presses an MMU button to move the Selector
|
||||||
// For now let's behave just like "finished"
|
|
||||||
case ResponseMsgParamCodes::Finished:
|
|
||||||
errorCode = ErrorCode::OK;
|
errorCode = ErrorCode::OK;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue