Move M360-M364 to cpp

This commit is contained in:
Scott Lahteine 2017-09-17 03:34:20 -05:00
parent 828405cac8
commit 9be8cb0ac9
3 changed files with 23 additions and 31 deletions

View File

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

View File

@ -122,11 +122,6 @@ extern void gcode_M165();
extern void gcode_M350(); extern void gcode_M350();
extern void gcode_M351(); extern void gcode_M351();
extern void gcode_M355(); extern void gcode_M355();
extern bool gcode_M360();
extern bool gcode_M361();
extern bool gcode_M362();
extern bool gcode_M363();
extern bool gcode_M364();
extern void gcode_M380(); extern void gcode_M380();
extern void gcode_M381(); extern void gcode_M381();
extern void gcode_M400(); extern void gcode_M400();
@ -594,22 +589,12 @@ void GcodeSuite::process_next_command() {
break; break;
#if ENABLED(MORGAN_SCARA) #if ENABLED(MORGAN_SCARA)
case 360: // M360: SCARA Theta pos1 case 360: if (M360()) return; break; // M360: SCARA Theta pos1
if (gcode_M360()) return; case 361: if (M361()) return; break; // M361: SCARA Theta pos2
break; case 362: if (M362()) return; break; // M362: SCARA Psi pos1
case 361: // M361: SCARA Theta pos2 case 363: if (M363()) return; break; // M363: SCARA Psi pos2
if (gcode_M361()) return; case 364: if (M364()) return; break; // M364: SCARA Psi pos3 (90 deg to Theta)
break; #endif
case 362: // M362: SCARA Psi pos1
if (gcode_M362()) return;
break;
case 363: // M363: SCARA Psi pos2
if (gcode_M363()) return;
break;
case 364: // M364: SCARA Psi pos3 (90 deg to Theta)
if (gcode_M364()) return;
break;
#endif // SCARA
#if ENABLED(EXT_SOLENOID) #if ENABLED(EXT_SOLENOID)
case 380: // M380: Activate solenoid on active extruder case 380: // M380: Activate solenoid on active extruder

View File

@ -20,7 +20,16 @@
* *
*/ */
bool SCARA_move_to_cal(uint8_t delta_a, uint8_t delta_b) { #include "../../inc/MarlinConfig.h"
#if ENABLED(MORGAN_SCARA)
#include "../gcode.h"
#include "../../module/scara.h"
#include "../../module/motion.h"
#include "../../Marlin.h" // for IsRunning()
inline bool SCARA_move_to_cal(const uint8_t delta_a, const uint8_t delta_b) {
if (IsRunning()) { if (IsRunning()) {
forward_kinematics_SCARA(delta_a, delta_b); forward_kinematics_SCARA(delta_a, delta_b);
destination[X_AXIS] = LOGICAL_X_POSITION(cartes[X_AXIS]); 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) {
/** /**
* M360: SCARA calibration: Move to cal-position ThetaA (0 deg calibration) * M360: SCARA calibration: Move to cal-position ThetaA (0 deg calibration)
*/ */
bool gcode_M360() { bool GcodeSuite::M360() {
SERIAL_ECHOLNPGM(" Cal: Theta 0"); SERIAL_ECHOLNPGM(" Cal: Theta 0");
return SCARA_move_to_cal(0, 120); return SCARA_move_to_cal(0, 120);
} }
@ -43,7 +52,7 @@ bool gcode_M360() {
/** /**
* M361: SCARA calibration: Move to cal-position ThetaB (90 deg calibration - steps per degree) * M361: SCARA calibration: Move to cal-position ThetaB (90 deg calibration - steps per degree)
*/ */
bool gcode_M361() { bool GcodeSuite::M361() {
SERIAL_ECHOLNPGM(" Cal: Theta 90"); SERIAL_ECHOLNPGM(" Cal: Theta 90");
return SCARA_move_to_cal(90, 130); return SCARA_move_to_cal(90, 130);
} }
@ -51,7 +60,7 @@ bool gcode_M361() {
/** /**
* M362: SCARA calibration: Move to cal-position PsiA (0 deg calibration) * M362: SCARA calibration: Move to cal-position PsiA (0 deg calibration)
*/ */
bool gcode_M362() { bool GcodeSuite::M362() {
SERIAL_ECHOLNPGM(" Cal: Psi 0"); SERIAL_ECHOLNPGM(" Cal: Psi 0");
return SCARA_move_to_cal(60, 180); return SCARA_move_to_cal(60, 180);
} }
@ -59,7 +68,7 @@ bool gcode_M362() {
/** /**
* M363: SCARA calibration: Move to cal-position PsiB (90 deg calibration - steps per degree) * M363: SCARA calibration: Move to cal-position PsiB (90 deg calibration - steps per degree)
*/ */
bool gcode_M363() { bool GcodeSuite::M363() {
SERIAL_ECHOLNPGM(" Cal: Psi 90"); SERIAL_ECHOLNPGM(" Cal: Psi 90");
return SCARA_move_to_cal(50, 90); return SCARA_move_to_cal(50, 90);
} }
@ -67,7 +76,9 @@ bool gcode_M363() {
/** /**
* M364: SCARA calibration: Move to cal-position PsiC (90 deg to Theta calibration position) * M364: SCARA calibration: Move to cal-position PsiC (90 deg to Theta calibration position)
*/ */
bool gcode_M364() { bool GcodeSuite::M364() {
SERIAL_ECHOLNPGM(" Cal: Theta-Psi 90"); SERIAL_ECHOLNPGM(" Cal: Theta-Psi 90");
return SCARA_move_to_cal(45, 135); return SCARA_move_to_cal(45, 135);
} }
#endif // MORGAN_SCARA