From a9e9a9857b5b87cdd1dd54573b14da5e55efb3b0 Mon Sep 17 00:00:00 2001
From: Marek Bel <marek.bel@posta.cz>
Date: Thu, 25 Jul 2019 19:09:52 +0200
Subject: [PATCH] Fix "MMU needs attention screen is missing in case of failed
 unload filament".

---
 Firmware/mmu.cpp | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/Firmware/mmu.cpp b/Firmware/mmu.cpp
index 2d3f8990..58370f7d 100644
--- a/Firmware/mmu.cpp
+++ b/Firmware/mmu.cpp
@@ -379,9 +379,11 @@ void mmu_loop(void)
 		}
 		else if ((mmu_last_request + MMU_CMD_TIMEOUT) < _millis())
 		{ //resend request after timeout (5 min)
-			if (mmu_last_cmd >= MmuCmd::T0 && mmu_last_cmd <= MmuCmd::T4)
+			if (mmu_last_cmd != MmuCmd::None)
 			{
-				if (mmu_attempt_nr++ < MMU_MAX_RESEND_ATTEMPTS) {
+				if (mmu_attempt_nr++ < MMU_MAX_RESEND_ATTEMPTS &&
+				    mmu_last_cmd >= MmuCmd::T0 && mmu_last_cmd <= MmuCmd::T4)
+				{
 				    DEBUG_PRINTF_P(PSTR("MMU retry attempt nr. %d\n"), mmu_attempt_nr - 1);
 					mmu_cmd = mmu_last_cmd;
 				}