From 26cab2911f85f86b716cb4e9c7f0db37bc1d332c Mon Sep 17 00:00:00 2001 From: PavelSindler Date: Fri, 22 Feb 2019 16:30:54 +0100 Subject: [PATCH 1/3] mmu stealth mode --- Firmware/mmu.cpp | 7 ++++++- Firmware/variants/1_75mm_MK25-RAMBo10a-E3Dv6full.h | 3 ++- Firmware/variants/1_75mm_MK25-RAMBo13a-E3Dv6full.h | 3 ++- Firmware/variants/1_75mm_MK25S-RAMBo10a-E3Dv6full.h | 3 ++- Firmware/variants/1_75mm_MK25S-RAMBo13a-E3Dv6full.h | 3 ++- 5 files changed, 14 insertions(+), 5 deletions(-) diff --git a/Firmware/mmu.cpp b/Firmware/mmu.cpp index 2f7bf96c3..1c0e0a41e 100644 --- a/Firmware/mmu.cpp +++ b/Firmware/mmu.cpp @@ -223,7 +223,12 @@ void mmu_loop(void) if (!version_valid) mmu_show_warning(); else puts_P(PSTR("MMU version valid")); - if ((PRINTER_TYPE == PRINTER_MK3) || (PRINTER_TYPE == PRINTER_MK3_SNMM)) + bool activate_stealth_mode = (eeprom_read_byte((uint8_t*)EEPROM_SILENT) == SILENT_MODE_STEALTH); +#ifdef MMU_STEALTH_MODE + activate_stealth_mode = true; +#endif //MMU_STEALTH_MODE + + if (!activate_stealth_mode) { FDEBUG_PUTS_P(PSTR("MMU <= 'P0'")); mmu_puts_P(PSTR("P0\n")); //send 'read finda' request diff --git a/Firmware/variants/1_75mm_MK25-RAMBo10a-E3Dv6full.h b/Firmware/variants/1_75mm_MK25-RAMBo10a-E3Dv6full.h index a9dcefe41..dd836b69a 100644 --- a/Firmware/variants/1_75mm_MK25-RAMBo10a-E3Dv6full.h +++ b/Firmware/variants/1_75mm_MK25-RAMBo10a-E3Dv6full.h @@ -498,7 +498,8 @@ //#define SUPPORT_VERBOSITY #define MMU_REQUIRED_FW_BUILDNR 132 -//#define MMU_DEBUG //print communication between MMU2 and printer on serial +#define MMU_STEALTH_MODE +#define MMU_DEBUG //print communication between MMU2 and printer on serial #define MMU_IDLER_SENSOR_ATTEMPTS_NR 21 //max. number of attempts to load filament if first load failed; value for max bowden length and case when loading fails right at the beginning diff --git a/Firmware/variants/1_75mm_MK25-RAMBo13a-E3Dv6full.h b/Firmware/variants/1_75mm_MK25-RAMBo13a-E3Dv6full.h index 38d181349..9715aa7d9 100644 --- a/Firmware/variants/1_75mm_MK25-RAMBo13a-E3Dv6full.h +++ b/Firmware/variants/1_75mm_MK25-RAMBo13a-E3Dv6full.h @@ -499,7 +499,8 @@ //#define SUPPORT_VERBOSITY #define MMU_REQUIRED_FW_BUILDNR 132 -//#define MMU_DEBUG //print communication between MMU2 and printer on serial +#define MMU_STEALTH_MODE +#define MMU_DEBUG //print communication between MMU2 and printer on serial #define MMU_IDLER_SENSOR_ATTEMPTS_NR 21 //max. number of attempts to load filament if first load failed; value for max bowden length and case when loading fails right at the beginning diff --git a/Firmware/variants/1_75mm_MK25S-RAMBo10a-E3Dv6full.h b/Firmware/variants/1_75mm_MK25S-RAMBo10a-E3Dv6full.h index 53b545e8b..b814d1cbb 100644 --- a/Firmware/variants/1_75mm_MK25S-RAMBo10a-E3Dv6full.h +++ b/Firmware/variants/1_75mm_MK25S-RAMBo10a-E3Dv6full.h @@ -498,7 +498,8 @@ //#define SUPPORT_VERBOSITY #define MMU_REQUIRED_FW_BUILDNR 132 -//#define MMU_DEBUG //print communication between MMU2 and printer on serial +#define MMU_STEALTH_MODE +#define MMU_DEBUG //print communication between MMU2 and printer on serial #define MMU_IDLER_SENSOR_ATTEMPTS_NR 21 //max. number of attempts to load filament if first load failed; value for max bowden length and case when loading fails right at the beginning diff --git a/Firmware/variants/1_75mm_MK25S-RAMBo13a-E3Dv6full.h b/Firmware/variants/1_75mm_MK25S-RAMBo13a-E3Dv6full.h index e786b70ff..3f38a286f 100644 --- a/Firmware/variants/1_75mm_MK25S-RAMBo13a-E3Dv6full.h +++ b/Firmware/variants/1_75mm_MK25S-RAMBo13a-E3Dv6full.h @@ -499,7 +499,8 @@ //#define SUPPORT_VERBOSITY #define MMU_REQUIRED_FW_BUILDNR 132 -//#define MMU_DEBUG //print communication between MMU2 and printer on serial +#define MMU_STEALTH_MODE +#define MMU_DEBUG //print communication between MMU2 and printer on serial #define MMU_IDLER_SENSOR_ATTEMPTS_NR 21 //max. number of attempts to load filament if first load failed; value for max bowden length and case when loading fails right at the beginning From 8e3d52ee6db8f5a1135b32e5cfef8c67a695bf9d Mon Sep 17 00:00:00 2001 From: PavelSindler Date: Fri, 22 Feb 2019 17:15:40 +0100 Subject: [PATCH 2/3] fix compilation error for MK2.5, make code more readable --- Firmware/mmu.cpp | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/Firmware/mmu.cpp b/Firmware/mmu.cpp index 1c0e0a41e..d1be76d4c 100644 --- a/Firmware/mmu.cpp +++ b/Firmware/mmu.cpp @@ -181,6 +181,18 @@ bool check_for_ir_sensor() #endif //IR_SENSOR } +static bool activate_stealth_mode() +{ + bool activate_stealth_mode = false; +#ifdef SILENT_MODE_STEALTH + activate_stealth_mode = (eeprom_read_byte((uint8_t*)EEPROM_SILENT) == SILENT_MODE_STEALTH); +#endif //SILENT_MODE_STEALTH +#ifdef MMU_STEALTH_MODE + activate_stealth_mode = true; +#endif //MMU_STEALTH_MODE + return activate_stealth_mode; +} + //mmu main loop - state machine processing void mmu_loop(void) { @@ -222,13 +234,8 @@ void mmu_loop(void) bool version_valid = mmu_check_version(); if (!version_valid) mmu_show_warning(); else puts_P(PSTR("MMU version valid")); - - bool activate_stealth_mode = (eeprom_read_byte((uint8_t*)EEPROM_SILENT) == SILENT_MODE_STEALTH); -#ifdef MMU_STEALTH_MODE - activate_stealth_mode = true; -#endif //MMU_STEALTH_MODE - - if (!activate_stealth_mode) + + if (!activate_stealth_mode()) { FDEBUG_PUTS_P(PSTR("MMU <= 'P0'")); mmu_puts_P(PSTR("P0\n")); //send 'read finda' request From 7f92d73a40152d2c6907ba004e04a61316aca1ad Mon Sep 17 00:00:00 2001 From: PavelSindler Date: Mon, 4 Mar 2019 17:04:22 +0100 Subject: [PATCH 3/3] MMU_STEALTH_MODE -> MMU_FORCE_STEALTH_MODE; activate_stealth_mode() function update --- Firmware/mmu.cpp | 15 +++++++-------- .../variants/1_75mm_MK25-RAMBo10a-E3Dv6full.h | 2 +- .../variants/1_75mm_MK25-RAMBo13a-E3Dv6full.h | 2 +- .../variants/1_75mm_MK25S-RAMBo10a-E3Dv6full.h | 2 +- .../variants/1_75mm_MK25S-RAMBo13a-E3Dv6full.h | 2 +- 5 files changed, 11 insertions(+), 12 deletions(-) diff --git a/Firmware/mmu.cpp b/Firmware/mmu.cpp index d1be76d4c..522322650 100644 --- a/Firmware/mmu.cpp +++ b/Firmware/mmu.cpp @@ -183,14 +183,13 @@ bool check_for_ir_sensor() static bool activate_stealth_mode() { - bool activate_stealth_mode = false; -#ifdef SILENT_MODE_STEALTH - activate_stealth_mode = (eeprom_read_byte((uint8_t*)EEPROM_SILENT) == SILENT_MODE_STEALTH); -#endif //SILENT_MODE_STEALTH -#ifdef MMU_STEALTH_MODE - activate_stealth_mode = true; -#endif //MMU_STEALTH_MODE - return activate_stealth_mode; +#if defined (MMU_FORCE_STEALTH_MODE) + return true; +#elif defined (SILENT_MODE_STEALTH) + return (eeprom_read_byte((uint8_t*)EEPROM_SILENT) == SILENT_MODE_STEALTH); +#else + return false; +#endif } //mmu main loop - state machine processing diff --git a/Firmware/variants/1_75mm_MK25-RAMBo10a-E3Dv6full.h b/Firmware/variants/1_75mm_MK25-RAMBo10a-E3Dv6full.h index dd836b69a..40a3a229b 100644 --- a/Firmware/variants/1_75mm_MK25-RAMBo10a-E3Dv6full.h +++ b/Firmware/variants/1_75mm_MK25-RAMBo10a-E3Dv6full.h @@ -498,7 +498,7 @@ //#define SUPPORT_VERBOSITY #define MMU_REQUIRED_FW_BUILDNR 132 -#define MMU_STEALTH_MODE +#define MMU_FORCE_STEALTH_MODE #define MMU_DEBUG //print communication between MMU2 and printer on serial #define MMU_IDLER_SENSOR_ATTEMPTS_NR 21 //max. number of attempts to load filament if first load failed; value for max bowden length and case when loading fails right at the beginning diff --git a/Firmware/variants/1_75mm_MK25-RAMBo13a-E3Dv6full.h b/Firmware/variants/1_75mm_MK25-RAMBo13a-E3Dv6full.h index 9715aa7d9..e316c4f02 100644 --- a/Firmware/variants/1_75mm_MK25-RAMBo13a-E3Dv6full.h +++ b/Firmware/variants/1_75mm_MK25-RAMBo13a-E3Dv6full.h @@ -499,7 +499,7 @@ //#define SUPPORT_VERBOSITY #define MMU_REQUIRED_FW_BUILDNR 132 -#define MMU_STEALTH_MODE +#define MMU_FORCE_STEALTH_MODE #define MMU_DEBUG //print communication between MMU2 and printer on serial #define MMU_IDLER_SENSOR_ATTEMPTS_NR 21 //max. number of attempts to load filament if first load failed; value for max bowden length and case when loading fails right at the beginning diff --git a/Firmware/variants/1_75mm_MK25S-RAMBo10a-E3Dv6full.h b/Firmware/variants/1_75mm_MK25S-RAMBo10a-E3Dv6full.h index b814d1cbb..d3badf6aa 100644 --- a/Firmware/variants/1_75mm_MK25S-RAMBo10a-E3Dv6full.h +++ b/Firmware/variants/1_75mm_MK25S-RAMBo10a-E3Dv6full.h @@ -498,7 +498,7 @@ //#define SUPPORT_VERBOSITY #define MMU_REQUIRED_FW_BUILDNR 132 -#define MMU_STEALTH_MODE +#define MMU_FORCE_STEALTH_MODE #define MMU_DEBUG //print communication between MMU2 and printer on serial #define MMU_IDLER_SENSOR_ATTEMPTS_NR 21 //max. number of attempts to load filament if first load failed; value for max bowden length and case when loading fails right at the beginning diff --git a/Firmware/variants/1_75mm_MK25S-RAMBo13a-E3Dv6full.h b/Firmware/variants/1_75mm_MK25S-RAMBo13a-E3Dv6full.h index 3f38a286f..2563f848a 100644 --- a/Firmware/variants/1_75mm_MK25S-RAMBo13a-E3Dv6full.h +++ b/Firmware/variants/1_75mm_MK25S-RAMBo13a-E3Dv6full.h @@ -499,7 +499,7 @@ //#define SUPPORT_VERBOSITY #define MMU_REQUIRED_FW_BUILDNR 132 -#define MMU_STEALTH_MODE +#define MMU_FORCE_STEALTH_MODE #define MMU_DEBUG //print communication between MMU2 and printer on serial #define MMU_IDLER_SENSOR_ATTEMPTS_NR 21 //max. number of attempts to load filament if first load failed; value for max bowden length and case when loading fails right at the beginning