From 11290c112321f52f06b8443af22099f2fe573233 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gu=C3=B0ni=20M=C3=A1r=20Gilbert?= Date: Sun, 24 Apr 2022 14:01:37 +0000 Subject: [PATCH] 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. --- Firmware/Marlin.h | 1 + Firmware/Marlin_main.cpp | 3 --- Firmware/mmu2.h | 5 ++++- Firmware/mmu2_protocol_logic.cpp | 6 +++--- 4 files changed, 8 insertions(+), 7 deletions(-) diff --git a/Firmware/Marlin.h b/Firmware/Marlin.h index da63894db..475051669 100755 --- a/Firmware/Marlin.h +++ b/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 diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index 45c2a512b..969f015af 100644 --- a/Firmware/Marlin_main.cpp +++ b/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; diff --git a/Firmware/mmu2.h b/Firmware/mmu2.h index b3d07c523..d08e8624a 100644 --- a/Firmware/mmu2.h +++ b/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(); diff --git a/Firmware/mmu2_protocol_logic.cpp b/Firmware/mmu2_protocol_logic.cpp index 5dd9fee05..d748c3c61 100644 --- a/Firmware/mmu2_protocol_logic.cpp +++ b/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) ){