From 68f2e22dad1126d38e48a10aff918ddad9727908 Mon Sep 17 00:00:00 2001 From: PavelSindler Date: Fri, 24 Aug 2018 18:28:05 +0200 Subject: [PATCH 1/3] continue loading command --- Firmware/Marlin_main.cpp | 2 +- Firmware/mmu.cpp | 9 ++++++++- Firmware/mmu.h | 1 + 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index 6aea1214..046ed3ec 100644 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -6808,7 +6808,7 @@ if (mmu_enabled) mmu_command(MMU_CMD_T0 + tmp_extruder); manage_response(true, true); - + mmu_command(MMU_CMD_C0); mmu_extruder = tmp_extruder; //filament change is finished if (*(strchr_pointer + index) == '?')// for single material usage with mmu diff --git a/Firmware/mmu.cpp b/Firmware/mmu.cpp index 843f415c..c644bdb7 100644 --- a/Firmware/mmu.cpp +++ b/Firmware/mmu.cpp @@ -162,6 +162,12 @@ void mmu_loop(void) mmu_printf_P(PSTR("T%d\n"), extruder); mmu_state = 3; // wait for response } + else if (mmu_cmd == MMU_CMD_C0) + { + printf_P(PSTR("MMU <= 'C0'\n")); + mmu_puts_P(PSTR("C0\n")); //send continue loading + mmu_state = 3; + } mmu_cmd = 0; } else if ((mmu_last_response + 1000) < millis()) //request every 1s @@ -188,7 +194,7 @@ void mmu_loop(void) case 3: //response to commands T0-T4 if (mmu_rx_ok() > 0) { - printf_P(PSTR("MMU => 'ok'\n"), mmu_finda); + printf_P(PSTR("MMU => 'ok'\n")); mmu_ready = true; mmu_state = 1; } @@ -395,6 +401,7 @@ void mmu_M600_load_filament(bool automatic) mmu_command(MMU_CMD_T0 + tmp_extruder); manage_response(false, true); + mmu_command(MMU_CMD_C0); mmu_extruder = tmp_extruder; //filament change is finished mmu_load_to_nozzle(); diff --git a/Firmware/mmu.h b/Firmware/mmu.h index 763c15ea..144f2ef2 100644 --- a/Firmware/mmu.h +++ b/Firmware/mmu.h @@ -23,6 +23,7 @@ extern int16_t mmu_buildnr; #define MMU_CMD_T2 0x12 #define MMU_CMD_T3 0x13 #define MMU_CMD_T4 0x14 +#define MMU_CMD_C0 0x30 extern int mmu_puts_P(const char* str); From 32723d8d6f5bd516fbaa07f52e2dcf5b9da93bcc Mon Sep 17 00:00:00 2001 From: PavelSindler Date: Fri, 24 Aug 2018 20:30:44 +0200 Subject: [PATCH 2/3] whitespace --- Firmware/mmu.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Firmware/mmu.h b/Firmware/mmu.h index 156ee08b..643cf29b 100644 --- a/Firmware/mmu.h +++ b/Firmware/mmu.h @@ -28,7 +28,7 @@ extern int16_t mmu_buildnr; #define MMU_CMD_L2 0x22 #define MMU_CMD_L3 0x23 #define MMU_CMD_L4 0x24 -#define MMU_CMD_C0 0x30 +#define MMU_CMD_C0 0x30 extern int mmu_puts_P(const char* str); From 1f5bece0dba8b18ae6e277ad75c184e8edc6dc18 Mon Sep 17 00:00:00 2001 From: PavelSindler Date: Sat, 25 Aug 2018 16:15:35 +0200 Subject: [PATCH 3/3] check for required mmu2 firmware buildnr --- Firmware/mmu.cpp | 15 +++++++++++++++ Firmware/mmu.h | 4 ++++ 2 files changed, 19 insertions(+) diff --git a/Firmware/mmu.cpp b/Firmware/mmu.cpp index 977c3fe1..0ffccc29 100644 --- a/Firmware/mmu.cpp +++ b/Firmware/mmu.cpp @@ -23,6 +23,7 @@ extern char choose_extruder_menu(); #define MMU_HWRESET #define MMU_RST_PIN 76 +#define MMU_REQUIRED_FW_BUILDNR 81 bool mmu_enabled = false; @@ -137,6 +138,9 @@ void mmu_loop(void) { fscanf_P(uart2io, PSTR("%u"), &mmu_buildnr); //scan buildnr from buffer printf_P(PSTR("MMU => '%dok'\n"), mmu_buildnr); + bool version_valid = mmu_check_version(); + if (!version_valid) mmu_show_warning(); + else puts_P(PSTR("MMU version valid")); puts_P(PSTR("MMU <= 'P0'")); mmu_puts_P(PSTR("P0\n")); //send 'read finda' request mmu_state = -4; @@ -826,3 +830,14 @@ void extr_unload_4() change_extr(4); extr_unload(); } + +bool mmu_check_version() +{ + return (mmu_buildnr >= MMU_REQUIRED_FW_BUILDNR); +} + +void mmu_show_warning() +{ + printf_P(PSTR("MMU2 firmware version invalid. Required version: build number %d or higher."), MMU_REQUIRED_FW_BUILDNR); + kill(_i("Please update firmware in your MMU2. Waiting for reset.")); +} diff --git a/Firmware/mmu.h b/Firmware/mmu.h index 643cf29b..a24dc4cc 100644 --- a/Firmware/mmu.h +++ b/Firmware/mmu.h @@ -80,3 +80,7 @@ extern void extr_unload_1(); extern void extr_unload_2(); extern void extr_unload_3(); extern void extr_unload_4(); + +extern bool mmu_check_version(); +extern void mmu_show_warning(); +