Browse Source

🎨 Add MMU2 enabled() accessor

Scott Lahteine 3 years ago
parent
commit
be1801703c

+ 14
- 14
Marlin/src/feature/mmu/mmu2.cpp View File

75
 #define MMU2_NO_TOOL 99
75
 #define MMU2_NO_TOOL 99
76
 #define MMU_BAUD    115200
76
 #define MMU_BAUD    115200
77
 
77
 
78
-bool MMU2::enabled, MMU2::ready, MMU2::mmu_print_saved;
78
+bool MMU2::_enabled, MMU2::ready, MMU2::mmu_print_saved;
79
 #if HAS_PRUSA_MMU2S
79
 #if HAS_PRUSA_MMU2S
80
   bool MMU2::mmu2s_triggered;
80
   bool MMU2::mmu2s_triggered;
81
 #endif
81
 #endif
219
 
219
 
220
         DEBUG_ECHOLNPAIR("MMU => ", finda, "\nMMU - ENABLED");
220
         DEBUG_ECHOLNPAIR("MMU => ", finda, "\nMMU - ENABLED");
221
 
221
 
222
-        enabled = true;
222
+        _enabled = true;
223
         state = 1;
223
         state = 1;
224
         TERN_(HAS_PRUSA_MMU2S, mmu2s_triggered = false);
224
         TERN_(HAS_PRUSA_MMU2S, mmu2s_triggered = false);
225
       }
225
       }
480
    */
480
    */
481
   void MMU2::tool_change(const uint8_t index) {
481
   void MMU2::tool_change(const uint8_t index) {
482
 
482
 
483
-    if (!enabled) return;
483
+    if (!_enabled) return;
484
 
484
 
485
     set_runout_valid(false);
485
     set_runout_valid(false);
486
 
486
 
512
    * Tc Load to nozzle after filament was prepared by Tx and extruder nozzle is already heated.
512
    * Tc Load to nozzle after filament was prepared by Tx and extruder nozzle is already heated.
513
    */
513
    */
514
   void MMU2::tool_change(const char *special) {
514
   void MMU2::tool_change(const char *special) {
515
-      if (!enabled) return;
515
+      if (!_enabled) return;
516
 
516
 
517
       set_runout_valid(false);
517
       set_runout_valid(false);
518
 
518
 
561
    * Handle tool change
561
    * Handle tool change
562
    */
562
    */
563
   void MMU2::tool_change(const uint8_t index) {
563
   void MMU2::tool_change(const uint8_t index) {
564
-    if (!enabled) return;
564
+    if (!_enabled) return;
565
 
565
 
566
     set_runout_valid(false);
566
     set_runout_valid(false);
567
 
567
 
599
    * Tc Load to nozzle after filament was prepared by Tx and extruder nozzle is already heated.
599
    * Tc Load to nozzle after filament was prepared by Tx and extruder nozzle is already heated.
600
    */
600
    */
601
   void MMU2::tool_change(const char *special) {
601
   void MMU2::tool_change(const char *special) {
602
-    if (!enabled) return;
602
+    if (!_enabled) return;
603
 
603
 
604
     set_runout_valid(false);
604
     set_runout_valid(false);
605
 
605
 
665
    * Handle tool change
665
    * Handle tool change
666
    */
666
    */
667
   void MMU2::tool_change(const uint8_t index) {
667
   void MMU2::tool_change(const uint8_t index) {
668
-    if (!enabled) return;
668
+    if (!_enabled) return;
669
 
669
 
670
     set_runout_valid(false);
670
     set_runout_valid(false);
671
 
671
 
693
    * Tc Load to nozzle after filament was prepared by Tx and extruder nozzle is already heated.
693
    * Tc Load to nozzle after filament was prepared by Tx and extruder nozzle is already heated.
694
    */
694
    */
695
   void MMU2::tool_change(const char *special) {
695
   void MMU2::tool_change(const char *special) {
696
-    if (!enabled) return;
696
+    if (!_enabled) return;
697
 
697
 
698
     set_runout_valid(false);
698
     set_runout_valid(false);
699
 
699
 
744
  * Set next command
744
  * Set next command
745
  */
745
  */
746
 void MMU2::command(const uint8_t mmu_cmd) {
746
 void MMU2::command(const uint8_t mmu_cmd) {
747
-  if (!enabled) return;
747
+  if (!_enabled) return;
748
   cmd = mmu_cmd;
748
   cmd = mmu_cmd;
749
   ready = false;
749
   ready = false;
750
 }
750
 }
833
 }
833
 }
834
 
834
 
835
 void MMU2::set_filament_type(const uint8_t index, const uint8_t filamentType) {
835
 void MMU2::set_filament_type(const uint8_t index, const uint8_t filamentType) {
836
-  if (!enabled) return;
836
+  if (!_enabled) return;
837
 
837
 
838
   cmd_arg = filamentType;
838
   cmd_arg = filamentType;
839
   command(MMU_CMD_F0 + index);
839
   command(MMU_CMD_F0 + index);
892
 
892
 
893
 // Load filament into MMU2
893
 // Load filament into MMU2
894
 void MMU2::load_filament(const uint8_t index) {
894
 void MMU2::load_filament(const uint8_t index) {
895
-  if (!enabled) return;
895
+  if (!_enabled) return;
896
 
896
 
897
   command(MMU_CMD_L0 + index);
897
   command(MMU_CMD_L0 + index);
898
   manage_response(false, false);
898
   manage_response(false, false);
904
  */
904
  */
905
 bool MMU2::load_filament_to_nozzle(const uint8_t index) {
905
 bool MMU2::load_filament_to_nozzle(const uint8_t index) {
906
 
906
 
907
-  if (!enabled) return false;
907
+  if (!_enabled) return false;
908
 
908
 
909
   if (thermalManager.tooColdToExtrude(active_extruder)) {
909
   if (thermalManager.tooColdToExtrude(active_extruder)) {
910
     BUZZ(200, 404);
910
     BUZZ(200, 404);
940
 
940
 
941
 bool MMU2::eject_filament(const uint8_t index, const bool recover) {
941
 bool MMU2::eject_filament(const uint8_t index, const bool recover) {
942
 
942
 
943
-  if (!enabled) return false;
943
+  if (!_enabled) return false;
944
 
944
 
945
   if (thermalManager.tooColdToExtrude(active_extruder)) {
945
   if (thermalManager.tooColdToExtrude(active_extruder)) {
946
     BUZZ(200, 404);
946
     BUZZ(200, 404);
989
  */
989
  */
990
 bool MMU2::unload() {
990
 bool MMU2::unload() {
991
 
991
 
992
-  if (!enabled) return false;
992
+  if (!_enabled) return false;
993
 
993
 
994
   if (thermalManager.tooColdToExtrude(active_extruder)) {
994
   if (thermalManager.tooColdToExtrude(active_extruder)) {
995
     BUZZ(200, 404);
995
     BUZZ(200, 404);

+ 2
- 1
Marlin/src/feature/mmu/mmu2.h View File

43
 
43
 
44
   static void init();
44
   static void init();
45
   static void reset();
45
   static void reset();
46
+  static inline bool enabled() { return _enabled; }
46
   static void mmu_loop();
47
   static void mmu_loop();
47
   static void tool_change(const uint8_t index);
48
   static void tool_change(const uint8_t index);
48
   static void tool_change(const char *special);
49
   static void tool_change(const char *special);
88
     static void mmu_continue_loading();
89
     static void mmu_continue_loading();
89
   #endif
90
   #endif
90
 
91
 
91
-  static bool enabled, ready, mmu_print_saved;
92
+  static bool _enabled, ready, mmu_print_saved;
92
 
93
 
93
   static uint8_t cmd, cmd_arg, last_cmd, extruder;
94
   static uint8_t cmd, cmd_arg, last_cmd, extruder;
94
   static int8_t state;
95
   static int8_t state;

+ 1
- 1
Marlin/src/pins/stm32f1/pins_MKS_ROBIN_E3_common.h View File

166
     #define DOGLCD_SCK                      PB13
166
     #define DOGLCD_SCK                      PB13
167
     #define FORCE_SOFT_SPI
167
     #define FORCE_SOFT_SPI
168
     #define SOFTWARE_SPI
168
     #define SOFTWARE_SPI
169
-    
169
+
170
   #else
170
   #else
171
 
171
 
172
     #define LCD_PINS_D4                     PA6
172
     #define LCD_PINS_D4                     PA6

Loading…
Cancel
Save