#define SET_MODAL(m, parm, val) \
- {parser.gn.parm = val; parser.gf.parm = 1; modals[m] += 1; break;}
+ {parser.gn.parm = val; parser.gf.parm = true; modals[m] += 1; break;}
#define SET_NON_MODAL(parm, val) \
- {parser.gn.parm = val; parser.gf.parm = 1; break;}
-#define EXEC_FUNC(f, parm) if ((uint8_t)parser.gf.parm) f(parser.gn.parm)
+ {parser.gn.parm = val; parser.gf.parm = true; break;}
+#define EXEC_FUNC(f, parm) if (parser.gf.parm) f(parser.gn.parm)
static uint8_t modals[MODAL_GROUP_COUNT]; // collects modal groups in a block
static stat_t _execute_gcode_block() {
stat_t status = STAT_OK;
- mach_set_model_line(parser.gn.line);
+ mach_set_line(parser.gn.line);
EXEC_FUNC(mach_set_feed_mode, feed_mode);
EXEC_FUNC(mach_set_feed_rate, feed_rate);
EXEC_FUNC(mach_feed_override_factor, feed_override_factor);
EXEC_FUNC(mach_set_spindle_speed, spindle_speed);
EXEC_FUNC(mach_spindle_override_factor, spindle_override_factor);
- EXEC_FUNC(mach_select_tool, tool_select);
+ EXEC_FUNC(mach_select_tool, tool);
EXEC_FUNC(mach_change_tool, tool_change);
EXEC_FUNC(mach_set_spindle_mode, spindle_mode);
EXEC_FUNC(mach_mist_coolant_control, mist_coolant);
// set initial state for new move
memset(modals, 0, sizeof(modals)); // clear all parser values
- memset(&parser.gf, 0, sizeof(gcode_state_t)); // clear all next-state flags
+ memset(&parser.gf, 0, sizeof(gcode_flags_t)); // clear all next-state flags
memset(&parser.gn, 0, sizeof(gcode_state_t)); // clear all next-state values
// get motion mode from previous block
}
break;
- case 'T': SET_NON_MODAL(tool_select, (uint8_t)trunc(value));
+ case 'T': SET_NON_MODAL(tool, (uint8_t)trunc(value));
case 'F': SET_NON_MODAL(feed_rate, value);
// used for dwell time, G10 coord select, rotations
case 'P': SET_NON_MODAL(parameter, value);
typedef struct {
- gcode_state_t gn; // gcode input values
- gcode_state_t gf; // gcode input flags
+ gcode_state_t gn; // gcode input values
+ gcode_flags_t gf; // gcode input flags
} parser_t;
--- /dev/null
+/******************************************************************************\
+
+ This file is part of the Buildbotics firmware.
+
+ Copyright (c) 2015 - 2016 Buildbotics LLC
+ All rights reserved.
+
+ This file ("the software") is free software: you can redistribute it
+ and/or modify it under the terms of the GNU General Public License,
+ version 2 as published by the Free Software Foundation. You should
+ have received a copy of the GNU General Public License, version 2
+ along with the software. If not, see <http://www.gnu.org/licenses/>.
+
+ The software is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the software. If not, see
+ <http://www.gnu.org/licenses/>.
+
+ For information regarding this software email:
+ "Joseph Coffland" <joseph@buildbotics.com>
+
+\******************************************************************************/
+
+#include "gcode_state.h"
+
+
+PGM_P gs_get_units_pgmstr(units_t mode) {
+ switch (mode) {
+ case INCHES: return PSTR("IN");
+ case MILLIMETERS: return PSTR("MM");
+ case DEGREES: return PSTR("DEG");
+ }
+
+ return PSTR("INVALID");
+}
+
+
+PGM_P gs_get_feed_mode_pgmstr(feed_mode_t mode) {
+ switch (mode) {
+ case INVERSE_TIME_MODE: return PSTR("INVERSE TIME");
+ case UNITS_PER_MINUTE_MODE: return PSTR("PER MIN");
+ case UNITS_PER_REVOLUTION_MODE: return PSTR("PER REV");
+ }
+
+ return PSTR("INVALID");
+}
+
+
+PGM_P gs_get_plane_pgmstr(plane_t plane) {
+ switch (plane) {
+ case PLANE_XY: return PSTR("XY");
+ case PLANE_XZ: return PSTR("XZ");
+ case PLANE_YZ: return PSTR("YZ");
+ }
+
+ return PSTR("INVALID");
+}
+
+
+PGM_P gs_get_coord_system_pgmstr(coord_system_t cs) {
+ switch (cs) {
+ case ABSOLUTE_COORDS: return PSTR("ABS");
+ case G54: return PSTR("G54");
+ case G55: return PSTR("G55");
+ case G56: return PSTR("G56");
+ case G57: return PSTR("G57");
+ case G58: return PSTR("G58");
+ case G59: return PSTR("G59");
+ }
+
+ return PSTR("INVALID");
+}
+
+
+PGM_P gs_get_path_mode_pgmstr(path_mode_t mode) {
+ switch (mode) {
+ case PATH_EXACT_PATH: return PSTR("EXACT PATH");
+ case PATH_EXACT_STOP: return PSTR("EXACT STOP");
+ case PATH_CONTINUOUS: return PSTR("CONTINUOUS");
+ }
+
+ return PSTR("INVALID");
+}
+
+
+PGM_P gs_get_distance_mode_pgmstr(distance_mode_t mode) {
+ switch (mode) {
+ case ABSOLUTE_MODE: return PSTR("ABSOLUTE");
+ case INCREMENTAL_MODE: return PSTR("INCREMENTAL");
+ }
+
+ return PSTR("INVALID");
+}
--- /dev/null
+/******************************************************************************\
+
+ This file is part of the Buildbotics firmware.
+
+ Copyright (c) 2015 - 2016 Buildbotics LLC
+ Copyright (c) 2010 - 2015 Alden S. Hart, Jr.
+ All rights reserved.
+
+ This file ("the software") is free software: you can redistribute it
+ and/or modify it under the terms of the GNU General Public License,
+ version 2 as published by the Free Software Foundation. You should
+ have received a copy of the GNU General Public License, version 2
+ along with the software. If not, see <http://www.gnu.org/licenses/>.
+
+ The software is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the software. If not, see
+ <http://www.gnu.org/licenses/>.
+
+ For information regarding this software email:
+ "Joseph Coffland" <joseph@buildbotics.com>
+
+\******************************************************************************/
+
+MEMBER(uint32_t, line) // Gcode block line number
+
+MEMBER(uint8_t, tool) // T - sets this value
+
+MEMBER(float, feed_rate) // F - mm/min or inverse time mode
+MEMBER(feed_mode_t, feed_mode)
+MEMBER(float, feed_override_factor) // 1.0000 x F feed rate
+MEMBER(bool, feed_override_enable) // M48, M49
+
+MEMBER(float, spindle_speed) // in RPM
+MEMBER(spindle_mode_t, spindle_mode)
+MEMBER(float, spindle_override_factor) // 1.0000 x S spindle speed
+MEMBER(bool, spindle_override_enable) // true = override enabled
+
+MEMBER(motion_mode_t, motion_mode) // Group 1 modal motion
+MEMBER(plane_t, plane) // G17, G18, G19
+MEMBER(units_t, units) // G20, G21
+MEMBER(coord_system_t, coord_system) // G54-G59 - select coord system 1-9
+MEMBER(bool, absolute_mode) // G53 move in machine coordinates
+MEMBER(path_mode_t, path_mode) // G61
+MEMBER(distance_mode_t, distance_mode) // G91
+MEMBER(distance_mode_t, arc_distance_mode) // G91.1
+
+MEMBER(bool, mist_coolant) // mist on (M7), off (M9)
+MEMBER(bool, flood_coolant) // mist on (M8), off (M9)
+
+MEMBER(next_action_t, next_action) // G group 1 moves & non-modals
+MEMBER(program_flow_t, program_flow) // used only by the gcode_parser
+
+// TODO unimplemented gcode parameters
+// MEMBER(float cutter_radius) // D - cutter radius compensation (0 is off)
+// MEMBER(float cutter_length) // H - cutter length compensation (0 is off)
+
+// Used for input only
+MEMBER(float, target[AXES]) // XYZABC where the move should go
+MEMBER(bool, override_enables) // feed and spindle enable
+MEMBER(bool, tool_change) // M6 tool change flag
+
+MEMBER(float, parameter) // P - dwell & G10 coord select
+MEMBER(float, arc_radius) // R - in arc radius mode
+MEMBER(float, arc_offset[3]) // IJK - used by arc commands
#pragma once
+#include "config.h"
+
+#include <avr/pgmspace.h>
+
#include <stdint.h>
#include <stdbool.h>
/// Gcode model state
typedef struct {
- uint32_t line; // Gcode block line number
-
- uint8_t tool; // Tool after T and M6
- uint8_t tool_select; // T - sets this value
-
- float feed_rate; // F - in mm/min or inverse time mode
- feed_mode_t feed_mode;
- float feed_override_factor; // 1.0000 x F feed rate
- bool feed_override_enable; // M48, M49
-
- float spindle_speed; // in RPM
- spindle_mode_t spindle_mode;
- float spindle_override_factor; // 1.0000 x S spindle speed
- bool spindle_override_enable; // true = override enabled
-
- motion_mode_t motion_mode; // Group 1 modal motion
- plane_t plane; // G17, G18, G19
- units_t units; // G20, G21
- coord_system_t coord_system; // G54-G59 - select coordinate system 1-9
- bool absolute_mode; // G53 true = move in machine coordinates
- path_mode_t path_mode; // G61
- distance_mode_t distance_mode; // G91
- distance_mode_t arc_distance_mode; // G91.1
-
- bool mist_coolant; // true = mist on (M7), false = off (M9)
- bool flood_coolant; // true = mist on (M8), false = off (M9)
-
- next_action_t next_action; // handles G group 1 moves & non-modals
- program_flow_t program_flow; // used only by the gcode_parser
-
- // TODO unimplemented gcode parameters
- // float cutter_radius; // D - cutter radius compensation (0 is off)
- // float cutter_length; // H - cutter length compensation (0 is off)
-
- // Used for input only
- float target[AXES]; // XYZABC where the move should go
- bool override_enables; // feed and spindle enable
- bool tool_change; // M6 tool change flag
-
- float parameter; // P - dwell time in sec, G10 coord select
- float arc_radius; // R - radius value in arc radius mode
- float arc_offset[3]; // IJK - used by arc commands
+#define MEMBER(TYPE, VAR) TYPE VAR;
+#include "gcode_state.def"
+#undef MEMBER
} gcode_state_t;
+
+
+typedef struct {
+#define MEMBER(TYPE, VAR) bool VAR;
+#include "gcode_state.def"
+#undef MEMBER
+} gcode_flags_t;
+
+
+PGM_P gs_get_units_pgmstr(units_t mode);
+PGM_P gs_get_feed_mode_pgmstr(feed_mode_t mode);
+PGM_P gs_get_plane_pgmstr(plane_t plane);
+PGM_P gs_get_coord_system_pgmstr(coord_system_t cs);
+PGM_P gs_get_path_mode_pgmstr(path_mode_t mode);
+PGM_P gs_get_distance_mode_pgmstr(distance_mode_t mode);
*/
static int8_t _get_next_axis(int8_t axis) {
switch (axis) {
- case -1: if (fp_TRUE(parser.gf.target[AXIS_Z])) return AXIS_Z;
- case AXIS_Z: if (fp_TRUE(parser.gf.target[AXIS_X])) return AXIS_X;
- case AXIS_X: if (fp_TRUE(parser.gf.target[AXIS_Y])) return AXIS_Y;
- case AXIS_Y: if (fp_TRUE(parser.gf.target[AXIS_A])) return AXIS_A;
- case AXIS_A: if (fp_TRUE(parser.gf.target[AXIS_B])) return AXIS_B;
- case AXIS_B: if (fp_TRUE(parser.gf.target[AXIS_C])) return AXIS_C;
+ case -1: if (parser.gf.target[AXIS_Z]) return AXIS_Z;
+ case AXIS_Z: if (parser.gf.target[AXIS_X]) return AXIS_X;
+ case AXIS_X: if (parser.gf.target[AXIS_Y]) return AXIS_Y;
+ case AXIS_Y: if (parser.gf.target[AXIS_A]) return AXIS_A;
+ case AXIS_A: if (parser.gf.target[AXIS_B]) return AXIS_B;
+ case AXIS_B: if (parser.gf.target[AXIS_C]) return AXIS_C;
}
return axis == -1 ? -2 : -1; // error or done
/// Execute moves
static void _homing_axis_move(int8_t axis, float target, float velocity) {
float vect[AXES] = {0};
- float flags[AXES] = {0};
+ bool flags[AXES] = {0};
vect[axis] = target;
flags[axis] = true;
#include "util.h"
#include "report.h"
#include "homing.h"
+#include "gcode_state.h"
#include "plan/planner.h"
#include "plan/runtime.h"
distance_mode_t mach_get_arc_distance_mode() {return mach.gm.arc_distance_mode;}
-PGM_P mach_get_units_pgmstr(units_t mode) {
- switch (mode) {
- case INCHES: return PSTR("IN");
- case MILLIMETERS: return PSTR("MM");
- case DEGREES: return PSTR("DEG");
- }
-
- return PSTR("INVALID");
-}
-
-
-PGM_P mach_get_feed_mode_pgmstr(feed_mode_t mode) {
- switch (mode) {
- case INVERSE_TIME_MODE: return PSTR("INVERSE TIME");
- case UNITS_PER_MINUTE_MODE: return PSTR("PER MIN");
- case UNITS_PER_REVOLUTION_MODE: return PSTR("PER REV");
- }
-
- return PSTR("INVALID");
-}
-
-
-PGM_P mach_get_plane_pgmstr(plane_t plane) {
- switch (plane) {
- case PLANE_XY: return PSTR("XY");
- case PLANE_XZ: return PSTR("XZ");
- case PLANE_YZ: return PSTR("YZ");
- }
-
- return PSTR("INVALID");
-}
-
-
-PGM_P mach_get_coord_system_pgmstr(coord_system_t cs) {
- switch (cs) {
- case ABSOLUTE_COORDS: return PSTR("ABS");
- case G54: return PSTR("G54");
- case G55: return PSTR("G55");
- case G56: return PSTR("G56");
- case G57: return PSTR("G57");
- case G58: return PSTR("G58");
- case G59: return PSTR("G59");
- }
-
- return PSTR("INVALID");
-}
-
-
-PGM_P mach_get_path_mode_pgmstr(path_mode_t mode) {
- switch (mode) {
- case PATH_EXACT_PATH: return PSTR("EXACT PATH");
- case PATH_EXACT_STOP: return PSTR("EXACT STOP");
- case PATH_CONTINUOUS: return PSTR("CONTINUOUS");
- }
-
- return PSTR("INVALID");
-}
-
-
-PGM_P mach_get_distance_mode_pgmstr(distance_mode_t mode) {
- switch (mode) {
- case ABSOLUTE_MODE: return PSTR("ABSOLUTE");
- case INCREMENTAL_MODE: return PSTR("INCREMENTAL");
- }
-
- return PSTR("INVALID");
-}
-
-
void mach_set_motion_mode(motion_mode_t motion_mode) {
mach.gm.motion_mode = motion_mode;
}
}
-void mach_set_model_line(uint32_t line) {mach.gm.line = line;}
+void mach_set_line(uint32_t line) {mach.gm.line = line;}
/* Coordinate systems and offsets
}
-/* Set target vector in GM model
+/*** Calculate target vector
*
* This is a core routine. It handles:
* - conversion of linear units to internal canonical form (mm)
* Target coordinates are provided in target[]
* Axes that need processing are signaled in flag[]
*/
-
void mach_calc_model_target(float target[], const float values[],
- const float flags[]) {
+ const bool flags[]) {
// process XYZABC for lower modes
for (int axis = AXIS_X; axis <= AXIS_Z; axis++) {
- if (fp_FALSE(flags[axis]) || axes[axis].axis_mode == AXIS_DISABLED)
+ if (!flags[axis] || axes[axis].axis_mode == AXIS_DISABLED)
continue; // skip axis if not flagged for update or its disabled
if (axes[axis].axis_mode == AXIS_STANDARD ||
// Note: The ABC loop below relies on the XYZ loop having been run first
for (int axis = AXIS_A; axis <= AXIS_C; axis++) {
- if (fp_FALSE(flags[axis]) || axes[axis].axis_mode == AXIS_DISABLED)
+ if (!flags[axis] || axes[axis].axis_mode == AXIS_DISABLED)
continue; // skip axis if not flagged for update or its disabled
float tmp;
* This function applies the offset to the GM model.
*/
void mach_set_coord_offsets(coord_system_t coord_system, float offset[],
- float flag[]) {
+ bool flags[]) {
if (coord_system < G54 || G59 < coord_system) return;
for (int axis = 0; axis < AXES; axis++)
- if (fp_TRUE(flag[axis]))
+ if (flags[axis])
mach.offset[coord_system][axis] = TO_MILLIMETERS(offset[axis]);
}
const float *flags = bf->unit;
for (int axis = 0; axis < AXES; axis++)
- if (fp_TRUE(flags[axis])) {
+ if (flags[axis]) {
mp_runtime_set_axis_position(axis, origin[axis]);
mach_set_homed(axis, true); // G28.3 is not considered homed until here
}
* recording done by the encoders. At that point any axis that is set
* is also marked as homed.
*/
-void mach_set_absolute_origin(float origin[], float flags[]) {
+void mach_set_absolute_origin(float origin[], bool flags[]) {
float value[AXES];
for (int axis = 0; axis < AXES; axis++)
- if (fp_TRUE(flags[axis])) {
+ if (flags[axis]) {
value[axis] = TO_MILLIMETERS(origin[axis]);
mach.position[axis] = value[axis]; // set model position
mp_set_axis_position(axis, value[axis]); // set mm position
*/
/// G92
-void mach_set_origin_offsets(float offset[], float flag[]) {
+void mach_set_origin_offsets(float offset[], bool flags[]) {
// set offsets in the Gcode model extended context
mach.origin_offset_enable = true;
for (int axis = 0; axis < AXES; axis++)
- if (fp_TRUE(flag[axis]))
+ if (flags[axis])
mach.origin_offset[axis] = mach.position[axis] -
mach.offset[mach.gm.coord_system][axis] - TO_MILLIMETERS(offset[axis]);
}
// Free Space Motion (4.3.4)
/// G0 linear rapid
-stat_t mach_rapid(float values[], float flags[]) {
+stat_t mach_rapid(float values[], bool flags[]) {
mach.gm.motion_mode = MOTION_MODE_RAPID;
float target[AXES];
/// G28
-stat_t mach_goto_g28_position(float target[], float flags[]) {
+stat_t mach_goto_g28_position(float target[], bool flags[]) {
mach_set_absolute_mode(true);
// move through intermediate point, or skip
mach_rapid(target, flags);
// execute actual stored move
- float f[] = {1, 1, 1, 1, 1, 1};
+ bool f[] = {true, true, true, true, true, true};
return mach_rapid(mach.g28_position, f);
}
/// G30
-stat_t mach_goto_g30_position(float target[], float flags[]) {
+stat_t mach_goto_g30_position(float target[], bool flags[]) {
mach_set_absolute_mode(true);
// move through intermediate point, or skip
mach_rapid(target, flags);
// execute actual stored move
- float f[] = {1, 1, 1, 1, 1, 1};
+ bool f[] = {true, true, true, true, true, true};
return mach_rapid(mach.g30_position, f);
}
/// G1
-stat_t mach_feed(float values[], float flags[]) {
+stat_t mach_feed(float values[], bool flags[]) {
// trap zero feed rate condition
if (fp_ZERO(mach.gm.feed_rate) ||
(mach.gm.feed_mode == INVERSE_TIME_MODE && !parser.gf.feed_rate))
// Tool Functions (4.3.8)
/// T parameter
-void mach_select_tool(uint8_t tool_select) {mach.gm.tool_select = tool_select;}
+void mach_select_tool(uint8_t tool) {mach.gm.tool = tool;}
static stat_t _exec_change_tool(mp_buffer_t *bf) {
/// M6 This might become a complete tool change cycle
void mach_change_tool(bool x) {
- mach.gm.tool = mach.gm.tool_select;
-
mp_buffer_t *bf = mp_queue_get_tail();
bf->value = mach.gm.tool;
mp_queue_push(_exec_change_tool, mach_get_line());
/// M50
void mach_feed_override_enable(bool flag) {
- if (fp_TRUE(parser.gf.parameter) && fp_ZERO(parser.gn.parameter))
+ if (parser.gf.parameter && fp_ZERO(parser.gn.parameter))
mach.gm.feed_override_enable = false;
else mach.gm.feed_override_enable = true;
}
/// M51
void mach_spindle_override_enable(bool flag) {
- if (fp_TRUE(parser.gf.parameter) && fp_ZERO(parser.gn.parameter))
+ if (parser.gf.parameter && fp_ZERO(parser.gn.parameter))
mach.gm.spindle_override_enable = false;
else mach.gm.spindle_override_enable = true;
}
mach_set_feed_mode(UNITS_PER_MINUTE_MODE); // G94
mach_set_motion_mode(MOTION_MODE_CANCEL_MOTION_MODE);
}
-
-
-/// return ASCII char for axis given the axis number
-char mach_get_axis_char(int8_t axis) {
- char axis_char[] = "XYZABC";
- if (axis < 0 || axis > AXES) return ' ';
- return axis_char[axis];
-}
#include "status.h"
#include "gcode_state.h"
-#include <avr/pgmspace.h>
-
#define TO_MILLIMETERS(a) (mach_get_units() == INCHES ? (a) * MM_PER_INCH : a)
distance_mode_t mach_get_distance_mode();
distance_mode_t mach_get_arc_distance_mode();
-PGM_P mach_get_units_pgmstr(units_t mode);
-PGM_P mach_get_feed_mode_pgmstr(feed_mode_t mode);
-PGM_P mach_get_plane_pgmstr(plane_t plane);
-PGM_P mach_get_coord_system_pgmstr(coord_system_t cs);
-PGM_P mach_get_path_mode_pgmstr(path_mode_t mode);
-PGM_P mach_get_distance_mode_pgmstr(distance_mode_t mode);
-
void mach_set_motion_mode(motion_mode_t motion_mode);
void mach_set_spindle_mode(spindle_mode_t spindle_mode);
void mach_set_spindle_speed(float speed);
void mach_set_absolute_mode(bool absolute_mode);
-void mach_set_model_line(uint32_t line);
+void mach_set_line(uint32_t line);
// Coordinate systems and offsets
float mach_get_active_coord_offset(uint8_t axis);
// Critical helpers
float mach_calc_move_time(const float axis_length[], const float axis_square[]);
void mach_calc_model_target(float target[], const float values[],
- const float flags[]);
+ const bool flags[]);
stat_t mach_test_soft_limits(float target[]);
// machining functions defined by NIST [organized by NIST Gcode doc]
void mach_set_distance_mode(distance_mode_t mode);
void mach_set_arc_distance_mode(distance_mode_t mode);
void mach_set_coord_offsets(coord_system_t coord_system, float offset[],
- float flag[]);
+ bool flags[]);
void mach_set_axis_position(unsigned axis, float position);
-void mach_set_absolute_origin(float origin[], float flag[]);
+void mach_set_absolute_origin(float origin[], bool flags[]);
stat_t mach_zero_all();
stat_t mach_zero_axis(unsigned axis);
void mach_set_coord_system(coord_system_t coord_system);
-void mach_set_origin_offsets(float offset[], float flag[]);
+void mach_set_origin_offsets(float offset[], bool flags[]);
void mach_reset_origin_offsets();
void mach_suspend_origin_offsets();
void mach_resume_origin_offsets();
// Free Space Motion (4.3.4)
-stat_t mach_rapid(float target[], float flags[]);
+stat_t mach_rapid(float target[], bool flags[]);
void mach_set_g28_position();
-stat_t mach_goto_g28_position(float target[], float flags[]);
+stat_t mach_goto_g28_position(float target[], bool flags[]);
void mach_set_g30_position();
-stat_t mach_goto_g30_position(float target[], float flags[]);
+stat_t mach_goto_g30_position(float target[], bool flags[]);
// Machining Attributes (4.3.5)
void mach_set_feed_rate(float feed_rate);
void mach_set_path_mode(path_mode_t mode);
// Machining Functions (4.3.6)
-stat_t mach_feed(float target[], float flags[]);
-stat_t mach_arc_feed(float target[], float flags[], float offsets[],
- float offset_f[], float radius, bool radius_f,
+stat_t mach_feed(float target[], bool flags[]);
+stat_t mach_arc_feed(float target[], bool flags[], float offsets[],
+ bool offset_f[], float radius, bool radius_f,
float P, bool P_f, bool modal_g1_f, uint8_t motion_mode);
stat_t mach_dwell(float seconds);
void mach_optional_program_stop();
void mach_pallet_change_stop();
void mach_program_end();
-
-char mach_get_axis_char(int8_t axis);
* Generates an arc by queuing line segments to the move buffer. The arc is
* approximated by generating a large number of tiny, linear segments.
*/
-stat_t mach_arc_feed(float values[], float values_f[], // arc endpoints
- float offsets[], float offsets_f[], // arc offsets
- float radius, bool radius_f, // radius
- float P, bool P_f, // parameter
+stat_t mach_arc_feed(float values[], bool values_f[], // arc endpoints
+ float offsets[], bool offsets_f[], // arc offsets
+ float radius, bool radius_f, // radius
+ float P, bool P_f, // parameter
bool modal_g1_f,
uint8_t motion_mode) { // defined motion mode
// probe destination
float start_position[AXES];
float target[AXES];
- float flags[AXES];
+ bool flags[AXES];
} probing_t;
/// G38.2 homing cycle using limit switches
-stat_t mach_probe(float target[], float flags[]) {
+stat_t mach_probe(float target[], bool flags[]) {
// trap zero feed rate condition
if (mach_get_feed_mode() != INVERSE_TIME_MODE &&
fp_ZERO(mach_get_feed_rate()))
return STAT_GCODE_FEEDRATE_NOT_SPECIFIED;
// trap no axes specified
- if (fp_NOT_ZERO(flags[AXIS_X]) && fp_NOT_ZERO(flags[AXIS_Y]) &&
- fp_NOT_ZERO(flags[AXIS_Z]))
+ if (!flags[AXIS_X] && !flags[AXIS_Y] && !flags[AXIS_Z])
return STAT_GCODE_AXIS_IS_MISSING;
// set probe move endpoint
bool mach_is_probing();
-stat_t mach_probe(float target[], float flags[]);
+stat_t mach_probe(float target[], bool flags[]);
void mach_probe_callback();
// GCode
int32_t get_line() {return mp_runtime_get_line();}
-PGM_P get_unit() {return mach_get_units_pgmstr(mach_get_units());}
+PGM_P get_unit() {return gs_get_units_pgmstr(mach_get_units());}
float get_speed() {return spindle_get_speed();}
float get_feed() {return mach_get_feed_rate();} // TODO get runtime value
uint8_t get_tool() {return mp_runtime_get_tool();}
PGM_P get_feed_mode() {
- return mach_get_feed_mode_pgmstr(mach_get_feed_mode());
+ return gs_get_feed_mode_pgmstr(mach_get_feed_mode());
}
-PGM_P get_plane() {return mach_get_plane_pgmstr(mach_get_plane());}
+PGM_P get_plane() {return gs_get_plane_pgmstr(mach_get_plane());}
PGM_P get_coord_system() {
- return mach_get_coord_system_pgmstr(mach_get_coord_system());
+ return gs_get_coord_system_pgmstr(mach_get_coord_system());
}
bool get_abs_override() {return mach_get_absolute_mode();}
-PGM_P get_path_mode() {return mach_get_path_mode_pgmstr(mach_get_path_mode());}
+PGM_P get_path_mode() {return gs_get_path_mode_pgmstr(mach_get_path_mode());}
PGM_P get_distance_mode() {
- return mach_get_distance_mode_pgmstr(mach_get_distance_mode());
+ return gs_get_distance_mode_pgmstr(mach_get_distance_mode());
}
PGM_P get_arc_dist_mode() {
- return mach_get_distance_mode_pgmstr(mach_get_arc_distance_mode());
+ return gs_get_distance_mode_pgmstr(mach_get_arc_distance_mode());
}