Browse Source

Add a read function for mmu_print_saved
and remove the old extern value which is not used anymore

I had to remove "MMU2::" from mmu2_protocol_logic.cpp, otherwise the build failed.

Guðni Már Gilbert 2 years ago
parent
commit
11290c1123
4 changed files with 8 additions and 7 deletions
  1. 1 0
      Firmware/Marlin.h
  2. 0 3
      Firmware/Marlin_main.cpp
  3. 4 1
      Firmware/mmu2.h
  4. 3 3
      Firmware/mmu2_protocol_logic.cpp

+ 1 - 0
Firmware/Marlin.h

@@ -21,6 +21,7 @@
 #include "Configuration.h"
 #include "pins.h"
 #include "Timer.h"
+#include "mmu2.h"
 extern uint8_t mbl_z_probe_nr;
 
 #ifndef AT90USB

+ 0 - 3
Firmware/Marlin_main.cpp

@@ -295,9 +295,6 @@ float saved_start_position[NUM_AXIS] = {SAVED_START_POSITION_UNSET, 0, 0, 0};
 
 uint16_t saved_segment_idx = 0;
 
-// save/restore printing in case that mmu was not responding 
-bool mmu_print_saved = false;
-
 // storing estimated time to end of print counted by slicer
 uint8_t print_percent_done_normal = PRINT_PERCENT_DONE_INIT;
 uint8_t print_percent_done_silent = PRINT_PERCENT_DONE_INIT;

+ 4 - 1
Firmware/mmu2.h

@@ -129,7 +129,10 @@ public:
             return { 0, 0, 0}; 
         }
     }
-    
+
+    /// Method to read-only mmu_print_saved
+    bool MMU_PRINT_SAVED() const { return mmu_print_saved; }
+
 private:
     /// Perform software self-reset of the MMU (sends an X0 command)
     void ResetX0();

+ 3 - 3
Firmware/mmu2_protocol_logic.cpp

@@ -344,7 +344,7 @@ void ProtocolLogic::PlanGenericRequest(RequestMsg rq) {
     } // otherwise wait for an empty window to activate the request
 }
 
-bool MMU2::ProtocolLogic::ActivatePlannedRequest(){
+bool ProtocolLogic::ActivatePlannedRequest(){
     if( plannedRq.code == RequestMsgCodes::Button ){
         // only issue the button to the MMU and do not restart the state machines
         command.SendButton(plannedRq.value);
@@ -466,7 +466,7 @@ void ProtocolLogic::LogRequestMsg(const uint8_t *txbuff, uint8_t size){
     memcpy(lastMsg, tmp, rqs);
 }
 
-void MMU2::ProtocolLogic::LogError(const char *reason){
+void ProtocolLogic::LogError(const char *reason){
     char lrb[lastReceivedBytes.size() * 3];
     FormatLastReceivedBytes(lrb);
     
@@ -482,7 +482,7 @@ void ProtocolLogic::LogResponse(){
     SERIAL_ECHOLN();
 }
 
-StepStatus MMU2::ProtocolLogic::HandleCommError(const char *msg, StepStatus ss){
+StepStatus ProtocolLogic::HandleCommError(const char *msg, StepStatus ss){
     protocol.ResetResponseDecoder();
     HandleCommunicationTimeout();
     if( dataTO.Record(ss) ){