Move M900 to cpp

This commit is contained in:
Scott Lahteine 2017-09-17 17:42:53 -05:00
parent 1b0acbff72
commit 19dde5be03
3 changed files with 13 additions and 10 deletions

View File

@ -359,10 +359,6 @@ void quickstop_stepper() {
SYNC_PLAN_POSITION_KINEMATIC();
}
#if ENABLED(LIN_ADVANCE)
#include "gcode/feature/advance/M900.h"
#endif
#if ENABLED(HAVE_TMC2130)
#include "feature/tmc2130.h"
#include "gcode/feature/trinamic/M906.h"

View File

@ -20,6 +20,14 @@
*
*/
#include "../../../inc/MarlinConfig.h"
#if ENABLED(LIN_ADVANCE)
#include "../../gcode.h"
#include "../../../module/planner.h"
#include "../../../module/stepper.h"
/**
* M900: Set and/or Get advance K factor and WH/D ratio
*
@ -27,7 +35,7 @@
* R<ratio> Set ratio directly (overrides WH/D)
* W<width> H<height> D<diam> Set ratio from WH/D
*/
void gcode_M900() {
void GcodeSuite::M900() {
stepper.synchronize();
const float newK = parser.floatval('K', -1);
@ -39,7 +47,7 @@ void gcode_M900() {
newW = parser.floatval('W', -1),
newH = parser.floatval('H', -1);
if (newD >= 0 && newW >= 0 && newH >= 0)
newR = newD ? (newW * newH) / (sq(newD * 0.5) * M_PI) : 0;
newR = newD ? (newW * newH) / CIRCLE_AREA(newD * 0.5) : 0;
}
if (newR >= 0) planner.advance_ed_ratio = newR;
@ -50,3 +58,5 @@ void gcode_M900() {
if (ratio) SERIAL_ECHO(ratio); else SERIAL_ECHOPGM("Auto");
SERIAL_EOL();
}
#endif // LIN_ADVANCE

View File

@ -122,7 +122,6 @@ extern void gcode_M165();
extern void gcode_M350();
extern void gcode_M351();
extern void gcode_M355();
extern void gcode_M900();
extern void gcode_M906();
extern void gcode_M911();
extern void gcode_M912();
@ -658,9 +657,7 @@ void GcodeSuite::process_next_command() {
#endif
#if ENABLED(LIN_ADVANCE)
case 900: // M900: Set advance K factor.
gcode_M900();
break;
case 900: M900(); break; // M900: Set advance K factor.
#endif
#if ENABLED(HAVE_TMC2130)