Procházet zdrojové kódy

Make init MMU error screens send buttons (Idle mode)

D.R.racer před 3 roky
rodič
revize
236098dbca

+ 4 - 1
Firmware/mmu2.cpp

@@ -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();

+ 2 - 0
Firmware/mmu2_error_converter.cpp

@@ -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

+ 4 - 2
Firmware/mmu2_protocol_logic.cpp

@@ -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;

+ 1 - 1
Firmware/mmu2_reporting.cpp

@@ -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