Browse Source

Move M360-M364 to cpp

Scott Lahteine 7 years ago
parent
commit
9be8cb0ac9
3 changed files with 23 additions and 31 deletions
  1. 0
    4
      Marlin/src/Marlin.cpp
  2. 6
    21
      Marlin/src/gcode/gcode.cpp
  3. 17
    6
      Marlin/src/gcode/scara/M360-M364.cpp

+ 0
- 4
Marlin/src/Marlin.cpp View File

@@ -352,10 +352,6 @@ bool pin_is_protected(const int8_t pin) {
352 352
   return false;
353 353
 }
354 354
 
355
-#if ENABLED(MORGAN_SCARA)
356
-  #include "gcode/scara/M360-M364.h"
357
-#endif
358
-
359 355
 #if ENABLED(EXT_SOLENOID)
360 356
   #include "gcode/control/M380_M381.h"
361 357
 #endif

+ 6
- 21
Marlin/src/gcode/gcode.cpp View File

@@ -122,11 +122,6 @@ extern void gcode_M165();
122 122
 extern void gcode_M350();
123 123
 extern void gcode_M351();
124 124
 extern void gcode_M355();
125
-extern bool gcode_M360();
126
-extern bool gcode_M361();
127
-extern bool gcode_M362();
128
-extern bool gcode_M363();
129
-extern bool gcode_M364();
130 125
 extern void gcode_M380();
131 126
 extern void gcode_M381();
132 127
 extern void gcode_M400();
@@ -594,22 +589,12 @@ void GcodeSuite::process_next_command() {
594 589
         break;
595 590
 
596 591
       #if ENABLED(MORGAN_SCARA)
597
-        case 360:  // M360: SCARA Theta pos1
598
-          if (gcode_M360()) return;
599
-          break;
600
-        case 361:  // M361: SCARA Theta pos2
601
-          if (gcode_M361()) return;
602
-          break;
603
-        case 362:  // M362: SCARA Psi pos1
604
-          if (gcode_M362()) return;
605
-          break;
606
-        case 363:  // M363: SCARA Psi pos2
607
-          if (gcode_M363()) return;
608
-          break;
609
-        case 364:  // M364: SCARA Psi pos3 (90 deg to Theta)
610
-          if (gcode_M364()) return;
611
-          break;
612
-      #endif // SCARA
592
+        case 360: if (M360()) return; break;  // M360: SCARA Theta pos1
593
+        case 361: if (M361()) return; break;  // M361: SCARA Theta pos2
594
+        case 362: if (M362()) return; break;  // M362: SCARA Psi pos1
595
+        case 363: if (M363()) return; break;  // M363: SCARA Psi pos2
596
+        case 364: if (M364()) return; break;  // M364: SCARA Psi pos3 (90 deg to Theta)
597
+      #endif
613 598
 
614 599
       #if ENABLED(EXT_SOLENOID)
615 600
         case 380: // M380: Activate solenoid on active extruder

Marlin/src/gcode/scara/M360-M364.h → Marlin/src/gcode/scara/M360-M364.cpp View File

@@ -20,7 +20,16 @@
20 20
  *
21 21
  */
22 22
 
23
-bool SCARA_move_to_cal(uint8_t delta_a, uint8_t delta_b) {
23
+#include "../../inc/MarlinConfig.h"
24
+
25
+#if ENABLED(MORGAN_SCARA)
26
+
27
+#include "../gcode.h"
28
+#include "../../module/scara.h"
29
+#include "../../module/motion.h"
30
+#include "../../Marlin.h" // for IsRunning()
31
+
32
+inline bool SCARA_move_to_cal(const uint8_t delta_a, const uint8_t delta_b) {
24 33
   if (IsRunning()) {
25 34
     forward_kinematics_SCARA(delta_a, delta_b);
26 35
     destination[X_AXIS] = LOGICAL_X_POSITION(cartes[X_AXIS]);
@@ -35,7 +44,7 @@ bool SCARA_move_to_cal(uint8_t delta_a, uint8_t delta_b) {
35 44
 /**
36 45
  * M360: SCARA calibration: Move to cal-position ThetaA (0 deg calibration)
37 46
  */
38
-bool gcode_M360() {
47
+bool GcodeSuite::M360() {
39 48
   SERIAL_ECHOLNPGM(" Cal: Theta 0");
40 49
   return SCARA_move_to_cal(0, 120);
41 50
 }
@@ -43,7 +52,7 @@ bool gcode_M360() {
43 52
 /**
44 53
  * M361: SCARA calibration: Move to cal-position ThetaB (90 deg calibration - steps per degree)
45 54
  */
46
-bool gcode_M361() {
55
+bool GcodeSuite::M361() {
47 56
   SERIAL_ECHOLNPGM(" Cal: Theta 90");
48 57
   return SCARA_move_to_cal(90, 130);
49 58
 }
@@ -51,7 +60,7 @@ bool gcode_M361() {
51 60
 /**
52 61
  * M362: SCARA calibration: Move to cal-position PsiA (0 deg calibration)
53 62
  */
54
-bool gcode_M362() {
63
+bool GcodeSuite::M362() {
55 64
   SERIAL_ECHOLNPGM(" Cal: Psi 0");
56 65
   return SCARA_move_to_cal(60, 180);
57 66
 }
@@ -59,7 +68,7 @@ bool gcode_M362() {
59 68
 /**
60 69
  * M363: SCARA calibration: Move to cal-position PsiB (90 deg calibration - steps per degree)
61 70
  */
62
-bool gcode_M363() {
71
+bool GcodeSuite::M363() {
63 72
   SERIAL_ECHOLNPGM(" Cal: Psi 90");
64 73
   return SCARA_move_to_cal(50, 90);
65 74
 }
@@ -67,7 +76,9 @@ bool gcode_M363() {
67 76
 /**
68 77
  * M364: SCARA calibration: Move to cal-position PsiC (90 deg to Theta calibration position)
69 78
  */
70
-bool gcode_M364() {
79
+bool GcodeSuite::M364() {
71 80
   SERIAL_ECHOLNPGM(" Cal: Theta-Psi 90");
72 81
   return SCARA_move_to_cal(45, 135);
73 82
 }
83
+
84
+#endif // MORGAN_SCARA

Loading…
Cancel
Save