Make init MMU error screens send buttons (Idle mode)

This commit is contained in:
D.R.racer 2022-06-10 09:00:51 +02:00
parent b880559ba7
commit 236098dbca
4 changed files with 11 additions and 4 deletions

View File

@ -510,7 +510,7 @@ void MMU2::CheckUserInput(){
Button(btn);
break;
case RestartMMU:
Reset(CutThePower);
Reset(ResetPin); // we cannot do power cycle on the MK3
break;
case StopPrint:
// @@TODO not sure if we shall handle this high level operation at this spot
@ -576,14 +576,17 @@ StepStatus MMU2::LogicStep() {
break;
case CommandError:
ReportError(logic.Error());
CheckUserInput();
break;
case CommunicationTimeout:
state = xState::Connecting;
ReportError(ErrorCode::MMU_NOT_RESPONDING);
CheckUserInput();
break;
case ProtocolError:
state = xState::Connecting;
ReportError(ErrorCode::PROTOCOL_ERROR);
CheckUserInput();
break;
case VersionMismatch:
StopKeepPowered();

View File

@ -189,7 +189,9 @@ Buttons ButtonPressed(uint16_t ec) {
}
break;
case ERR_MECHANICAL_SELECTOR_CANNOT_HOME:
case ERR_MECHANICAL_SELECTOR_CANNOT_MOVE:
case ERR_MECHANICAL_IDLER_CANNOT_HOME:
case ERR_MECHANICAL_IDLER_CANNOT_MOVE:
case ERR_MECHANICAL_PULLEY_CANNOT_MOVE:
switch (buttonSelectedOperation) {
// may be allow move selector right and left in the future

View File

@ -271,8 +271,7 @@ StepStatus Idle::Step() {
switch (state) {
case State::Ready: // check timeout
if (logic->Elapsed(heartBeatPeriod)) {
logic->SendMsg(RequestMsg(RequestMsgCodes::Query, 0));
state = State::QuerySent;
SendQuery();
return Processing;
}
break;
@ -397,6 +396,9 @@ void ProtocolLogic::PlanGenericRequest(RequestMsg rq) {
bool ProtocolLogic::ActivatePlannedRequest(){
if( plannedRq.code == RequestMsgCodes::Button ){
// only issue the button to the MMU and do not restart the state machines
// @@TODO - this is not completely correct, but it does the job.
// In Idle mode the command part is not active, but we still need button handling in Idle mode (resolve MMU init errors)
// -> command.SendButton is not correct, but it sends the message and everything works (for now)
command.SendButton(plannedRq.value);
plannedRq = RequestMsg(RequestMsgCodes::unknown, 0);
return true;

View File

@ -191,7 +191,7 @@ enum class ReportErrorHookStates : uint8_t {
DISMISS_ERROR_SCREEN = 2,
};
enum ReportErrorHookStates ReportErrorHookState;
enum ReportErrorHookStates ReportErrorHookState = ReportErrorHookStates::RENDER_ERROR_SCREEN;
/**
* @brief Render MMU error screen on the LCD. This must be non-blocking