Browse Source

Move M900 to cpp

Scott Lahteine 7 years ago
parent
commit
19dde5be03
3 changed files with 13 additions and 10 deletions
  1. 0
    4
      Marlin/src/Marlin.cpp
  2. 12
    2
      Marlin/src/gcode/feature/advance/M900.cpp
  3. 1
    4
      Marlin/src/gcode/gcode.cpp

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

359
   SYNC_PLAN_POSITION_KINEMATIC();
359
   SYNC_PLAN_POSITION_KINEMATIC();
360
 }
360
 }
361
 
361
 
362
-#if ENABLED(LIN_ADVANCE)
363
-  #include "gcode/feature/advance/M900.h"
364
-#endif
365
-
366
 #if ENABLED(HAVE_TMC2130)
362
 #if ENABLED(HAVE_TMC2130)
367
   #include "feature/tmc2130.h"
363
   #include "feature/tmc2130.h"
368
   #include "gcode/feature/trinamic/M906.h"
364
   #include "gcode/feature/trinamic/M906.h"

Marlin/src/gcode/feature/advance/M900.h → Marlin/src/gcode/feature/advance/M900.cpp View File

20
  *
20
  *
21
  */
21
  */
22
 
22
 
23
+#include "../../../inc/MarlinConfig.h"
24
+
25
+#if ENABLED(LIN_ADVANCE)
26
+
27
+#include "../../gcode.h"
28
+#include "../../../module/planner.h"
29
+#include "../../../module/stepper.h"
30
+
23
 /**
31
 /**
24
  * M900: Set and/or Get advance K factor and WH/D ratio
32
  * M900: Set and/or Get advance K factor and WH/D ratio
25
  *
33
  *
27
  *  R<ratio>                   Set ratio directly (overrides WH/D)
35
  *  R<ratio>                   Set ratio directly (overrides WH/D)
28
  *  W<width> H<height> D<diam> Set ratio from WH/D
36
  *  W<width> H<height> D<diam> Set ratio from WH/D
29
  */
37
  */
30
-void gcode_M900() {
38
+void GcodeSuite::M900() {
31
   stepper.synchronize();
39
   stepper.synchronize();
32
 
40
 
33
   const float newK = parser.floatval('K', -1);
41
   const float newK = parser.floatval('K', -1);
39
                 newW = parser.floatval('W', -1),
47
                 newW = parser.floatval('W', -1),
40
                 newH = parser.floatval('H', -1);
48
                 newH = parser.floatval('H', -1);
41
     if (newD >= 0 && newW >= 0 && newH >= 0)
49
     if (newD >= 0 && newW >= 0 && newH >= 0)
42
-      newR = newD ? (newW * newH) / (sq(newD * 0.5) * M_PI) : 0;
50
+      newR = newD ? (newW * newH) / CIRCLE_AREA(newD * 0.5) : 0;
43
   }
51
   }
44
   if (newR >= 0) planner.advance_ed_ratio = newR;
52
   if (newR >= 0) planner.advance_ed_ratio = newR;
45
 
53
 
50
   if (ratio) SERIAL_ECHO(ratio); else SERIAL_ECHOPGM("Auto");
58
   if (ratio) SERIAL_ECHO(ratio); else SERIAL_ECHOPGM("Auto");
51
   SERIAL_EOL();
59
   SERIAL_EOL();
52
 }
60
 }
61
+
62
+#endif // LIN_ADVANCE

+ 1
- 4
Marlin/src/gcode/gcode.cpp View File

122
 extern void gcode_M350();
122
 extern void gcode_M350();
123
 extern void gcode_M351();
123
 extern void gcode_M351();
124
 extern void gcode_M355();
124
 extern void gcode_M355();
125
-extern void gcode_M900();
126
 extern void gcode_M906();
125
 extern void gcode_M906();
127
 extern void gcode_M911();
126
 extern void gcode_M911();
128
 extern void gcode_M912();
127
 extern void gcode_M912();
658
       #endif
657
       #endif
659
 
658
 
660
       #if ENABLED(LIN_ADVANCE)
659
       #if ENABLED(LIN_ADVANCE)
661
-        case 900: // M900: Set advance K factor.
662
-          gcode_M900();
663
-          break;
660
+        case 900: M900(); break;  // M900: Set advance K factor.
664
       #endif
661
       #endif
665
 
662
 
666
       #if ENABLED(HAVE_TMC2130)
663
       #if ENABLED(HAVE_TMC2130)

Loading…
Cancel
Save