Pārlūkot izejas kodu

PFW-1354 Fix slow button processing (#37)

* Fix MK3S buttons being processed too slowly

After a button is selected on the MK3S MMU error screen, we need to process it before asking for another MMU Query.

Because the MMU Query will make the Error screen return and overwrite the status screen

* Add back CheckUserInput for ButtonPushed event
Guðni Már Gilbert 2 gadi atpakaļ
vecāks
revīzija
6b7a018f9b
1 mainītis faili ar 2 papildinājumiem un 5 dzēšanām
  1. 2 5
      Firmware/mmu2.cpp

+ 2 - 5
Firmware/mmu2.cpp

@@ -678,6 +678,7 @@ void MMU2::manage_response(const bool move_axes, const bool turn_off_nozzle) {
 }
 }
 
 
 StepStatus MMU2::LogicStep() {
 StepStatus MMU2::LogicStep() {
+    CheckUserInput(); // Process any buttons before proceeding with another MMU Query
     StepStatus ss = logic.Step();
     StepStatus ss = logic.Step();
     switch (ss) {
     switch (ss) {
     case Finished:
     case Finished:
@@ -686,27 +687,23 @@ StepStatus MMU2::LogicStep() {
         break;
         break;
     case CommandError:
     case CommandError:
         ReportError(logic.Error(), ErrorSourceMMU);
         ReportError(logic.Error(), ErrorSourceMMU);
-        CheckUserInput();
         break;
         break;
     case CommunicationTimeout:
     case CommunicationTimeout:
         state = xState::Connecting;
         state = xState::Connecting;
         ReportError(ErrorCode::MMU_NOT_RESPONDING, ErrorSourcePrinter);
         ReportError(ErrorCode::MMU_NOT_RESPONDING, ErrorSourcePrinter);
-        CheckUserInput();
         break;
         break;
     case ProtocolError:
     case ProtocolError:
         state = xState::Connecting;
         state = xState::Connecting;
         ReportError(ErrorCode::PROTOCOL_ERROR, ErrorSourcePrinter);
         ReportError(ErrorCode::PROTOCOL_ERROR, ErrorSourcePrinter);
-        CheckUserInput();
         break;
         break;
     case VersionMismatch:
     case VersionMismatch:
         StopKeepPowered();
         StopKeepPowered();
         ReportError(ErrorCode::VERSION_MISMATCH, ErrorSourcePrinter);
         ReportError(ErrorCode::VERSION_MISMATCH, ErrorSourcePrinter);
-        CheckUserInput();
         break;
         break;
     case ButtonPushed:
     case ButtonPushed:
         lastButton = logic.Button();
         lastButton = logic.Button();
         LogEchoEvent("MMU Button pushed");
         LogEchoEvent("MMU Button pushed");
-        CheckUserInput();
+        CheckUserInput(); // Process the button immediately
         break;
         break;
     default:
     default:
         break;
         break;