From: Joseph Coffland Date: Sat, 10 Sep 2016 11:53:39 +0000 (-0700) Subject: names X-Git-Url: https://git.buildbotics.com/?a=commitdiff_plain;h=ecadfc685228506ec70a8eda7404d283a3db0467;p=bbctrl-firmware names --- diff --git a/src/gcode_parser.c b/src/gcode_parser.c index f07e73d..e96ec8a 100644 --- a/src/gcode_parser.c +++ b/src/gcode_parser.c @@ -233,7 +233,7 @@ static stat_t _execute_gcode_block() { stat_t status = STAT_OK; mach_set_model_line(mach.gn.line); - EXEC_FUNC(mach_set_feed_rate_mode, feed_rate_mode); + 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); @@ -251,11 +251,11 @@ static stat_t _execute_gcode_block() { RITORNO(mach_dwell(mach.gn.parameter)); EXEC_FUNC(mach_set_plane, plane); - EXEC_FUNC(mach_set_units_mode, units_mode); + EXEC_FUNC(mach_set_units, units); //--> cutter radius compensation goes here //--> cutter length compensation goes here EXEC_FUNC(mach_set_coord_system, coord_system); - EXEC_FUNC(mach_set_path_control, path_control); + EXEC_FUNC(mach_set_path_mode, path_mode); EXEC_FUNC(mach_set_distance_mode, distance_mode); //--> set retract mode goes here @@ -382,8 +382,8 @@ static stat_t _parse_gcode_block(char *buf) { case 17: SET_MODAL(MODAL_GROUP_G2, plane, PLANE_XY); case 18: SET_MODAL(MODAL_GROUP_G2, plane, PLANE_XZ); case 19: SET_MODAL(MODAL_GROUP_G2, plane, PLANE_YZ); - case 20: SET_MODAL(MODAL_GROUP_G6, units_mode, INCHES); - case 21: SET_MODAL(MODAL_GROUP_G6, units_mode, MILLIMETERS); + case 20: SET_MODAL(MODAL_GROUP_G6, units, INCHES); + case 21: SET_MODAL(MODAL_GROUP_G6, units, MILLIMETERS); case 28: switch (_point(value)) { case 0: @@ -425,13 +425,13 @@ static stat_t _parse_gcode_block(char *buf) { case 59: SET_MODAL(MODAL_GROUP_G12, coord_system, G59); case 61: switch (_point(value)) { - case 0: SET_MODAL(MODAL_GROUP_G13, path_control, PATH_EXACT_PATH); - case 1: SET_MODAL(MODAL_GROUP_G13, path_control, PATH_EXACT_STOP); + case 0: SET_MODAL(MODAL_GROUP_G13, path_mode, PATH_EXACT_PATH); + case 1: SET_MODAL(MODAL_GROUP_G13, path_mode, PATH_EXACT_STOP); default: status = STAT_GCODE_COMMAND_UNSUPPORTED; } break; - case 64: SET_MODAL(MODAL_GROUP_G13,path_control, PATH_CONTINUOUS); + case 64: SET_MODAL(MODAL_GROUP_G13,path_mode, PATH_CONTINUOUS); case 80: SET_MODAL(MODAL_GROUP_G1, motion_mode, MOTION_MODE_CANCEL_MOTION_MODE); // case 90: SET_MODAL(MODAL_GROUP_G3, distance_mode, ABSOLUTE_MODE); @@ -463,10 +463,10 @@ static stat_t _parse_gcode_block(char *buf) { } break; - case 93: SET_MODAL(MODAL_GROUP_G5, feed_rate_mode, INVERSE_TIME_MODE); - case 94: SET_MODAL(MODAL_GROUP_G5, feed_rate_mode, UNITS_PER_MINUTE_MODE); + case 93: SET_MODAL(MODAL_GROUP_G5, feed_mode, INVERSE_TIME_MODE); + case 94: SET_MODAL(MODAL_GROUP_G5, feed_mode, UNITS_PER_MINUTE_MODE); // case 95: - // SET_MODAL(MODAL_GROUP_G5, feed_rate_mode, UNITS_PER_REVOLUTION_MODE); + // SET_MODAL(MODAL_GROUP_G5, feed_mode, UNITS_PER_REVOLUTION_MODE); default: status = STAT_GCODE_COMMAND_UNSUPPORTED; } break; diff --git a/src/homing.c b/src/homing.c index ee805b9..70766fd 100644 --- a/src/homing.c +++ b/src/homing.c @@ -87,10 +87,10 @@ typedef struct { float max_clear_backoff; // state saved from gcode model - uint8_t saved_units_mode; // G20,G21 global setting + uint8_t saved_units; // G20,G21 global setting uint8_t saved_coord_system; // G54 - G59 setting uint8_t saved_distance_mode; // G90,G91 global setting - uint8_t saved_feed_rate_mode; // G93,G94 global setting + uint8_t saved_feed_mode; // G93,G94 global setting float saved_feed_rate; // F setting float saved_jerk; // saved and restored for each axis homed } homing_t; @@ -186,9 +186,9 @@ static void _homing_finalize_exit() { // Restore saved machine state mach_set_coord_system(hm.saved_coord_system); - mach_set_units_mode(hm.saved_units_mode); + mach_set_units(hm.saved_units); mach_set_distance_mode(hm.saved_distance_mode); - mach_set_feed_rate_mode(hm.saved_feed_rate_mode); + mach_set_feed_mode(hm.saved_feed_mode); mach.gm.feed_rate = hm.saved_feed_rate; mach_set_motion_mode(MOTION_MODE_CANCEL_MOTION_MODE); } @@ -379,17 +379,17 @@ void mach_set_homed(int axis, bool homed) { /// G28.2 homing cycle using limit switches void mach_homing_cycle_start() { // save relevant non-axis parameters from Gcode model - hm.saved_units_mode = mach_get_units_mode(); + hm.saved_units = mach_get_units(); hm.saved_coord_system = mach_get_coord_system(); hm.saved_distance_mode = mach_get_distance_mode(); - hm.saved_feed_rate_mode = mach_get_feed_rate_mode(); + hm.saved_feed_mode = mach_get_feed_mode(); hm.saved_feed_rate = mach_get_feed_rate(); // set working values - mach_set_units_mode(MILLIMETERS); + mach_set_units(MILLIMETERS); mach_set_distance_mode(INCREMENTAL_MODE); mach_set_coord_system(ABSOLUTE_COORDS); // in machine coordinates - mach_set_feed_rate_mode(UNITS_PER_MINUTE_MODE); + mach_set_feed_mode(UNITS_PER_MINUTE_MODE); hm.set_coordinates = true; hm.axis = -1; // set to retrieve initial axis diff --git a/src/machine.c b/src/machine.c index c7e15bd..4aa5455 100644 --- a/src/machine.c +++ b/src/machine.c @@ -36,7 +36,7 @@ * * Synchronizing command execution: * - * "Synchronous commands" are commands that affect the runtime need to be + * "Synchronous commands" are commands that affect the runtime and need to be * synchronized with movement. Examples include G4 dwells, program stops and * ends, and most M commands. These are queued into the planner queue and * execute from the queue. Synchronous commands work like this: @@ -191,16 +191,16 @@ machine_t mach = { uint32_t mach_get_line() {return mach.gm.line;} motion_mode_t mach_get_motion_mode() {return mach.gm.motion_mode;} coord_system_t mach_get_coord_system() {return mach.gm.coord_system;} -units_mode_t mach_get_units_mode() {return mach.gm.units_mode;} +units_t mach_get_units() {return mach.gm.units;} plane_t mach_get_plane() {return mach.gm.plane;} -path_mode_t mach_get_path_control() {return mach.gm.path_control;} +path_mode_t mach_get_path_mode() {return mach.gm.path_mode;} distance_mode_t mach_get_distance_mode() {return mach.gm.distance_mode;} -feed_rate_mode_t mach_get_feed_rate_mode() {return mach.gm.feed_rate_mode;} +feed_mode_t mach_get_feed_mode() {return mach.gm.feed_mode;} uint8_t mach_get_tool() {return mach.gm.tool;} float mach_get_feed_rate() {return mach.gm.feed_rate;} -PGM_P mp_get_units_mode_pgmstr(units_mode_t mode) { +PGM_P mp_get_units_pgmstr(units_t mode) { switch (mode) { case INCHES: return PSTR("IN"); case MILLIMETERS: return PSTR("MM"); @@ -211,7 +211,7 @@ PGM_P mp_get_units_mode_pgmstr(units_mode_t mode) { } -PGM_P mp_get_feed_rate_mode_pgmstr(feed_rate_mode_t mode) { +PGM_P mp_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"); @@ -497,7 +497,7 @@ float mach_calc_move_time(const float axis_length[], // Compute times for feed motion if (mach.gm.motion_mode != MOTION_MODE_RAPID) { - if (mach.gm.feed_rate_mode == INVERSE_TIME_MODE) + if (mach.gm.feed_mode == INVERSE_TIME_MODE) // Feed rate was un-inverted to minutes by mach_set_feed_rate() max_time = mach.gm.feed_rate; @@ -638,12 +638,12 @@ void machine_init() { mach_set_axis_jerk(axis, mach.a[axis].jerk_max); // Set gcode defaults - mach_set_units_mode(GCODE_DEFAULT_UNITS); + mach_set_units(GCODE_DEFAULT_UNITS); mach_set_coord_system(GCODE_DEFAULT_COORD_SYSTEM); mach_set_plane(GCODE_DEFAULT_PLANE); - mach_set_path_control(GCODE_DEFAULT_PATH_CONTROL); + mach_set_path_mode(GCODE_DEFAULT_PATH_CONTROL); mach_set_distance_mode(GCODE_DEFAULT_DISTANCE_MODE); - mach_set_feed_rate_mode(UNITS_PER_MINUTE_MODE); // always the default + mach_set_feed_mode(UNITS_PER_MINUTE_MODE); // always the default // Sub-system inits spindle_init(); @@ -669,7 +669,7 @@ void mach_set_plane(plane_t plane) {mach.gm.plane = plane;} /// G20, G21 -void mach_set_units_mode(units_mode_t mode) {mach.gm.units_mode = mode;} +void mach_set_units(units_t mode) {mach.gm.units = mode;} /// G90, G91 @@ -879,7 +879,7 @@ stat_t mach_goto_g30_position(float target[], float flags[]) { /// F parameter /// Normalize feed rate to mm/min or to minutes if in inverse time mode void mach_set_feed_rate(float feed_rate) { - if (mach.gm.feed_rate_mode == INVERSE_TIME_MODE) + if (mach.gm.feed_mode == INVERSE_TIME_MODE) // normalize to minutes (active for this gcode block only) mach.gm.feed_rate = feed_rate ? 1 / feed_rate : 0; // Avoid div by zero @@ -888,16 +888,16 @@ void mach_set_feed_rate(float feed_rate) { /// G93, G94 -void mach_set_feed_rate_mode(feed_rate_mode_t mode) { - if (mach.gm.feed_rate_mode == mode) return; +void mach_set_feed_mode(feed_mode_t mode) { + if (mach.gm.feed_mode == mode) return; mach.gm.feed_rate = 0; // Force setting feed rate after changing modes - mach.gm.feed_rate_mode = mode; + mach.gm.feed_mode = mode; } /// G61, G61.1, G64 -void mach_set_path_control(path_mode_t mode) { - mach.gm.path_control = mode; +void mach_set_path_mode(path_mode_t mode) { + mach.gm.path_mode = mode; } @@ -913,7 +913,7 @@ stat_t mach_dwell(float seconds) { stat_t mach_feed(float target[], float flags[]) { // trap zero feed rate condition if (fp_ZERO(mach.gm.feed_rate) || - (mach.gm.feed_rate_mode == INVERSE_TIME_MODE && !mach.gf.feed_rate)) + (mach.gm.feed_mode == INVERSE_TIME_MODE && !mach.gf.feed_rate)) return STAT_GCODE_FEEDRATE_NOT_SPECIFIED; mach.gm.motion_mode = MOTION_MODE_FEED; @@ -1103,7 +1103,7 @@ void mach_program_end() { mach.gm.spindle_mode = SPINDLE_OFF; spindle_set(SPINDLE_OFF, 0); mach_flood_coolant_control(false); // M9 - mach_set_feed_rate_mode(UNITS_PER_MINUTE_MODE); // G94 + mach_set_feed_mode(UNITS_PER_MINUTE_MODE); // G94 mach_set_motion_mode(MOTION_MODE_CANCEL_MOTION_MODE); } diff --git a/src/machine.h b/src/machine.h index f41d11f..1014c55 100644 --- a/src/machine.h +++ b/src/machine.h @@ -38,7 +38,7 @@ #include -#define TO_MILLIMETERS(a) (mach.gm.units_mode == INCHES ? (a) * MM_PER_INCH : a) +#define TO_MILLIMETERS(a) (mach.gm.units == INCHES ? (a) * MM_PER_INCH : a) /* The difference between next_action_t and motion_mode_t is that @@ -121,7 +121,7 @@ typedef enum { INCHES, // G20 MILLIMETERS, // G21 DEGREES, // ABC axes (this value used for displays only) -} units_mode_t; +} units_t; typedef enum { @@ -131,9 +131,8 @@ typedef enum { /// G Modal Group 13 typedef enum { - /// G61 - hits corners but does not stop if it does not need to. - PATH_EXACT_PATH, - PATH_EXACT_STOP, // G61.1 - stops at all corners + PATH_EXACT_PATH, // G61 hits corners but stops only if needed + PATH_EXACT_STOP, // G61.1 stops at all corners PATH_CONTINUOUS, // G64 and typically the default mode } path_mode_t; @@ -148,7 +147,7 @@ typedef enum { INVERSE_TIME_MODE, // G93 UNITS_PER_MINUTE_MODE, // G94 UNITS_PER_REVOLUTION_MODE, // G95 (unimplemented) -} feed_rate_mode_t; +} feed_mode_t; typedef enum { @@ -230,7 +229,7 @@ typedef struct { uint8_t tool_select; // T - sets this value float feed_rate; // F - in mm/min or inverse time mode - feed_rate_mode_t feed_rate_mode; + feed_mode_t feed_mode; float feed_override_factor; // 1.0000 x F feed rate bool feed_override_enable; // M48, M49 @@ -241,10 +240,10 @@ typedef struct { motion_mode_t motion_mode; // Group 1 modal motion plane_t plane; // G17, G18, G19 - units_mode_t units_mode; // G20, G21 + 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_control; // G61 + path_mode_t path_mode; // G61 distance_mode_t distance_mode; // G91 distance_mode_t arc_distance_mode; // G91.1 @@ -311,16 +310,16 @@ extern machine_t mach; // machine controller singleton uint32_t mach_get_line(); motion_mode_t mach_get_motion_mode(); coord_system_t mach_get_coord_system(); -units_mode_t mach_get_units_mode(); +units_t mach_get_units(); plane_t mach_get_plane(); -path_mode_t mach_get_path_control(); +path_mode_t mach_get_path_mode(); distance_mode_t mach_get_distance_mode(); -feed_rate_mode_t mach_get_feed_rate_mode(); +feed_mode_t mach_get_feed_mode(); uint8_t mach_get_tool(); float mach_get_feed_rate(); -PGM_P mp_get_units_mode_pgmstr(units_mode_t mode); -PGM_P mp_get_feed_rate_mode_pgmstr(feed_rate_mode_t mode); +PGM_P mp_get_units_pgmstr(units_t mode); +PGM_P mp_get_feed_mode_pgmstr(feed_mode_t mode); PGM_P mp_get_plane_pgmstr(plane_t plane); PGM_P mp_get_coord_system_pgmstr(coord_system_t cs); PGM_P mp_get_path_mode_pgmstr(path_mode_t mode); @@ -360,7 +359,7 @@ stat_t mach_alarm(const char *location, stat_t status); // Representation (4.3.3) void mach_set_plane(plane_t plane); -void mach_set_units_mode(units_mode_t mode); +void mach_set_units(units_t mode); void mach_set_distance_mode(distance_mode_t mode); void mach_set_coord_offsets(coord_system_t coord_system, float offset[], float flag[]); @@ -386,8 +385,8 @@ stat_t mach_goto_g30_position(float target[], float flags[]); // Machining Attributes (4.3.5) void mach_set_feed_rate(float feed_rate); -void mach_set_feed_rate_mode(feed_rate_mode_t mode); -void mach_set_path_control(path_mode_t mode); +void mach_set_feed_mode(feed_mode_t mode); +void mach_set_path_mode(path_mode_t mode); // Machining Functions (4.3.6) stat_t mach_feed(float target[], float flags[]); diff --git a/src/plan/arc.c b/src/plan/arc.c index db5308b..21147aa 100644 --- a/src/plan/arc.c +++ b/src/plan/arc.c @@ -80,7 +80,7 @@ static float _estimate_arc_time(float length, float linear_travel, float planar_travel) { // Determine move time at requested feed rate // Inverse feed rate is normalized to minutes - float time = mach.gm.feed_rate_mode == INVERSE_TIME_MODE ? + float time = mach.gm.feed_mode == INVERSE_TIME_MODE ? mach.gm.feed_rate : length / mach.gm.feed_rate; // Downgrade the time if there is a rate-limiting axis @@ -344,7 +344,7 @@ stat_t mach_arc_feed(float target[], float flags[], // arc endpoints uint8_t motion_mode) { // defined motion mode // trap missing feed rate if (fp_ZERO(mach.gm.feed_rate) || - (mach.gm.feed_rate_mode == INVERSE_TIME_MODE && !mach.gf.feed_rate)) + (mach.gm.feed_mode == INVERSE_TIME_MODE && !mach.gf.feed_rate)) return STAT_GCODE_FEEDRATE_NOT_SPECIFIED; // set radius mode flag and do simple test(s) diff --git a/src/plan/line.c b/src/plan/line.c index 504734b..6727b65 100644 --- a/src/plan/line.c +++ b/src/plan/line.c @@ -247,7 +247,7 @@ static void _calc_max_velocities(mp_buffer_t *bf, float move_time) { bf->braking_velocity = bf->delta_vmax; // Zero out exact stop cases - if (mach_get_path_control() == PATH_EXACT_STOP) + if (mach_get_path_mode() == PATH_EXACT_STOP) bf->entry_vmax = bf->exit_vmax = 0; else bf->replannable = true; } diff --git a/src/plan/runtime.c b/src/plan/runtime.c index 7634886..e7fbe1c 100644 --- a/src/plan/runtime.c +++ b/src/plan/runtime.c @@ -53,28 +53,22 @@ typedef struct { typedef struct { int32_t line; // Current move GCode line number + uint8_t tool; float feed; - feed_rate_mode_t feed_rate_mode; + feed_mode_t feed_mode; float feed_override; - - float speed; - spindle_mode_t spindle_mode; float spindle_override; - motion_mode_t motion_mode; plane_t plane; - units_mode_t units_mode; + units_t units; coord_system_t coord_system; bool absolute_mode; - path_mode_t path_control; + path_mode_t path_mode; distance_mode_t distance_mode; distance_mode_t arc_distance_mode; - bool mist_coolant; - bool flood_coolant; - } mach_state_t; diff --git a/src/probing.c b/src/probing.c index ee76982..3850d29 100644 --- a/src/probing.c +++ b/src/probing.c @@ -192,7 +192,7 @@ bool mach_is_probing() { /// G38.2 homing cycle using limit switches stat_t mach_probe(float target[], float flags[]) { // trap zero feed rate condition - if (mach.gm.feed_rate_mode != INVERSE_TIME_MODE && fp_ZERO(mach.gm.feed_rate)) + if (mach.gm.feed_mode != INVERSE_TIME_MODE && fp_ZERO(mach.gm.feed_rate)) return STAT_GCODE_FEEDRATE_NOT_SPECIFIED; // trap no axes specified diff --git a/src/varcb.c b/src/varcb.c index 4f48ebf..e81fd4f 100644 --- a/src/varcb.c +++ b/src/varcb.c @@ -37,14 +37,14 @@ float get_position(int index) {return mp_runtime_get_axis_position(index);} // GCode int32_t get_line() {return mp_runtime_get_line();} -PGM_P get_unit() {return mp_get_units_mode_pgmstr(mach_get_units_mode());} +PGM_P get_unit() {return mp_get_units_pgmstr(mach_get_units());} float get_speed() {return spindle_get_speed();} float get_feed() {return mach_get_feed_rate();} uint8_t get_tool() {return mach_get_tool();} -PGM_P get_feed_rate_mode() { - return mp_get_feed_rate_mode_pgmstr(mach.gm.feed_rate_mode); +PGM_P get_feed_mode() { + return mp_get_feed_mode_pgmstr(mach.gm.feed_mode); } @@ -57,7 +57,7 @@ PGM_P get_coord_system() { bool get_abs_override() {return mach.gm.absolute_mode;} -PGM_P get_path_control() {return mp_get_path_mode_pgmstr(mach.gm.path_control);} +PGM_P get_path_mode() {return mp_get_path_mode_pgmstr(mach.gm.path_mode);} PGM_P get_distance_mode() { diff --git a/src/vars.def b/src/vars.def index 03a4727..945e092 100644 --- a/src/vars.def +++ b/src/vars.def @@ -97,11 +97,11 @@ VAR(unit, "u", pstring, 0, 0, 0, "Current unit of measure") VAR(speed, "s", float, 0, 0, 0, "Current spindle speed") VAR(feed, "f", float, 0, 0, 0, "Current feed rate") VAR(tool, "t", uint8_t, 0, 0, 0, "Current tool") -VAR(feed_rate_mode, "fm", pstring, 0, 0, 0, "Current feed rate mode") +VAR(feed_mode, "fm", pstring, 0, 0, 0, "Current feed rate mode") VAR(plane, "pa", pstring, 0, 0, 0, "Current plane") VAR(coord_system, "cs", pstring, 0, 0, 0, "Current coordinate system") VAR(abs_override, "ao", bool, 0, 0, 0, "Absolute override enabled") -VAR(path_control, "pc", pstring, 0, 0, 0, "Current path control mode") +VAR(path_mode, "pc", pstring, 0, 0, 0, "Current path control mode") VAR(distance_mode, "dm", pstring, 0, 0, 0, "Current distance mode") VAR(arc_dist_mode, "ad", pstring, 0, 0, 0, "Current arc distance mode") VAR(mist_coolant, "mc", bool, 0, 0, 0, "Mist coolant enabled")