Move G17-G19 to cpp
This commit is contained in:
parent
94d9def81c
commit
9b4aa5ea8b
|
@ -215,10 +215,6 @@ static millis_t stepper_inactive_time = (DEFAULT_STEPPER_DEACTIVE_TIME) * 1000UL
|
|||
millis_t lastUpdateMillis;
|
||||
#endif
|
||||
|
||||
#if ENABLED(CNC_WORKSPACE_PLANES)
|
||||
static WorkspacePlane workspace_plane = PLANE_XY;
|
||||
#endif
|
||||
|
||||
/**
|
||||
* ***************************************************************************
|
||||
* ******************************** FUNCTIONS ********************************
|
||||
|
@ -361,10 +357,6 @@ void suicide() {
|
|||
***************** GCode Handlers *****************
|
||||
**************************************************/
|
||||
|
||||
#if ENABLED(CNC_WORKSPACE_PLANES)
|
||||
#include "gcode/geometry/G17-G19.h"
|
||||
#endif
|
||||
|
||||
#if ENABLED(INCH_MODE_SUPPORT)
|
||||
#include "gcode/units/G20_G21.h"
|
||||
#endif
|
||||
|
|
|
@ -148,12 +148,4 @@ enum LCDViewAction {
|
|||
};
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Workspace planes only apply to G2/G3 moves
|
||||
* (and "canned cycles" - not a current feature)
|
||||
*/
|
||||
#if ENABLED(CNC_WORKSPACE_PLANES)
|
||||
enum WorkspacePlane { PLANE_XY, PLANE_ZX, PLANE_YZ };
|
||||
#endif
|
||||
|
||||
#endif // __ENUM_H__
|
||||
|
|
|
@ -48,6 +48,10 @@ bool GcodeSuite::axis_relative_modes[] = AXIS_RELATIVE_MODES;
|
|||
uint8_t GcodeSuite::host_keepalive_interval = DEFAULT_KEEPALIVE_INTERVAL;
|
||||
#endif
|
||||
|
||||
#if ENABLED(CNC_WORKSPACE_PLANES)
|
||||
GcodeSuite::WorkspacePlane GcodeSuite::workspace_plane = PLANE_XY;
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Set target_extruder from the T parameter or the active_extruder
|
||||
*
|
||||
|
@ -112,9 +116,6 @@ void GcodeSuite::dwell(millis_t time) {
|
|||
//
|
||||
// Placeholders for non-migrated codes
|
||||
//
|
||||
extern void gcode_G17();
|
||||
extern void gcode_G18();
|
||||
extern void gcode_G19();
|
||||
extern void gcode_G20();
|
||||
extern void gcode_G21();
|
||||
extern void gcode_G27();
|
||||
|
@ -318,13 +319,13 @@ void GcodeSuite::process_next_command() {
|
|||
|
||||
#if ENABLED(CNC_WORKSPACE_PLANES)
|
||||
case 17: // G17: Select Plane XY
|
||||
gcode_G17();
|
||||
G17();
|
||||
break;
|
||||
case 18: // G18: Select Plane ZX
|
||||
gcode_G18();
|
||||
G18();
|
||||
break;
|
||||
case 19: // G19: Select Plane YZ
|
||||
gcode_G19();
|
||||
G19();
|
||||
break;
|
||||
#endif // CNC_WORKSPACE_PLANES
|
||||
|
||||
|
|
|
@ -256,6 +256,15 @@ public:
|
|||
|
||||
static bool axis_relative_modes[];
|
||||
|
||||
#if ENABLED(CNC_WORKSPACE_PLANES)
|
||||
/**
|
||||
* Workspace planes only apply to G2/G3 moves
|
||||
* (and "canned cycles" - not a current feature)
|
||||
*/
|
||||
enum WorkspacePlane { PLANE_XY, PLANE_ZX, PLANE_YZ };
|
||||
static WorkspacePlane workspace_plane;
|
||||
#endif
|
||||
|
||||
static millis_t previous_cmd_ms;
|
||||
FORCE_INLINE static void refresh_cmd_timeout() { previous_cmd_ms = millis(); }
|
||||
|
||||
|
|
|
@ -20,10 +20,25 @@
|
|||
*
|
||||
*/
|
||||
|
||||
void report_workspace_plane() {
|
||||
#include "../../inc/MarlinConfig.h"
|
||||
|
||||
#if ENABLED(CNC_WORKSPACE_PLANES)
|
||||
|
||||
#include "../gcode.h"
|
||||
|
||||
inline void report_workspace_plane() {
|
||||
SERIAL_ECHO_START();
|
||||
SERIAL_ECHOPGM("Workspace Plane ");
|
||||
serialprintPGM(workspace_plane == PLANE_YZ ? PSTR("YZ\n") : workspace_plane == PLANE_ZX ? PSTR("ZX\n") : PSTR("XY\n"));
|
||||
serialprintPGM(
|
||||
gcode.workspace_plane == GcodeSuite::PLANE_YZ ? PSTR("YZ\n")
|
||||
: gcode.workspace_plane == GcodeSuite::PLANE_ZX ? PSTR("ZX\n")
|
||||
: PSTR("XY\n")
|
||||
);
|
||||
}
|
||||
|
||||
inline void set_workspace_plane(const GcodeSuite::WorkspacePlane plane) {
|
||||
gcode.workspace_plane = plane;
|
||||
if (DEBUGGING(INFO)) report_workspace_plane();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -31,6 +46,8 @@ void report_workspace_plane() {
|
|||
* G18: Select Plane ZX
|
||||
* G19: Select Plane YZ
|
||||
*/
|
||||
void gcode_G17() { workspace_plane = PLANE_XY; }
|
||||
void gcode_G18() { workspace_plane = PLANE_ZX; }
|
||||
void gcode_G19() { workspace_plane = PLANE_YZ; }
|
||||
void GcodeSuite::G17() { set_workspace_plane(PLANE_XY); }
|
||||
void GcodeSuite::G18() { set_workspace_plane(PLANE_ZX); }
|
||||
void GcodeSuite::G19() { set_workspace_plane(PLANE_YZ); }
|
||||
|
||||
#endif // CNC_WORKSPACE_PLANES
|
|
@ -50,10 +50,10 @@ void plan_arc(
|
|||
) {
|
||||
#if ENABLED(CNC_WORKSPACE_PLANES)
|
||||
AxisEnum p_axis, q_axis, l_axis;
|
||||
switch (workspace_plane) {
|
||||
case PLANE_XY: p_axis = X_AXIS; q_axis = Y_AXIS; l_axis = Z_AXIS; break;
|
||||
case PLANE_ZX: p_axis = Z_AXIS; q_axis = X_AXIS; l_axis = Y_AXIS; break;
|
||||
case PLANE_YZ: p_axis = Y_AXIS; q_axis = Z_AXIS; l_axis = X_AXIS; break;
|
||||
switch (gcode.workspace_plane) {
|
||||
case GcodeSuite::PLANE_XY: p_axis = X_AXIS; q_axis = Y_AXIS; l_axis = Z_AXIS; break;
|
||||
case GcodeSuite::PLANE_ZX: p_axis = Z_AXIS; q_axis = X_AXIS; l_axis = Y_AXIS; break;
|
||||
case GcodeSuite::PLANE_YZ: p_axis = Y_AXIS; q_axis = Z_AXIS; l_axis = X_AXIS; break;
|
||||
}
|
||||
#else
|
||||
constexpr AxisEnum p_axis = X_AXIS, q_axis = Y_AXIS, l_axis = Z_AXIS;
|
||||
|
|
Loading…
Reference in a new issue