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

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

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

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

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

Loading…
Cancel
Save