From 68fab723995f2df27d36c5a5c6a519c8c8bed994 Mon Sep 17 00:00:00 2001 From: Alden Hart Date: Thu, 5 Jan 2017 15:57:07 -0500 Subject: [PATCH] Fixed some merge errors in configuration code --- g2core/board/Archim/hardware.h | 4 +- g2core/board/gquadratic/hardware.h | 11 +- g2core/canonical_machine.cpp | 42 +-- g2core/canonical_machine.h | 421 +---------------------------- g2core/config.h | 12 +- g2core/config_app.cpp | 375 ++++++++++++------------- g2core/gcode.h | 14 +- g2core/json_parser.cpp | 6 +- g2core/text_parser.cpp | 4 +- 9 files changed, 202 insertions(+), 687 deletions(-) diff --git a/g2core/board/Archim/hardware.h b/g2core/board/Archim/hardware.h index 2bfa2255..57560f43 100644 --- a/g2core/board/Archim/hardware.h +++ b/g2core/board/Archim/hardware.h @@ -5,8 +5,8 @@ * * This file is part of the g2core project * - * Copyright (c) 2013 - 2016 Alden S. Hart, Jr. - * Copyright (c) 2013 - 2016 Robert Giseburt + * Copyright (c) 2013 - 2017 Alden S. Hart, Jr. + * Copyright (c) 2013 - 2017 Robert Giseburt * * 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 diff --git a/g2core/board/gquadratic/hardware.h b/g2core/board/gquadratic/hardware.h index 9642b841..d18efe5b 100644 --- a/g2core/board/gquadratic/hardware.h +++ b/g2core/board/gquadratic/hardware.h @@ -5,8 +5,8 @@ * * This file is part of the g2core project * - * Copyright (c) 2013 - 2016 Alden S. Hart, Jr. - * Copyright (c) 2013 - 2016 Robert Giseburt + * Copyright (c) 2013 - 2017 Alden S. Hart, Jr. + * Copyright (c) 2013 - 2017 Robert Giseburt * * 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 @@ -56,13 +56,6 @@ * Motate Setup * *************************/ -//////////////////////////// -/////// ARM VERSION //////// -//////////////////////////// - -// ARM specific code start here ->>>>>>> refs/heads/edge - #include "MotatePins.h" #include "MotateTimers.h" // for TimerChanel<> and related... #include "MotateServiceCall.h" // for ServiceCall<> diff --git a/g2core/canonical_machine.cpp b/g2core/canonical_machine.cpp index aec0ec43..69cfe2f2 100644 --- a/g2core/canonical_machine.cpp +++ b/g2core/canonical_machine.cpp @@ -2395,27 +2395,16 @@ stat_t cm_get_am(nvObj_t *nv) stat_t cm_set_am(nvObj_t *nv) // axis mode { - nv->valuetype = TYPE_NULL; if (cm_get_axis_type(nv->index) == AXIS_TYPE_LINEAR) { if (nv->value > AXIS_MODE_LINEAR_MAX) { - return (STAT_INPUT_VALUE_RANGE_ERROR); + nv->valuetype = TYPE_NULL; + return (STAT_INPUT_EXCEEDS_MAX_VALUE); } } else { if (nv->value > AXIS_MODE_ROTARY_MAX) { - return (STAT_INPUT_VALUE_RANGE_ERROR); -/*======= - if (cm_get_axis_type(nv->index) == 0) { // linear - if (nv->value > AXIS_MODE_MAX_LINEAR) { nv->valuetype = TYPE_NULL; return (STAT_INPUT_EXCEEDS_MAX_VALUE); } - } else { - if (nv->value > AXIS_MODE_MAX_ROTARY) { - nv->valuetype = TYPE_NULL; - return (STAT_INPUT_EXCEEDS_MAX_VALUE); ->>>>>>> refs/heads/edge -*/ - } } nv->valuetype = TYPE_INT; cm->a[_axis(nv->index)].axis_mode = (cmAxisMode)nv->value; @@ -2428,21 +2417,6 @@ stat_t cm_get_tm(nvObj_t *nv) { return (get_float(nv, cm->a[_axis(nv->index)].tr stat_t cm_set_tm(nvObj_t *nv) { return (set_float(nv, cm->a[_axis(nv->index)].travel_max)); } stat_t cm_get_ra(nvObj_t *nv) { return (get_float(nv, cm->a[_axis(nv->index)].radius)); } stat_t cm_set_ra(nvObj_t *nv) { return (get_float(nv, cm->a[_axis(nv->index)].radius)); } -/* -stat_t cm_set_hi(nvObj_t *nv) -{ - if (nv->value < 0) { - nv->valuetype = TYPE_NULL; - return (STAT_INPUT_LESS_THAN_MIN_VALUE); - } - if (nv->value > D_IN_CHANNELS) { - nv->valuetype = TYPE_NULL; - return (STAT_INPUT_EXCEEDS_MAX_VALUE); - } - set_ui8(nv); - return (STAT_OK); -} -*/ /**** Axis Jerk Primitives * cm_get_axis_jerk() - returns jerk for an axis @@ -2493,7 +2467,7 @@ stat_t cm_get_vm(nvObj_t *nv) { return (get_float(nv, cm->a[_axis(nv->index)].ve stat_t cm_set_vm(nvObj_t *nv) { uint8_t axis = _axis(nv->index); - set_float(nv, cm->a[axis].velocity_max); + ritorno(set_float_range(nv, cm->a[axis].velocity_max, 0, MAX_LONG)); cm->a[axis].recip_velocity_max = 1/nv->value; return(STAT_OK); } @@ -2502,7 +2476,7 @@ stat_t cm_get_fr(nvObj_t *nv) { return (get_float(nv, cm->a[_axis(nv->index)].fe stat_t cm_set_fr(nvObj_t *nv) { uint8_t axis = _axis(nv->index); - set_float(nv, cm->a[axis].feedrate_max); + ritorno(set_float_range(nv, cm->a[axis].feedrate_max, 0, MAX_LONG)); cm->a[axis].recip_feedrate_max = 1/nv->value; return(STAT_OK); } @@ -2540,9 +2514,9 @@ stat_t cm_set_hi(nvObj_t *nv) { return (set_int(nv, cm->a[_axis(nv->index)].homi stat_t cm_get_hd(nvObj_t *nv) { return (get_int(nv, cm->a[_axis(nv->index)].homing_dir)); } stat_t cm_set_hd(nvObj_t *nv) { return (set_int(nv, cm->a[_axis(nv->index)].homing_dir, 0, 1)); } stat_t cm_get_sv(nvObj_t *nv) { return (get_float(nv, cm->a[_axis(nv->index)].search_velocity)); } -stat_t cm_set_sv(nvObj_t *nv) { return (set_float(nv, cm->a[_axis(nv->index)].search_velocity)); } +stat_t cm_set_sv(nvObj_t *nv) { return (set_float_range(nv, cm->a[_axis(nv->index)].search_velocity, 0, MAX_LONG)); } stat_t cm_get_lv(nvObj_t *nv) { return (get_float(nv, cm->a[_axis(nv->index)].latch_velocity)); } -stat_t cm_set_lv(nvObj_t *nv) { return (set_float(nv, cm->a[_axis(nv->index)].latch_velocity)); } +stat_t cm_set_lv(nvObj_t *nv) { return (set_float_range(nv, cm->a[_axis(nv->index)].latch_velocity, 0, MAX_LONG)); } stat_t cm_get_lb(nvObj_t *nv) { return (get_float(nv, cm->a[_axis(nv->index)].latch_backoff)); } stat_t cm_set_lb(nvObj_t *nv) { return (set_float(nv, cm->a[_axis(nv->index)].latch_backoff)); } stat_t cm_get_zb(nvObj_t *nv) { return (get_float(nv, cm->a[_axis(nv->index)].zero_backoff)); } @@ -2816,7 +2790,7 @@ static void _print_axis_ui8(nvObj_t *nv, const char *format) static void _print_axis_flt(nvObj_t *nv, const char *format) { char *units; - if (cm_get_axis_type(nv->index) == 0) { // linear + if (cm_get_axis_type(nv->index) == AXIS_TYPE_LINEAR) { units = (char *)GET_UNITS(MODEL); } else { units = (char *)GET_TEXT_ITEM(msg_units, DEGREE_INDEX); @@ -2828,7 +2802,7 @@ static void _print_axis_flt(nvObj_t *nv, const char *format) static void _print_axis_coord_flt(nvObj_t *nv, const char *format) { char *units; - if (cm_get_axis_type(nv->index) == 0) { // linear + if (cm_get_axis_type(nv->index) == AXIS_TYPE_LINEAR) { units = (char *)GET_UNITS(MODEL); } else { units = (char *)GET_TEXT_ITEM(msg_units, DEGREE_INDEX); diff --git a/g2core/canonical_machine.h b/g2core/canonical_machine.h index 411ce0d8..12e5493d 100644 --- a/g2core/canonical_machine.h +++ b/g2core/canonical_machine.h @@ -146,358 +146,6 @@ typedef enum { // queue flush state machine FLUSH_REQUESTED, // flush has been requested but not started yet } cmQueueFlushState; -/*======= - * The difference between NextAction and MotionMode is that NextAction is - * used by the current block, and may carry non-modal commands, whereas - * MotionMode persists across blocks (as G modal group 1) - */ -/* -typedef enum { // these are in order to optimized CASE statement - NEXT_ACTION_DEFAULT = 0, // Must be zero (invokes motion modes) - NEXT_ACTION_DWELL, // G4 - NEXT_ACTION_SET_G10_DATA, // G10 - NEXT_ACTION_GOTO_G28_POSITION, // G28 go to machine position - NEXT_ACTION_SET_G28_POSITION, // G28.1 set position in abs coordinates - NEXT_ACTION_SEARCH_HOME, // G28.2 homing cycle - NEXT_ACTION_SET_ABSOLUTE_ORIGIN, // G28.3 origin set - NEXT_ACTION_HOMING_NO_SET, // G28.4 homing cycle with no coordinate setting - NEXT_ACTION_GOTO_G30_POSITION, // G30 go to machine position - NEXT_ACTION_SET_G30_POSITION, // G30.1 set position in abs coordinates - NEXT_ACTION_STRAIGHT_PROBE_ERR, // G38.2 - NEXT_ACTION_STRAIGHT_PROBE, // G38.3 - NEXT_ACTION_STRAIGHT_PROBE_AWAY_ERR,// G38.4 - NEXT_ACTION_STRAIGHT_PROBE_AWAY, // G38.5 - NEXT_ACTION_SET_TL_OFFSET, // G43 - NEXT_ACTION_SET_ADDITIONAL_TL_OFFSET,// G43.2 - NEXT_ACTION_CANCEL_TL_OFFSET, // G49 - NEXT_ACTION_SET_ORIGIN_OFFSETS, // G92 - NEXT_ACTION_RESET_ORIGIN_OFFSETS, // G92.1 - NEXT_ACTION_SUSPEND_ORIGIN_OFFSETS, // G92.2 - NEXT_ACTION_RESUME_ORIGIN_OFFSETS, // G92.3 - NEXT_ACTION_JSON_COMMAND_SYNC, // M100 - NEXT_ACTION_JSON_WAIT // M101 -} cmNextAction; - -typedef enum { // G Modal Group 1 - MOTION_MODE_STRAIGHT_TRAVERSE=0, // G0 - straight traverse - MOTION_MODE_STRAIGHT_FEED, // G1 - straight feed - MOTION_MODE_CW_ARC, // G2 - clockwise arc feed - MOTION_MODE_CCW_ARC, // G3 - counter-clockwise arc feed - MOTION_MODE_CANCEL_MOTION_MODE, // G80 - MOTION_MODE_STRAIGHT_PROBE, // G38.2 - MOTION_MODE_CANNED_CYCLE_81, // G81 - drilling - MOTION_MODE_CANNED_CYCLE_82, // G82 - drilling with dwell - MOTION_MODE_CANNED_CYCLE_83, // G83 - peck drilling - MOTION_MODE_CANNED_CYCLE_84, // G84 - right hand tapping - MOTION_MODE_CANNED_CYCLE_85, // G85 - boring, no dwell, feed out - MOTION_MODE_CANNED_CYCLE_86, // G86 - boring, spindle stop, rapid out - MOTION_MODE_CANNED_CYCLE_87, // G87 - back boring - MOTION_MODE_CANNED_CYCLE_88, // G88 - boring, spindle stop, manual out - MOTION_MODE_CANNED_CYCLE_89 // G89 - boring, dwell, feed out -} cmMotionMode; - -typedef enum { // Used for detecting gcode errors. See NIST section 3.4 - MODAL_GROUP_G0 = 0, // {G10,G28,G28.1,G92} non-modal axis commands (note 1) - MODAL_GROUP_G1, // {G0,G1,G2,G3,G80} motion - MODAL_GROUP_G2, // {G17,G18,G19} plane selection - MODAL_GROUP_G3, // {G90,G91} distance mode - MODAL_GROUP_G5, // {G93,G94} feed rate mode - MODAL_GROUP_G6, // {G20,G21} units - MODAL_GROUP_G7, // {G40,G41,G42} cutter radius compensation - MODAL_GROUP_G8, // {G43,G49} tool length offset - MODAL_GROUP_G9, // {G98,G99} return mode in canned cycles - MODAL_GROUP_G12, // {G54,G55,G56,G57,G58,G59} coordinate system selection - MODAL_GROUP_G13, // {G61,G61.1,G64} path control mode - MODAL_GROUP_M4, // {M0,M1,M2,M30,M60} stopping - MODAL_GROUP_M6, // {M6} tool change - MODAL_GROUP_M7, // {M3,M4,M5} spindle turning - MODAL_GROUP_M8, // {M7,M8,M9} coolant (M7 & M8 may be active together) - MODAL_GROUP_M9 // {M48,M49} speed/feed override switches -} cmModalGroup; -#define MODAL_GROUP_COUNT (MODAL_GROUP_M9+1) -// Note 1: Our G0 omits G4,G30,G53,G92.1,G92.2,G92.3 as these have no axis components to error check - -typedef enum { // canonical plane - translates to: - // axis_0 axis_1 axis_2 - CANON_PLANE_XY = 0, // G17 X Y Z - CANON_PLANE_XZ, // G18 X Z Y - CANON_PLANE_YZ // G19 Y Z X -} cmCanonicalPlane; - -typedef enum { - INCHES = 0, // G20 - MILLIMETERS, // G21 - DEGREES // ABC axes (this value used for displays only) -} cmUnitsMode; - -typedef enum { - ABSOLUTE_COORDS = 0, // machine coordinate system - G54, // G54 coordinate system - G55, // G55 coordinate system - G56, // G56 coordinate system - G57, // G57 coordinate system - G58, // G58 coordinate system - G59 // G59 coordinate system -} cmCoordSystem; -#define COORD_SYSTEM_MAX G59 // set this manually to the last one - -typedef enum { - ABSOLUTE_OVERRIDE_OFF = 0,// G53 enabled - ABSOLUTE_OVERRIDE_ON -} cmAbsoluteOverride; - -typedef enum { // G Modal Group 13 - PATH_EXACT_PATH = 0, // G61 - hits corners but does not stop if it does not need to. - PATH_EXACT_STOP, // G61.1 - stops at all corners - PATH_CONTINUOUS // G64 and typically the default mode -} cmPathControl; - -typedef enum { - ABSOLUTE_DISTANCE_MODE = 0, // G90 / G90.1 - INCREMENTAL_DISTANCE_MODE // G91 / G91.1 -} cmDistanceMode; - -typedef enum { - INVERSE_TIME_MODE = 0, // G93 - UNITS_PER_MINUTE_MODE, // G94 - UNITS_PER_REVOLUTION_MODE// G95 (unimplemented) -} cmFeedRateMode; - -typedef enum { - ORIGIN_OFFSET_SET=0, // G92 - set origin offsets - ORIGIN_OFFSET_CANCEL, // G92.1 - zero out origin offsets - ORIGIN_OFFSET_SUSPEND, // G92.2 - do not apply offsets, but preserve the values - ORIGIN_OFFSET_RESUME // G92.3 - resume application of the suspended offsets -} cmOriginOffset; - -typedef enum { - PROGRAM_STOP = 0, - PROGRAM_END -} cmProgramFlow; - -typedef enum { // used for spindle and arc dir - DIRECTION_CW = 0, - DIRECTION_CCW -} cmDirection; - -typedef enum { // axis types - AXIS_TYPE_UNDEFINED=-2, // invalid type - AXIS_TYPE_SYSTEM=-1, // token is global system token, not axis - AXIS_TYPE_LINEAR, // linear axis - AXIS_TYPE_ROTARY // rotary axis -} cmAxisType; - -typedef enum { // axis modes (ordered: see _cm_get_feed_time()) - AXIS_DISABLED = 0, // kill axis - AXIS_STANDARD, // axis in coordinated motion w/standard behaviors - AXIS_INHIBITED, // axis is computed but not activated - AXIS_RADIUS // rotary axis calibrated to circumference -} cmAxisMode; -#define AXIS_MODE_MAX_LINEAR AXIS_INHIBITED -#define AXIS_MODE_MAX_ROTARY AXIS_RADIUS -*/ -/***************************************************************************** - * GCODE MODEL - The following GCodeModel/GCodeInput structs are used: - * - * - gm is the core Gcode model state. It keeps the internal gcode state model in - * normalized, canonical form. All values are unit converted (to mm) and in the - * machine coordinate system (absolute coordinate system). Gm is owned by the - * canonical machine layer and should be accessed only through cm_ routines. - * - * The gm core struct is copied and passed as context to the runtime where it is - * used for planning, move execution, feedholds, and reporting. - * - * - gmx is the extended gcode model variables that are only used by the canonical - * machine and do not need to be passed further down. It keeps "global" gcode - * state that does not change when you go down through the planner to the runtime. - * Other Gcode model state is kept in the singletons for various sub-systems, such - * as arcs, spindle, coolant, and others (i.e. not ALL gcode global state is in gmx) - * - * - gn is used by the gcode interpreter and is re-initialized for each - * gcode block.It accepts data in the new gcode block in the formats - * present in the block (pre-normalized forms). During initialization - * some state elements are necessarily restored from gm. - * - * - gf is used by the gcode parser interpreter to hold flags for any data - * that has changed in gn during the parse. cm.gf.target[] values are also used - * by the canonical machine during set_target(). - * - * - cfg (config struct in config.h) is also used heavily and contains some - * values that might be considered to be Gcode model values. The distinction - * is that all values in the config are persisted and restored, whereas the - * gm structs are transient. So cfg has the G54 - G59 offsets, but gm has the - * G92 offsets. cfg has the power-on / reset gcode default values, but gm has - * the operating state for the values (which may have changed). - */ -/* -typedef struct GCodeState { // Gcode model state - used by model, planning and runtime - uint32_t linenum; // Gcode block line number - cmMotionMode motion_mode; // Group1: G0, G1, G2, G3, G38.2, G80, G81, - // G82, G83 G84, G85, G86, G87, G88, G89 - - float target[AXES]; // XYZABC where the move should go - float target_comp[AXES]; // summation compensation (Kahan) overflow value - float work_offset[AXES]; // offset from the work coordinate system (for reporting only) - - float feed_rate; // F - normalized to millimeters/minute or in inverse time mode - float parameter; // P - parameter used for dwell time in seconds, G10 coord select... - - cmFeedRateMode feed_rate_mode; // See cmFeedRateMode for settings - cmCanonicalPlane select_plane; // G17,G18,G19 - values to set plane to - cmUnitsMode units_mode; // G20,G21 - 0=inches (G20), 1 = mm (G21) - cmPathControl path_control; // G61... EXACT_PATH, EXACT_STOP, CONTINUOUS - cmDistanceMode distance_mode; // G90=use absolute coords, G91=incremental movement - cmDistanceMode arc_distance_mode; // G90.1=use absolute IJK offsets, G91.1=incremental IJK offsets - cmAbsoluteOverride absolute_override;// G53 TRUE = move using machine coordinates - this block only - cmCoordSystem coord_system; // G54-G59 - select coordinate system 1-9 - uint8_t tool; // G // M6 tool change - moves "tool_select" to "tool" - uint8_t tool_select; // G // T value - T sets this value - - void reset() { - linenum = 0; - motion_mode = MOTION_MODE_STRAIGHT_TRAVERSE; - - for (uint8_t i = 0; i< AXES; i++) { - target[i] = 0.0; - work_offset[i] = 0.0; - } - - feed_rate = 0.0; - parameter = 0.0; - - feed_rate_mode = INVERSE_TIME_MODE; - select_plane = CANON_PLANE_XY; - units_mode = INCHES; - path_control = PATH_EXACT_PATH; - distance_mode = ABSOLUTE_DISTANCE_MODE; - arc_distance_mode = ABSOLUTE_DISTANCE_MODE; - absolute_override = ABSOLUTE_OVERRIDE_OFF; - coord_system = ABSOLUTE_COORDS; - tool = 0; - tool_select = 0; - - }; -} GCodeState_t; - -typedef struct GCodeStateExtended { // Gcode dynamic state extensions - used by model and arcs - uint16_t magic_start; // magic number to test memory integrity - uint8_t next_action; // handles G modal group 1 moves & non-modals - uint8_t program_flow; // used only by the gcode_parser - - float position[AXES]; // XYZABC model position (Note: not used in gn or gf) - float origin_offset[AXES]; // XYZABC G92 offsets (Note: not used in gn or gf) - float g28_position[AXES]; // XYZABC stored machine position for G28 - float g30_position[AXES]; // XYZABC stored machine position for G30 - - bool m48_enable; // master feedrate / spindle speed override enable - bool mfo_enable; // feedrate override enable - float mfo_factor; // 1.0000 x F feed rate. Go up or down from there - bool mto_enable; // traverse override enable - float mto_factor; // valid from 0.05 to 1.00 - - bool origin_offset_enable; // G92 offsets enabled/disabled. 0=disabled, 1=enabled - bool block_delete_switch; // set true to enable block deletes (true is default) - -// unimplemented gcode parameters -// float cutter_radius; // D - cutter radius compensation (0 is off) -// float cutter_length; // H - cutter length compensation (0 is off) - - uint16_t magic_end; - -} GCodeStateX_t; - -typedef struct GCodeInput { // Gcode model inputs - meaning depends on context - - uint8_t next_action; // handles G modal group 1 moves & non-modals - cmMotionMode motion_mode; // Group1: G0, G1, G2, G3, G38.2, G80, G81, G82 - // G83, G84, G85, G86, G87, G88, G89 - - uint8_t program_flow; // used only by the gcode_parser - uint32_t linenum; // N word - float target[AXES]; // XYZABC where the move should go - - uint8_t H_word; // H word - used by G43s - uint8_t L_word; // L word - used by G10s - - float feed_rate; // F - normalized to millimeters/minute - uint8_t feed_rate_mode; // See cmFeedRateMode for settings - float parameter; // P - parameter used for dwell time in seconds, G10 coord select... - float arc_radius; // R - radius value in arc radius mode - float arc_offset[3]; // IJK - used by arc commands - - bool m48_enable; // M48/M49 input (enables for feed and spindle) - bool mfo_enable; // M50 feedrate override enable - bool mto_enable; // Mxx traverse override enable - bool sso_enable; // M51 spindle speed override enable - - uint8_t select_plane; // G17,G18,G19 - values to set plane to - uint8_t units_mode; // G20,G21 - 0=inches (G20), 1 = mm (G21) - uint8_t coord_system; // G54-G59 - select coordinate system 1-9 - uint8_t path_control; // G61... EXACT_PATH, EXACT_STOP, CONTINUOUS - uint8_t distance_mode; // G91 0=use absolute coords(G90), 1=incremental movement - uint8_t arc_distance_mode; // G90.1=use absolute IJK offsets, G91.1=incremental IJK offsets - uint8_t origin_offset_mode; // G92...TRUE=in origin offset mode - uint8_t absolute_override; // G53 TRUE = move using machine coordinates - this block only (G53) - uint8_t tool; // Tool after T and M6 (tool_select and tool_change) - uint8_t tool_select; // T value - T sets this value - uint8_t tool_change; // M6 tool change flag - moves "tool_select" to "tool" - uint8_t mist_coolant; // TRUE = mist on (M7), FALSE = off (M9) - uint8_t flood_coolant; // TRUE = flood on (M8), FALSE = off (M9) - - uint8_t spindle_control; // 0=OFF (M5), 1=CW (M3), 2=CCW (M4) - float spindle_speed; // in RPM - float spindle_override_factor; // 1.0000 x S spindle speed. Go up or down from there - uint8_t spindle_override_enable; // TRUE = override enabled - -// unimplemented gcode parameters -// float cutter_radius; // D - cutter radius compensation (0 is off) - -} GCodeInput_t; - -typedef struct GCodeFlags { // Gcode model input flags - bool next_action; - bool motion_mode; - bool modals[MODAL_GROUP_COUNT]; - bool program_flow; - bool linenum; - bool target[AXES]; - - bool H_word; - bool L_word; - bool feed_rate; - bool feed_rate_mode; - - bool m48_enable; - bool mfo_enable; - bool mto_enable; - bool sso_enable; - - bool select_plane; - bool units_mode; - bool coord_system; - bool path_control; - bool distance_mode; - bool arc_distance_mode; - bool origin_offset_mode; - bool absolute_override; - bool tool; - bool tool_select; - bool tool_change; - bool mist_coolant; - bool flood_coolant; - - bool spindle_control; - bool spindle_speed; - bool spindle_override_factor; - bool spindle_override_enable; - - bool parameter; - bool arc_radius; - bool arc_offset[3]; -} GCodeFlags_t; ->>>>>>> refs/heads/edge -*/ - /***************************************************************************** * CANONICAL MACHINE STRUCTURES */ @@ -988,74 +636,7 @@ stat_t cm_get_tram(nvObj_t *nv); // return if the rotation matrix is non- void cm_print_zb(nvObj_t *nv); void cm_print_cofs(nvObj_t *nv); void cm_print_cpos(nvObj_t *nv); -/*======= - void cm_print_vel(nvObj_t *nv); // model state reporting - void cm_print_feed(nvObj_t *nv); - void cm_print_line(nvObj_t *nv); - void cm_print_stat(nvObj_t *nv); - void cm_print_macs(nvObj_t *nv); - void cm_print_cycs(nvObj_t *nv); - void cm_print_mots(nvObj_t *nv); - void cm_print_hold(nvObj_t *nv); - void cm_print_home(nvObj_t *nv); - void cm_print_hom(nvObj_t *nv); - void cm_print_unit(nvObj_t *nv); - void cm_print_coor(nvObj_t *nv); - void cm_print_momo(nvObj_t *nv); - void cm_print_plan(nvObj_t *nv); - void cm_print_path(nvObj_t *nv); - void cm_print_dist(nvObj_t *nv); - void cm_print_admo(nvObj_t *nv); - void cm_print_frmo(nvObj_t *nv); - void cm_print_tool(nvObj_t *nv); - void cm_print_g92e(nvObj_t *nv); - - void cm_print_gpl(nvObj_t *nv); // Gcode defaults - void cm_print_gun(nvObj_t *nv); - void cm_print_gco(nvObj_t *nv); - void cm_print_gpa(nvObj_t *nv); - void cm_print_gdi(nvObj_t *nv); - - void cm_print_lin(nvObj_t *nv); // generic print for linear values - void cm_print_pos(nvObj_t *nv); // print runtime work position in prevailing units - void cm_print_mpo(nvObj_t *nv); // print runtime work position always in MM uints - void cm_print_ofs(nvObj_t *nv); // print runtime work offset always in MM uints - void cm_print_tof(nvObj_t *nv); // print tool length offset - - void cm_print_jt(nvObj_t *nv); // global CM settings - void cm_print_ct(nvObj_t *nv); - void cm_print_sl(nvObj_t *nv); - void cm_print_lim(nvObj_t *nv); - void cm_print_saf(nvObj_t *nv); - - void cm_print_m48e(nvObj_t *nv); - void cm_print_mfoe(nvObj_t *nv); - void cm_print_mfo(nvObj_t *nv); - void cm_print_mtoe(nvObj_t *nv); - void cm_print_mto(nvObj_t *nv); - - void cm_print_tram(nvObj_t *nv); // print if the axis has been rotated - - void cm_print_am(nvObj_t *nv); // axis print functions - void cm_print_fr(nvObj_t *nv); - void cm_print_vm(nvObj_t *nv); - void cm_print_tm(nvObj_t *nv); - void cm_print_tn(nvObj_t *nv); - void cm_print_jm(nvObj_t *nv); - void cm_print_jh(nvObj_t *nv); - void cm_print_ra(nvObj_t *nv); - - void cm_print_hi(nvObj_t *nv); - void cm_print_hd(nvObj_t *nv); - void cm_print_sv(nvObj_t *nv); - void cm_print_lv(nvObj_t *nv); - void cm_print_lb(nvObj_t *nv); - void cm_print_zb(nvObj_t *nv); - void cm_print_cofs(nvObj_t *nv); - void cm_print_cpos(nvObj_t *nv); ->>>>>>> refs/heads/edge -*/ - + #else // __TEXT_MODE #define cm_print_vel tx_print_stub // model state reporting diff --git a/g2core/config.h b/g2core/config.h index acefaefb..865848aa 100644 --- a/g2core/config.h +++ b/g2core/config.h @@ -2,7 +2,7 @@ * config.h - configuration sub-system generic part (see config_app for application part) * This file is part of the g2core project * - * Copyright (c) 2010 - 2016 Alden S. Hart, Jr. + * Copyright (c) 2010 - 2017 Alden S. Hart, Jr. * * 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 @@ -357,14 +357,14 @@ void nv_print_list(stat_t status, uint8_t text_flags, uint8_t json_flags); stat_t set_flu(nvObj_t *nv); // set floating point number with G20/G21 units conversion -void process_incoming_float(nvObj_t *nv); // pre-process outgoing float values for units and illegal values -void process_outgoing_float(nvObj_t *nv); // pre-process incoming float values for canonical units +void convert_incoming_float(nvObj_t *nv); // pre-process outgoing float values for units and illegal values +void convert_outgoing_float(nvObj_t *nv); // pre-process incoming float values for canonical units -stat_t get_float(nvObj_t *nv, const float value); // boilerplate for retrieving raw floating point value -stat_t set_float(nvObj_t *nv, float &value); // boilerplate for setting a floating point value w/conversion +stat_t get_float(nvObj_t *nv, const float value); // boilerplate for retrieving raw floating point value +stat_t set_float(nvObj_t *nv, float &value); // boilerplate for setting a floating point value w/conversion stat_t set_float_range(nvObj_t *nv, float &value, float low, float high); -stat_t get_int(nvObj_t *nv, const uint8_t value); // boilerplate for retrieving 8 bit integer value +stat_t get_int(nvObj_t *nv, const uint8_t value); // boilerplate for retrieving 8 bit integer value stat_t set_int(nvObj_t *nv, uint8_t &value, uint8_t low, uint8_t high); stat_t get_int32(nvObj_t *nv, const uint32_t value); // boilerplate for retrieving 32 bit integer value stat_t set_int32(nvObj_t *nv, uint32_t &value, uint32_t low, uint32_t high); diff --git a/g2core/config_app.cpp b/g2core/config_app.cpp index 308cf8b2..c291a1a4 100644 --- a/g2core/config_app.cpp +++ b/g2core/config_app.cpp @@ -2,8 +2,8 @@ * config_app.cpp - application-specific part of configuration data * This file is part of the g2core project * - * Copyright (c) 2013 - 2016 Alden S. Hart, Jr. - * Copyright (c) 2016 Robert Giseburt + * Copyright (c) 2013 - 2017 Alden S. Hart, Jr. + * Copyright (c) 2016 - 2017 Robert Giseburt * * 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 @@ -103,75 +103,75 @@ static stat_t get_tick(nvObj_t *nv); // get system tick count */ const cfgItem_t cfgArray[] = { // group token flags p, print_func, get_func, set_func, get/set target, default value - { "sys", "fb", _fipn,2, hw_print_fb, hw_get_fb, set_nul, (float *)&cs.null, 0 }, // MUST BE FIRST for persistence checking! - { "sys", "fv", _fipn,2, hw_print_fv, hw_get_fv, set_nul, (float *)&cs.null, 0 }, - { "sys", "fbs",_fn, 0, hw_print_fbs, hw_get_fbs, set_nul, (float *)&cs.null, 0 }, - { "sys", "fbc",_fn, 0, hw_print_fbc, hw_get_fbc, set_nul, (float *)&cs.null, 0 }, - { "sys", "hp", _fn, 0, hw_print_hp, hw_get_hp, set_nul, (float *)&cs.null, 0 }, - { "sys", "hv", _fn, 0, hw_print_hv, hw_get_hv, set_nul, (float *)&cs.null, 0 }, - { "sys", "id", _fn, 0, hw_print_id, hw_get_id, set_nul, (float *)&cs.null, 0 }, // device ID (ASCII signature) + { "sys", "fb", _fipn,2, hw_print_fb, hw_get_fb, set_ro, (float *)&cs.null, 0 }, // MUST BE FIRST for persistence checking! + { "sys", "fv", _fipn,2, hw_print_fv, hw_get_fv, set_ro, (float *)&cs.null, 0 }, + { "sys", "fbs",_fn, 0, hw_print_fbs, hw_get_fbs, set_ro, (float *)&cs.null, 0 }, + { "sys", "fbc",_fn, 0, hw_print_fbc, hw_get_fbc, set_ro, (float *)&cs.null, 0 }, + { "sys", "hp", _fn, 0, hw_print_hp, hw_get_hp, set_ro, (float *)&cs.null, 0 }, + { "sys", "hv", _fn, 0, hw_print_hv, hw_get_hv, set_ro, (float *)&cs.null, 0 }, + { "sys", "id", _fn, 0, hw_print_id, hw_get_id, set_ro, (float *)&cs.null, 0 }, // device ID (ASCII signature) // dynamic model attributes for reporting purposes (up front for speed) - { "", "stat",_f0, 0, cm_print_stat, cm_get_stat, set_nul,(float *)&cs.null, 0 }, // combined machine state - { "", "n", _fi, 0, cm_print_line, cm_get_mline,set_nul,(float *)&cs.null, 0 }, // Model line number - { "", "line",_fi, 0, cm_print_line, cm_get_line, set_nul,(float *)&cs.null, 0 }, // Active line number - model or runtime line number - { "", "vel", _f0, 2, cm_print_vel, cm_get_vel, set_nul,(float *)&cs.null, 0 }, // current velocity - { "", "feed",_f0, 2, cm_print_feed, cm_get_feed, set_nul,(float *)&cs.null, 0 }, // feed rate - { "", "macs",_f0, 0, cm_print_macs, cm_get_macs, set_nul,(float *)&cs.null, 0 }, // raw machine state - { "", "cycs",_f0, 0, cm_print_cycs, cm_get_cycs, set_nul,(float *)&cs.null, 0 }, // cycle state - { "", "mots",_f0, 0, cm_print_mots, cm_get_mots, set_nul,(float *)&cs.null, 0 }, // motion state - { "", "hold",_f0, 0, cm_print_hold, cm_get_hold, set_nul,(float *)&cs.null, 0 }, // feedhold state - { "", "unit",_f0, 0, cm_print_unit, cm_get_unit, set_nul,(float *)&cs.null, 0 }, // units mode - { "", "coor",_f0, 0, cm_print_coor, cm_get_coor, set_nul,(float *)&cs.null, 0 }, // coordinate system - { "", "momo",_f0, 0, cm_print_momo, cm_get_momo, set_nul,(float *)&cs.null, 0 }, // motion mode - { "", "plan",_f0, 0, cm_print_plan, cm_get_plan, set_nul,(float *)&cs.null, 0 }, // plane select - { "", "path",_f0, 0, cm_print_path, cm_get_path, set_nul,(float *)&cs.null, 0 }, // path control mode - { "", "dist",_f0, 0, cm_print_dist, cm_get_dist, set_nul,(float *)&cs.null, 0 }, // distance mode - { "", "admo",_f0, 0, cm_print_admo, cm_get_admo, set_nul,(float *)&cs.null, 0 }, // arc distance mode - { "", "frmo",_f0, 0, cm_print_frmo, cm_get_frmo, set_nul,(float *)&cs.null, 0 }, // feed rate mode - { "", "tool",_f0, 0, cm_print_tool, cm_get_toolv,set_nul,(float *)&cs.null, 0 }, // active tool -// { "", "g92e",_f0, 0, cm_print_g92e, get_ui8, set_nul,(float *)&cm->gmx.origin_offset_enable, 0 }, // G92 enabled + { "", "stat",_f0, 0, cm_print_stat, cm_get_stat, set_ro, (float *)&cs.null, 0 }, // combined machine state + { "", "n", _fi, 0, cm_print_line, cm_get_mline,set_ro, (float *)&cs.null, 0 }, // Model line number + { "", "line",_fi, 0, cm_print_line, cm_get_line, set_ro, (float *)&cs.null, 0 }, // Active line number - model or runtime line number + { "", "vel", _f0, 2, cm_print_vel, cm_get_vel, set_ro, (float *)&cs.null, 0 }, // current velocity + { "", "feed",_f0, 2, cm_print_feed, cm_get_feed, set_ro, (float *)&cs.null, 0 }, // feed rate + { "", "macs",_f0, 0, cm_print_macs, cm_get_macs, set_ro, (float *)&cs.null, 0 }, // raw machine state + { "", "cycs",_f0, 0, cm_print_cycs, cm_get_cycs, set_ro, (float *)&cs.null, 0 }, // cycle state + { "", "mots",_f0, 0, cm_print_mots, cm_get_mots, set_ro, (float *)&cs.null, 0 }, // motion state + { "", "hold",_f0, 0, cm_print_hold, cm_get_hold, set_ro, (float *)&cs.null, 0 }, // feedhold state + { "", "unit",_f0, 0, cm_print_unit, cm_get_unit, set_ro, (float *)&cs.null, 0 }, // units mode + { "", "coor",_f0, 0, cm_print_coor, cm_get_coor, set_ro, (float *)&cs.null, 0 }, // coordinate system + { "", "momo",_f0, 0, cm_print_momo, cm_get_momo, set_ro, (float *)&cs.null, 0 }, // motion mode + { "", "plan",_f0, 0, cm_print_plan, cm_get_plan, set_ro, (float *)&cs.null, 0 }, // plane select + { "", "path",_f0, 0, cm_print_path, cm_get_path, set_ro, (float *)&cs.null, 0 }, // path control mode + { "", "dist",_f0, 0, cm_print_dist, cm_get_dist, set_ro, (float *)&cs.null, 0 }, // distance mode + { "", "admo",_f0, 0, cm_print_admo, cm_get_admo, set_ro, (float *)&cs.null, 0 }, // arc distance mode + { "", "frmo",_f0, 0, cm_print_frmo, cm_get_frmo, set_ro, (float *)&cs.null, 0 }, // feed rate mode + { "", "tool",_f0, 0, cm_print_tool, cm_get_toolv,set_ro, (float *)&cs.null, 0 }, // active tool +// { "", "g92e",_f0, 0, cm_print_g92e, get_ui8, set_ro, (float *)&cm->gmx.origin_offset_enable, 0 }, // G92 enabled #ifdef TEMPORARY_HAS_LEDS { "", "_leds",_f0, 0, tx_print_nul, _get_leds,_set_leds,(float *)&cs.null, 0 }, // TEMPORARY - change LEDs #endif - { "mpo","mpox",_f0, 3, cm_print_mpo, cm_get_mpo, set_nul, (float *)&cs.null, 0 }, // X machine position - { "mpo","mpoy",_f0, 3, cm_print_mpo, cm_get_mpo, set_nul, (float *)&cs.null, 0 }, // Y machine position - { "mpo","mpoz",_f0, 3, cm_print_mpo, cm_get_mpo, set_nul, (float *)&cs.null, 0 }, // Z machine position - { "mpo","mpoa",_f0, 3, cm_print_mpo, cm_get_mpo, set_nul, (float *)&cs.null, 0 }, // A machine position - { "mpo","mpob",_f0, 3, cm_print_mpo, cm_get_mpo, set_nul, (float *)&cs.null, 0 }, // B machine position - { "mpo","mpoc",_f0, 3, cm_print_mpo, cm_get_mpo, set_nul, (float *)&cs.null, 0 }, // C machine position + { "mpo","mpox",_f0, 3, cm_print_mpo, cm_get_mpo, set_ro, (float *)&cs.null, 0 }, // X machine position + { "mpo","mpoy",_f0, 3, cm_print_mpo, cm_get_mpo, set_ro, (float *)&cs.null, 0 }, // Y machine position + { "mpo","mpoz",_f0, 3, cm_print_mpo, cm_get_mpo, set_ro, (float *)&cs.null, 0 }, // Z machine position + { "mpo","mpoa",_f0, 3, cm_print_mpo, cm_get_mpo, set_ro, (float *)&cs.null, 0 }, // A machine position + { "mpo","mpob",_f0, 3, cm_print_mpo, cm_get_mpo, set_ro, (float *)&cs.null, 0 }, // B machine position + { "mpo","mpoc",_f0, 3, cm_print_mpo, cm_get_mpo, set_ro, (float *)&cs.null, 0 }, // C machine position - { "pos","posx",_f0, 3, cm_print_pos, cm_get_pos, set_nul, (float *)&cs.null, 0 }, // X work position - { "pos","posy",_f0, 3, cm_print_pos, cm_get_pos, set_nul, (float *)&cs.null, 0 }, // Y work position - { "pos","posz",_f0, 3, cm_print_pos, cm_get_pos, set_nul, (float *)&cs.null, 0 }, // Z work position - { "pos","posa",_f0, 3, cm_print_pos, cm_get_pos, set_nul, (float *)&cs.null, 0 }, // A work position - { "pos","posb",_f0, 3, cm_print_pos, cm_get_pos, set_nul, (float *)&cs.null, 0 }, // B work position - { "pos","posc",_f0, 3, cm_print_pos, cm_get_pos, set_nul, (float *)&cs.null, 0 }, // C work position + { "pos","posx",_f0, 3, cm_print_pos, cm_get_pos, set_ro, (float *)&cs.null, 0 }, // X work position + { "pos","posy",_f0, 3, cm_print_pos, cm_get_pos, set_ro, (float *)&cs.null, 0 }, // Y work position + { "pos","posz",_f0, 3, cm_print_pos, cm_get_pos, set_ro, (float *)&cs.null, 0 }, // Z work position + { "pos","posa",_f0, 3, cm_print_pos, cm_get_pos, set_ro, (float *)&cs.null, 0 }, // A work position + { "pos","posb",_f0, 3, cm_print_pos, cm_get_pos, set_ro, (float *)&cs.null, 0 }, // B work position + { "pos","posc",_f0, 3, cm_print_pos, cm_get_pos, set_ro, (float *)&cs.null, 0 }, // C work position - { "ofs","ofsx",_f0, 3, cm_print_ofs, cm_get_ofs, set_nul, (float *)&cs.null, 0 }, // X work offset - { "ofs","ofsy",_f0, 3, cm_print_ofs, cm_get_ofs, set_nul, (float *)&cs.null, 0 }, // Y work offset - { "ofs","ofsz",_f0, 3, cm_print_ofs, cm_get_ofs, set_nul, (float *)&cs.null, 0 }, // Z work offset - { "ofs","ofsa",_f0, 3, cm_print_ofs, cm_get_ofs, set_nul, (float *)&cs.null, 0 }, // A work offset - { "ofs","ofsb",_f0, 3, cm_print_ofs, cm_get_ofs, set_nul, (float *)&cs.null, 0 }, // B work offset - { "ofs","ofsc",_f0, 3, cm_print_ofs, cm_get_ofs, set_nul, (float *)&cs.null, 0 }, // C work offset + { "ofs","ofsx",_f0, 3, cm_print_ofs, cm_get_ofs, set_ro, (float *)&cs.null, 0 }, // X work offset + { "ofs","ofsy",_f0, 3, cm_print_ofs, cm_get_ofs, set_ro, (float *)&cs.null, 0 }, // Y work offset + { "ofs","ofsz",_f0, 3, cm_print_ofs, cm_get_ofs, set_ro, (float *)&cs.null, 0 }, // Z work offset + { "ofs","ofsa",_f0, 3, cm_print_ofs, cm_get_ofs, set_ro, (float *)&cs.null, 0 }, // A work offset + { "ofs","ofsb",_f0, 3, cm_print_ofs, cm_get_ofs, set_ro, (float *)&cs.null, 0 }, // B work offset + { "ofs","ofsc",_f0, 3, cm_print_ofs, cm_get_ofs, set_ro, (float *)&cs.null, 0 }, // C work offset { "hom","home",_f0, 0, cm_print_home,cm_get_home,cm_set_home,(float *)&cs.null,0 }, // homing state, invoke homing cycle - { "hom","homx",_f0, 0, cm_print_hom, cm_get_hom, set_nul, (float *)&cs.null, 0 }, // X homed - Homing status group - { "hom","homy",_f0, 0, cm_print_hom, cm_get_hom, set_nul, (float *)&cs.null, 0 }, // Y homed - { "hom","homz",_f0, 0, cm_print_hom, cm_get_hom, set_nul, (float *)&cs.null, 0 }, // Z homed - { "hom","homa",_f0, 0, cm_print_hom, cm_get_hom, set_nul, (float *)&cs.null, 0 }, // A homed - { "hom","homb",_f0, 0, cm_print_hom, cm_get_hom, set_nul, (float *)&cs.null, 0 }, // B homed - { "hom","homc",_f0, 0, cm_print_hom, cm_get_hom, set_nul, (float *)&cs.null, 0 }, // C homed + { "hom","homx",_f0, 0, cm_print_hom, cm_get_hom, set_ro, (float *)&cs.null, 0 }, // X homed - Homing status group + { "hom","homy",_f0, 0, cm_print_hom, cm_get_hom, set_ro, (float *)&cs.null, 0 }, // Y homed + { "hom","homz",_f0, 0, cm_print_hom, cm_get_hom, set_ro, (float *)&cs.null, 0 }, // Z homed + { "hom","homa",_f0, 0, cm_print_hom, cm_get_hom, set_ro, (float *)&cs.null, 0 }, // A homed + { "hom","homb",_f0, 0, cm_print_hom, cm_get_hom, set_ro, (float *)&cs.null, 0 }, // B homed + { "hom","homc",_f0, 0, cm_print_hom, cm_get_hom, set_ro, (float *)&cs.null, 0 }, // C homed - { "prb","prbe",_f0, 0, tx_print_nul, cm_get_prob,set_nul, (float *)&cs.null, 0 }, // probing state - { "prb","prbx",_f0, 3, tx_print_nul, cm_get_prb, set_nul, (float *)&cs.null, 0 }, // X probe results - { "prb","prby",_f0, 3, tx_print_nul, cm_get_prb, set_nul, (float *)&cs.null, 0 }, // Y probe results - { "prb","prbz",_f0, 3, tx_print_nul, cm_get_prb, set_nul, (float *)&cs.null, 0 }, // Z probe results - { "prb","prba",_f0, 3, tx_print_nul, cm_get_prb, set_nul, (float *)&cs.null, 0 }, // A probe results - { "prb","prbb",_f0, 3, tx_print_nul, cm_get_prb, set_nul, (float *)&cs.null, 0 }, // B probe results - { "prb","prbc",_f0, 3, tx_print_nul, cm_get_prb, set_nul, (float *)&cs.null, 0 }, // C probe results + { "prb","prbe",_f0, 0, tx_print_nul, cm_get_prob,set_ro, (float *)&cs.null, 0 }, // probing state + { "prb","prbx",_f0, 3, tx_print_nul, cm_get_prb, set_ro, (float *)&cs.null, 0 }, // X probe results + { "prb","prby",_f0, 3, tx_print_nul, cm_get_prb, set_ro, (float *)&cs.null, 0 }, // Y probe results + { "prb","prbz",_f0, 3, tx_print_nul, cm_get_prb, set_ro, (float *)&cs.null, 0 }, // Z probe results + { "prb","prba",_f0, 3, tx_print_nul, cm_get_prb, set_ro, (float *)&cs.null, 0 }, // A probe results + { "prb","prbb",_f0, 3, tx_print_nul, cm_get_prb, set_ro, (float *)&cs.null, 0 }, // B probe results + { "prb","prbc",_f0, 3, tx_print_nul, cm_get_prb, set_ro, (float *)&cs.null, 0 }, // C probe results { "jog","jogx",_f0, 0, tx_print_nul, get_nul, cm_run_jog, (float *)&cs.null, 0}, // jog in X axis { "jog","jogy",_f0, 0, tx_print_nul, get_nul, cm_run_jog, (float *)&cs.null, 0}, // jog in Y axis @@ -180,19 +180,19 @@ const cfgItem_t cfgArray[] = { { "jog","jogb",_f0, 0, tx_print_nul, get_nul, cm_run_jog, (float *)&cs.null, 0}, // jog in B axis { "jog","jogc",_f0, 0, tx_print_nul, get_nul, cm_run_jog, (float *)&cs.null, 0}, // jog in C axis - { "pwr","pwr1",_f0, 3, st_print_pwr, st_get_pwr, set_ro, (float *)&cs.null, 0}, // motor power readouts - { "pwr","pwr2",_f0, 3, st_print_pwr, st_get_pwr, set_ro, (float *)&cs.null, 0}, + { "pwr","pwr1",_f0, 3, st_print_pwr, st_get_pwr, set_ro, (float *)&cs.null, 0}, // motor power readouts + { "pwr","pwr2",_f0, 3, st_print_pwr, st_get_pwr, set_ro, (float *)&cs.null, 0}, #if (MOTORS > 2) - { "pwr","pwr3",_f0, 3, st_print_pwr, st_get_pwr, set_ro, (float *)&cs.null, 0}, + { "pwr","pwr3",_f0, 3, st_print_pwr, st_get_pwr, set_ro, (float *)&cs.null, 0}, #endif #if (MOTORS > 3) - { "pwr","pwr4",_f0, 3, st_print_pwr, st_get_pwr, set_ro, (float *)&cs.null, 0}, + { "pwr","pwr4",_f0, 3, st_print_pwr, st_get_pwr, set_ro, (float *)&cs.null, 0}, #endif #if (MOTORS > 4) - { "pwr","pwr5",_f0, 3, st_print_pwr, st_get_pwr, set_ro, (float *)&cs.null, 0}, + { "pwr","pwr5",_f0, 3, st_print_pwr, st_get_pwr, set_ro, (float *)&cs.null, 0}, #endif #if (MOTORS > 5) - { "pwr","pwr6",_f0, 3, st_print_pwr, st_get_pwr, set_ro, (float *)&cs.null, 0}, + { "pwr","pwr6",_f0, 3, st_print_pwr, st_get_pwr, set_ro, (float *)&cs.null, 0}, #endif // Motor parameters @@ -408,25 +408,25 @@ const cfgItem_t cfgArray[] = { #endif // Digital input state readers - { "in","in1", _f0, 0, io_print_in, io_get_input, set_ro, (float *)&cs.null, 0 }, - { "in","in2", _f0, 0, io_print_in, io_get_input, set_ro, (float *)&cs.null, 0 }, - { "in","in3", _f0, 0, io_print_in, io_get_input, set_ro, (float *)&cs.null, 0 }, - { "in","in4", _f0, 0, io_print_in, io_get_input, set_ro, (float *)&cs.null, 0 }, - { "in","in5", _f0, 0, io_print_in, io_get_input, set_ro, (float *)&cs.null, 0 }, - { "in","in6", _f0, 0, io_print_in, io_get_input, set_ro, (float *)&cs.null, 0 }, - { "in","in7", _f0, 0, io_print_in, io_get_input, set_ro, (float *)&cs.null, 0 }, - { "in","in8", _f0, 0, io_print_in, io_get_input, set_ro, (float *)&cs.null, 0 }, + { "in","in1", _f0, 0, io_print_in, io_get_input, set_ro, (float *)&cs.null, 0 }, + { "in","in2", _f0, 0, io_print_in, io_get_input, set_ro, (float *)&cs.null, 0 }, + { "in","in3", _f0, 0, io_print_in, io_get_input, set_ro, (float *)&cs.null, 0 }, + { "in","in4", _f0, 0, io_print_in, io_get_input, set_ro, (float *)&cs.null, 0 }, + { "in","in5", _f0, 0, io_print_in, io_get_input, set_ro, (float *)&cs.null, 0 }, + { "in","in6", _f0, 0, io_print_in, io_get_input, set_ro, (float *)&cs.null, 0 }, + { "in","in7", _f0, 0, io_print_in, io_get_input, set_ro, (float *)&cs.null, 0 }, + { "in","in8", _f0, 0, io_print_in, io_get_input, set_ro, (float *)&cs.null, 0 }, #if (D_IN_CHANNELS >= 9) - { "in","in9", _f0, 0, io_print_in, io_get_input, set_ro, (float *)&cs.null, 0 }, + { "in","in9", _f0, 0, io_print_in, io_get_input, set_ro, (float *)&cs.null, 0 }, #endif #if (D_IN_CHANNELS >= 10) - { "in","in10", _f0, 0, io_print_in, io_get_input, set_ro, (float *)&cs.null, 0 }, + { "in","in10", _f0, 0, io_print_in, io_get_input, set_ro, (float *)&cs.null, 0 }, #endif #if (D_IN_CHANNELS >= 11) - { "in","in11", _f0, 0, io_print_in, io_get_input, set_ro, (float *)&cs.null, 0 }, + { "in","in11", _f0, 0, io_print_in, io_get_input, set_ro, (float *)&cs.null, 0 }, #endif #if (D_IN_CHANNELS >= 12) - { "in","in12", _f0, 0, io_print_in, io_get_input, set_ro, (float *)&cs.null, 0 }, + { "in","in12", _f0, 0, io_print_in, io_get_input, set_ro, (float *)&cs.null, 0 }, #endif // digital output configs @@ -574,27 +574,27 @@ const cfgItem_t cfgArray[] = { { "g59","g59b",_fip, 3, cm_print_cofs, cm_get_coord, cm_set_coord, (float *)&cs.null, G59_B_OFFSET }, { "g59","g59c",_fip, 3, cm_print_cofs, cm_get_coord, cm_set_coord, (float *)&cs.null, G59_C_OFFSET }, - { "g92","g92x",_fic, 3, cm_print_cofs, cm_get_g92, set_nul, (float *)&cs.null, 0 },// G92 handled differently - { "g92","g92y",_fic, 3, cm_print_cofs, cm_get_g92, set_nul, (float *)&cs.null, 0 }, - { "g92","g92z",_fic, 3, cm_print_cofs, cm_get_g92, set_nul, (float *)&cs.null, 0 }, - { "g92","g92a",_fi, 3, cm_print_cofs, cm_get_g92, set_nul, (float *)&cs.null, 0 }, - { "g92","g92b",_fi, 3, cm_print_cofs, cm_get_g92, set_nul, (float *)&cs.null, 0 }, - { "g92","g92c",_fi, 3, cm_print_cofs, cm_get_g92, set_nul, (float *)&cs.null, 0 }, + { "g92","g92x",_fic, 3, cm_print_cofs, cm_get_g92, set_ro, (float *)&cs.null, 0 },// G92 handled differently + { "g92","g92y",_fic, 3, cm_print_cofs, cm_get_g92, set_ro, (float *)&cs.null, 0 }, + { "g92","g92z",_fic, 3, cm_print_cofs, cm_get_g92, set_ro, (float *)&cs.null, 0 }, + { "g92","g92a",_fi, 3, cm_print_cofs, cm_get_g92, set_ro, (float *)&cs.null, 0 }, + { "g92","g92b",_fi, 3, cm_print_cofs, cm_get_g92, set_ro, (float *)&cs.null, 0 }, + { "g92","g92c",_fi, 3, cm_print_cofs, cm_get_g92, set_ro, (float *)&cs.null, 0 }, // Coordinate positions (G28, G30) - { "g28","g28x",_fic, 3, cm_print_cpos, cm_get_g28, set_nul, (float *)&cs.null, 0 },// g28 handled differently - { "g28","g28y",_fic, 3, cm_print_cpos, cm_get_g28, set_nul, (float *)&cs.null, 0 }, - { "g28","g28z",_fic, 3, cm_print_cpos, cm_get_g28, set_nul, (float *)&cs.null, 0 }, - { "g28","g28a",_fi, 3, cm_print_cpos, cm_get_g28, set_nul, (float *)&cs.null, 0 }, - { "g28","g28b",_fi, 3, cm_print_cpos, cm_get_g28, set_nul, (float *)&cs.null, 0 }, - { "g28","g28c",_fi, 3, cm_print_cpos, cm_get_g28, set_nul, (float *)&cs.null, 0 }, + { "g28","g28x",_fic, 3, cm_print_cpos, cm_get_g28, set_ro, (float *)&cs.null, 0 },// g28 handled differently + { "g28","g28y",_fic, 3, cm_print_cpos, cm_get_g28, set_ro, (float *)&cs.null, 0 }, + { "g28","g28z",_fic, 3, cm_print_cpos, cm_get_g28, set_ro, (float *)&cs.null, 0 }, + { "g28","g28a",_fi, 3, cm_print_cpos, cm_get_g28, set_ro, (float *)&cs.null, 0 }, + { "g28","g28b",_fi, 3, cm_print_cpos, cm_get_g28, set_ro, (float *)&cs.null, 0 }, + { "g28","g28c",_fi, 3, cm_print_cpos, cm_get_g28, set_ro, (float *)&cs.null, 0 }, - { "g30","g30x",_fic, 3, cm_print_cpos, cm_get_g30, set_nul, (float *)&cs.null, 0 },// g30 handled differently - { "g30","g30y",_fic, 3, cm_print_cpos, cm_get_g30, set_nul, (float *)&cs.null, 0 }, - { "g30","g30z",_fic, 3, cm_print_cpos, cm_get_g30, set_nul, (float *)&cs.null, 0 }, - { "g30","g30a",_fi, 3, cm_print_cpos, cm_get_g30, set_nul, (float *)&cs.null, 0 }, - { "g30","g30b",_fi, 3, cm_print_cpos, cm_get_g30, set_nul, (float *)&cs.null, 0 }, - { "g30","g30c",_fi, 3, cm_print_cpos, cm_get_g30, set_nul, (float *)&cs.null, 0 }, + { "g30","g30x",_fic, 3, cm_print_cpos, cm_get_g30, set_ro, (float *)&cs.null, 0 },// g30 handled differently + { "g30","g30y",_fic, 3, cm_print_cpos, cm_get_g30, set_ro, (float *)&cs.null, 0 }, + { "g30","g30z",_fic, 3, cm_print_cpos, cm_get_g30, set_ro, (float *)&cs.null, 0 }, + { "g30","g30a",_fi, 3, cm_print_cpos, cm_get_g30, set_ro, (float *)&cs.null, 0 }, + { "g30","g30b",_fi, 3, cm_print_cpos, cm_get_g30, set_ro, (float *)&cs.null, 0 }, + { "g30","g30c",_fi, 3, cm_print_cpos, cm_get_g30, set_ro, (float *)&cs.null, 0 }, /* // Default values for current tool length offsets (not configurable, set to zero) @@ -956,67 +956,67 @@ const cfgItem_t cfgArray[] = { { "", "clc",_f0, 0, tx_print_nul, st_clc, st_clc, (float *)&cs.null, 0 }, // clear diagnostic step counters // { "", "_dam",_f0, 0, tx_print_nul, cm_dam, cm_dam, (float *)&cs.null, 0 }, // dump active model - { "_te","_tex",_f0, 2, tx_print_flt, get_flt, set_nul,(float *)&mr.target[AXIS_X], 0 }, // X target endpoint - { "_te","_tey",_f0, 2, tx_print_flt, get_flt, set_nul,(float *)&mr.target[AXIS_Y], 0 }, - { "_te","_tez",_f0, 2, tx_print_flt, get_flt, set_nul,(float *)&mr.target[AXIS_Z], 0 }, - { "_te","_tea",_f0, 2, tx_print_flt, get_flt, set_nul,(float *)&mr.target[AXIS_A], 0 }, - { "_te","_teb",_f0, 2, tx_print_flt, get_flt, set_nul,(float *)&mr.target[AXIS_B], 0 }, - { "_te","_tec",_f0, 2, tx_print_flt, get_flt, set_nul,(float *)&mr.target[AXIS_C], 0 }, + { "_te","_tex",_f0, 2, tx_print_flt, get_flt, set_ro, (float *)&mr.target[AXIS_X], 0 }, // X target endpoint + { "_te","_tey",_f0, 2, tx_print_flt, get_flt, set_ro, (float *)&mr.target[AXIS_Y], 0 }, + { "_te","_tez",_f0, 2, tx_print_flt, get_flt, set_ro, (float *)&mr.target[AXIS_Z], 0 }, + { "_te","_tea",_f0, 2, tx_print_flt, get_flt, set_ro, (float *)&mr.target[AXIS_A], 0 }, + { "_te","_teb",_f0, 2, tx_print_flt, get_flt, set_ro, (float *)&mr.target[AXIS_B], 0 }, + { "_te","_tec",_f0, 2, tx_print_flt, get_flt, set_ro, (float *)&mr.target[AXIS_C], 0 }, - { "_tr","_trx",_f0, 2, tx_print_flt, get_flt, set_nul,(float *)&mr.gm.target[AXIS_X], 0 }, // X target runtime - { "_tr","_try",_f0, 2, tx_print_flt, get_flt, set_nul,(float *)&mr.gm.target[AXIS_Y], 0 }, - { "_tr","_trz",_f0, 2, tx_print_flt, get_flt, set_nul,(float *)&mr.gm.target[AXIS_Z], 0 }, - { "_tr","_tra",_f0, 2, tx_print_flt, get_flt, set_nul,(float *)&mr.gm.target[AXIS_A], 0 }, - { "_tr","_trb",_f0, 2, tx_print_flt, get_flt, set_nul,(float *)&mr.gm.target[AXIS_B], 0 }, - { "_tr","_trc",_f0, 2, tx_print_flt, get_flt, set_nul,(float *)&mr.gm.target[AXIS_C], 0 }, + { "_tr","_trx",_f0, 2, tx_print_flt, get_flt, set_ro, (float *)&mr.gm.target[AXIS_X], 0 }, // X target runtime + { "_tr","_try",_f0, 2, tx_print_flt, get_flt, set_ro, (float *)&mr.gm.target[AXIS_Y], 0 }, + { "_tr","_trz",_f0, 2, tx_print_flt, get_flt, set_ro, (float *)&mr.gm.target[AXIS_Z], 0 }, + { "_tr","_tra",_f0, 2, tx_print_flt, get_flt, set_ro, (float *)&mr.gm.target[AXIS_A], 0 }, + { "_tr","_trb",_f0, 2, tx_print_flt, get_flt, set_ro, (float *)&mr.gm.target[AXIS_B], 0 }, + { "_tr","_trc",_f0, 2, tx_print_flt, get_flt, set_ro, (float *)&mr.gm.target[AXIS_C], 0 }, #if (MOTORS >= 1) - { "_ts","_ts1",_f0, 2, tx_print_flt, get_flt, set_nul,(float *)&mr.target_steps[MOTOR_1], 0 }, // Motor 1 target steps - { "_ps","_ps1",_f0, 2, tx_print_flt, get_flt, set_nul,(float *)&mr.position_steps[MOTOR_1], 0 }, // Motor 1 position steps - { "_cs","_cs1",_f0, 2, tx_print_flt, get_flt, set_nul,(float *)&mr.commanded_steps[MOTOR_1], 0 }, // Motor 1 commanded steps (delayed steps) - { "_es","_es1",_f0, 2, tx_print_flt, get_flt, set_nul,(float *)&mr.encoder_steps[MOTOR_1], 0 }, // Motor 1 encoder steps - { "_xs","_xs1",_f0, 2, tx_print_flt, get_flt, set_nul,(float *)&st_pre.mot[MOTOR_1].corrected_steps, 0 }, // Motor 1 correction steps applied - { "_fe","_fe1",_f0, 2, tx_print_flt, get_flt, set_nul,(float *)&mr.following_error[MOTOR_1], 0 }, // Motor 1 following error in steps + { "_ts","_ts1",_f0, 2, tx_print_flt, get_flt, set_ro, (float *)&mr.target_steps[MOTOR_1], 0 }, // Motor 1 target steps + { "_ps","_ps1",_f0, 2, tx_print_flt, get_flt, set_ro, (float *)&mr.position_steps[MOTOR_1], 0 }, // Motor 1 position steps + { "_cs","_cs1",_f0, 2, tx_print_flt, get_flt, set_ro, (float *)&mr.commanded_steps[MOTOR_1], 0 }, // Motor 1 commanded steps (delayed steps) + { "_es","_es1",_f0, 2, tx_print_flt, get_flt, set_ro, (float *)&mr.encoder_steps[MOTOR_1], 0 }, // Motor 1 encoder steps + { "_xs","_xs1",_f0, 2, tx_print_flt, get_flt, set_ro, (float *)&st_pre.mot[MOTOR_1].corrected_steps, 0 }, // Motor 1 correction steps applied + { "_fe","_fe1",_f0, 2, tx_print_flt, get_flt, set_ro, (float *)&mr.following_error[MOTOR_1], 0 }, // Motor 1 following error in steps #endif #if (MOTORS >= 2) - { "_ts","_ts2",_f0, 2, tx_print_flt, get_flt, set_nul,(float *)&mr.target_steps[MOTOR_2], 0 }, - { "_ps","_ps2",_f0, 2, tx_print_flt, get_flt, set_nul,(float *)&mr.position_steps[MOTOR_2], 0 }, - { "_cs","_cs2",_f0, 2, tx_print_flt, get_flt, set_nul,(float *)&mr.commanded_steps[MOTOR_2], 0 }, - { "_es","_es2",_f0, 2, tx_print_flt, get_flt, set_nul,(float *)&mr.encoder_steps[MOTOR_2], 0 }, - { "_xs","_xs2",_f0, 2, tx_print_flt, get_flt, set_nul,(float *)&st_pre.mot[MOTOR_2].corrected_steps, 0 }, - { "_fe","_fe2",_f0, 2, tx_print_flt, get_flt, set_nul,(float *)&mr.following_error[MOTOR_2], 0 }, + { "_ts","_ts2",_f0, 2, tx_print_flt, get_flt, set_ro, (float *)&mr.target_steps[MOTOR_2], 0 }, + { "_ps","_ps2",_f0, 2, tx_print_flt, get_flt, set_ro, (float *)&mr.position_steps[MOTOR_2], 0 }, + { "_cs","_cs2",_f0, 2, tx_print_flt, get_flt, set_ro, (float *)&mr.commanded_steps[MOTOR_2], 0 }, + { "_es","_es2",_f0, 2, tx_print_flt, get_flt, set_ro, (float *)&mr.encoder_steps[MOTOR_2], 0 }, + { "_xs","_xs2",_f0, 2, tx_print_flt, get_flt, set_ro, (float *)&st_pre.mot[MOTOR_2].corrected_steps, 0 }, + { "_fe","_fe2",_f0, 2, tx_print_flt, get_flt, set_ro, (float *)&mr.following_error[MOTOR_2], 0 }, #endif #if (MOTORS >= 3) - { "_ts","_ts3",_f0, 2, tx_print_flt, get_flt, set_nul,(float *)&mr.target_steps[MOTOR_3], 0 }, - { "_ps","_ps3",_f0, 2, tx_print_flt, get_flt, set_nul,(float *)&mr.position_steps[MOTOR_3], 0 }, - { "_cs","_cs3",_f0, 2, tx_print_flt, get_flt, set_nul,(float *)&mr.commanded_steps[MOTOR_3], 0 }, - { "_es","_es3",_f0, 2, tx_print_flt, get_flt, set_nul,(float *)&mr.encoder_steps[MOTOR_3], 0 }, - { "_xs","_xs3",_f0, 2, tx_print_flt, get_flt, set_nul,(float *)&st_pre.mot[MOTOR_3].corrected_steps, 0 }, - { "_fe","_fe3",_f0, 2, tx_print_flt, get_flt, set_nul,(float *)&mr.following_error[MOTOR_3], 0 }, + { "_ts","_ts3",_f0, 2, tx_print_flt, get_flt, set_ro, (float *)&mr.target_steps[MOTOR_3], 0 }, + { "_ps","_ps3",_f0, 2, tx_print_flt, get_flt, set_ro, (float *)&mr.position_steps[MOTOR_3], 0 }, + { "_cs","_cs3",_f0, 2, tx_print_flt, get_flt, set_ro, (float *)&mr.commanded_steps[MOTOR_3], 0 }, + { "_es","_es3",_f0, 2, tx_print_flt, get_flt, set_ro, (float *)&mr.encoder_steps[MOTOR_3], 0 }, + { "_xs","_xs3",_f0, 2, tx_print_flt, get_flt, set_ro, (float *)&st_pre.mot[MOTOR_3].corrected_steps, 0 }, + { "_fe","_fe3",_f0, 2, tx_print_flt, get_flt, set_ro, (float *)&mr.following_error[MOTOR_3], 0 }, #endif #if (MOTORS >= 4) - { "_ts","_ts4",_f0, 2, tx_print_flt, get_flt, set_nul,(float *)&mr.target_steps[MOTOR_4], 0 }, - { "_ps","_ps4",_f0, 2, tx_print_flt, get_flt, set_nul,(float *)&mr.position_steps[MOTOR_4], 0 }, - { "_cs","_cs4",_f0, 2, tx_print_flt, get_flt, set_nul,(float *)&mr.commanded_steps[MOTOR_4], 0 }, - { "_es","_es4",_f0, 2, tx_print_flt, get_flt, set_nul,(float *)&mr.encoder_steps[MOTOR_4], 0 }, - { "_xs","_xs4",_f0, 2, tx_print_flt, get_flt, set_nul,(float *)&st_pre.mot[MOTOR_4].corrected_steps, 0 }, - { "_fe","_fe4",_f0, 2, tx_print_flt, get_flt, set_nul,(float *)&mr.following_error[MOTOR_4], 0 }, + { "_ts","_ts4",_f0, 2, tx_print_flt, get_flt, set_ro, (float *)&mr.target_steps[MOTOR_4], 0 }, + { "_ps","_ps4",_f0, 2, tx_print_flt, get_flt, set_ro, (float *)&mr.position_steps[MOTOR_4], 0 }, + { "_cs","_cs4",_f0, 2, tx_print_flt, get_flt, set_ro, (float *)&mr.commanded_steps[MOTOR_4], 0 }, + { "_es","_es4",_f0, 2, tx_print_flt, get_flt, set_ro, (float *)&mr.encoder_steps[MOTOR_4], 0 }, + { "_xs","_xs4",_f0, 2, tx_print_flt, get_flt, set_ro, (float *)&st_pre.mot[MOTOR_4].corrected_steps, 0 }, + { "_fe","_fe4",_f0, 2, tx_print_flt, get_flt, set_ro, (float *)&mr.following_error[MOTOR_4], 0 }, #endif #if (MOTORS >= 5) - { "_ts","_ts5",_f0, 2, tx_print_flt, get_flt, set_nul,(float *)&mr.target_steps[MOTOR_5], 0 }, - { "_ps","_ps5",_f0, 2, tx_print_flt, get_flt, set_nul,(float *)&mr.position_steps[MOTOR_5], 0 }, - { "_cs","_cs5",_f0, 2, tx_print_flt, get_flt, set_nul,(float *)&mr.commanded_steps[MOTOR_5], 0 }, - { "_es","_es5",_f0, 2, tx_print_flt, get_flt, set_nul,(float *)&mr.encoder_steps[MOTOR_5], 0 }, - { "_xs","_xs6",_f0, 2, tx_print_flt, get_flt, set_nul,(float *)&st_pre.mot[MOTOR_5].corrected_steps, 0 }, - { "_fe","_fe5",_f0, 2, tx_print_flt, get_flt, set_nul,(float *)&mr.following_error[MOTOR_5], 0 }, + { "_ts","_ts5",_f0, 2, tx_print_flt, get_flt, set_ro, (float *)&mr.target_steps[MOTOR_5], 0 }, + { "_ps","_ps5",_f0, 2, tx_print_flt, get_flt, set_ro, (float *)&mr.position_steps[MOTOR_5], 0 }, + { "_cs","_cs5",_f0, 2, tx_print_flt, get_flt, set_ro, (float *)&mr.commanded_steps[MOTOR_5], 0 }, + { "_es","_es5",_f0, 2, tx_print_flt, get_flt, set_ro, (float *)&mr.encoder_steps[MOTOR_5], 0 }, + { "_xs","_xs6",_f0, 2, tx_print_flt, get_flt, set_ro, (float *)&st_pre.mot[MOTOR_5].corrected_steps, 0 }, + { "_fe","_fe5",_f0, 2, tx_print_flt, get_flt, set_ro, (float *)&mr.following_error[MOTOR_5], 0 }, #endif #if (MOTORS >= 6) - { "_ts","_ts6",_f0, 2, tx_print_flt, get_flt, set_nul,(float *)&mr.target_steps[MOTOR_6], 0 }, - { "_ps","_ps6",_f0, 2, tx_print_flt, get_flt, set_nul,(float *)&mr.position_steps[MOTOR_6], 0 }, - { "_cs","_cs6",_f0, 2, tx_print_flt, get_flt, set_nul,(float *)&mr.commanded_steps[MOTOR_6], 0 }, - { "_es","_es6",_f0, 2, tx_print_flt, get_flt, set_nul,(float *)&mr.encoder_steps[MOTOR_6], 0 }, - { "_xs","_xs5",_f0, 2, tx_print_flt, get_flt, set_nul,(float *)&st_pre.mot[MOTOR_6].corrected_steps, 0 }, - { "_fe","_fe6",_f0, 2, tx_print_flt, get_flt, set_nul,(float *)&mr.following_error[MOTOR_6], 0 }, + { "_ts","_ts6",_f0, 2, tx_print_flt, get_flt, set_ro, (float *)&mr.target_steps[MOTOR_6], 0 }, + { "_ps","_ps6",_f0, 2, tx_print_flt, get_flt, set_ro, (float *)&mr.position_steps[MOTOR_6], 0 }, + { "_cs","_cs6",_f0, 2, tx_print_flt, get_flt, set_ro, (float *)&mr.commanded_steps[MOTOR_6], 0 }, + { "_es","_es6",_f0, 2, tx_print_flt, get_flt, set_ro, (float *)&mr.encoder_steps[MOTOR_6], 0 }, + { "_xs","_xs5",_f0, 2, tx_print_flt, get_flt, set_ro, (float *)&st_pre.mot[MOTOR_6].corrected_steps, 0 }, + { "_fe","_fe6",_f0, 2, tx_print_flt, get_flt, set_ro, (float *)&mr.following_error[MOTOR_6], 0 }, #endif #endif // __DIAGNOSTIC_PARAMETERS @@ -1062,7 +1062,7 @@ const cfgItem_t cfgArray[] = { { "","se37",_fp, 0, tx_print_nul, get_int32, set_int32,(float *)&sr.status_report_list[37],0 }, { "","se38",_fp, 0, tx_print_nul, get_int32, set_int32,(float *)&sr.status_report_list[38],0 }, { "","se39",_fp, 0, tx_print_nul, get_int32, set_int32,(float *)&sr.status_report_list[39],0 }, - // Count is 40, since se00 counts as one. +// Count is 40, since se00 counts as one. // Group lookups - must follow the single-valued entries for proper sub-string matching // *** Must agree with NV_COUNT_GROUPS below *** @@ -1262,81 +1262,58 @@ stat_t set_flu(nvObj_t *nv) return(STAT_OK); } -stat_t set_flup(nvObj_t *nv) -{ - if (nv->value < 0) { - nv->valuetype = TYPE_NULL; - return (STAT_INPUT_LESS_THAN_MIN_VALUE); - } - return (set_flu(nv)); -} - -stat_t set_fltp(nvObj_t *nv) -{ - if (nv->value < 0) { - nv->valuetype = TYPE_NULL; - return (STAT_INPUT_LESS_THAN_MIN_VALUE); - } - return (set_flt(nv)); -} - /* - * process_incoming_float() - pre-process an incoming floating point number for canonical units - * process_outgoing_float() - pre-process an outgoing floating point number for units display + * convert_incoming_float() - pre-process an incoming floating point number for canonical units + * convert_outgoing_float() - pre-process an outgoing floating point number for units display * - * Incoming floats are destined for SET operations.perform conditional unit conversion if - * the flags indicate. Note that SU (inverse conversion) is not converted here, but in the - * set_su function. - * + * Incoming floats are destined for SET operations. * Outgoing floats are the raw values from GET operations, destined for text or JSON display. - * These are conditionally unit converted, including SU. + * + * Apologies in advance for these twisty little functions. These functions are used to + * convert incoming floats into the native, canonical form of a parameter (mm, or whatever) + * and outgoing floats into a display format appropriate to the units mode in effect. + * They use the flags in the config table and other cues to determine what type of conversion + * to perform. + * + * The conversions are complicated by the fact that only linear axes actually convert - + * rotaries do not - unless they are in radius mode. Plus, determining the axis for a motor + * requires unraveling the motor mapping (handled in cm_get_axis_type()). Also, there are + * global SYS group values that are not associated with any axis. Lastly, the + * steps-per-unit value (1su) is actually kept in inverse conversion form, as its native + * form would be units-per-step. */ -void process_incoming_float(nvObj_t *nv) -{ - if (nv->valuetype != TYPE_FLOAT) { return; } // can be called non-destructively for any value type - - uint8_t flags = GET_TABLE_BYTE(flags); - if (flags & F_CONVERT) { // is unit conversion required? - if (cm_get_units_mode(MODEL) == INCHES) { // if in inches mode - if (cm_get_axis_type(nv->index) == AXIS_TYPE_LINEAR) { // ...and a linear axis... - nv->value *= MM_PER_INCH; // convert to canonical millimeter units - } - } - } -} - -void process_outgoing_float(nvObj_t *nv) +static void _convert(nvObj_t *nv, float conversion_factor) { if (nv->valuetype != TYPE_FLOAT) { return; } // can be called non-destructively for any value type if (isnan((double)nv->value) || isinf((double)nv->value)) { return; } // trap illegal float values ///+++ transform these checks into NaN or INF strings with an error return? - // We may need one of two types of units conversion, but only if in inches mode if (cm_get_units_mode(MODEL) == INCHES) { - uint8_t flags = GET_TABLE_BYTE(flags); - if (flags & F_CONVERT) { // standard units conversion - if (cm_get_axis_type(nv->index) == AXIS_TYPE_LINEAR) { - nv->value *= INCHES_PER_MM; + cmAxisType axis_type = cm_get_axis_type(nv->index); // linear, rotary, global or error + if ((axis_type == AXIS_TYPE_LINEAR) || (axis_type == AXIS_TYPE_SYSTEM)) { + if (cfgArray[nv->index].flags & F_CONVERT) { // standard units conversion + nv->value *= conversion_factor; + } else + if (cfgArray[nv->index].flags & F_ICONVERT) { // inverse units conversion + nv->value /= conversion_factor; } - } else if (flags & F_ICONVERT) { // inverse units conversion -// if (st_get_axis_type_by_motor(nv->index) == AXIS_TYPE_LINEAR) { // axis motor is mapped to - if (cm_get_axis_type(nv->index) == AXIS_TYPE_LINEAR) { // axis motor is mapped to - nv->value *= MM_PER_INCH; - } - } - } + } + } nv->precision = GET_TABLE_WORD(precision); nv->valuetype = TYPE_FLOAT; } +void convert_incoming_float(nvObj_t *nv) { return(_convert (nv, MM_PER_INCH)); } +void convert_outgoing_float(nvObj_t *nv) { return(_convert (nv, INCHES_PER_MM)); } + /* * get_float() - boilerplate for retrieving raw floating point value * set_float() - boilerplate for setting a floating point value with unit conversion * set_float_range() - set a floating point value with inclusive range check * * get_float() returns a raw float value in internal canonical units (e.g. mm, degrees) - * without units conversion. If conversion is required call preprocess_outgoing_float() + * without units conversion. If conversion is required call convert_outgoing_float() * afterwards. The text mode and JSON display routines do this, so you generally don't * have to worry about this. * @@ -1352,7 +1329,7 @@ stat_t get_float(nvObj_t *nv, const float value) { } stat_t set_float(nvObj_t *nv, float &value) { - process_incoming_float(nv); + convert_incoming_float(nv); value = nv->value; return (STAT_OK); } @@ -1361,7 +1338,7 @@ stat_t set_float_range(nvObj_t *nv, float &value, float low, float high) { char msg[64]; - process_incoming_float(nv); // conditional unit conversion + convert_incoming_float(nv); // conditional unit conversion if (nv->value < low) { sprintf(msg, "Input is less than minimum value %0.4f", low); nv_add_conditional_message(msg); diff --git a/g2core/gcode.h b/g2core/gcode.h index 50c8b33b..94917883 100644 --- a/g2core/gcode.h +++ b/g2core/gcode.h @@ -2,7 +2,7 @@ * gcode.h - rs274/ngc Gcode model and parser support * This file is part of the g2core project * - * Copyright (c) 2010 - 2016 Alden S. Hart, Jr. + * Copyright (c) 2010 - 2017 Alden S. Hart, Jr. * * 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 @@ -157,7 +157,7 @@ typedef enum { // used for spindle and arc dir DIRECTION_CCW } cmDirection; -typedef enum { // axis types +typedef enum { // axis types. Enum must be in this order AXIS_TYPE_SYSTEM=-2, // no axis, system parameter AXIS_TYPE_UNDEFINED=-1, // invalid type AXIS_TYPE_LINEAR, // linear axis @@ -276,12 +276,7 @@ typedef struct GCodeStateExtended { // Gcode dynamic state extensions - used bool origin_offset_enable; // G92 offsets enabled/disabled. 0=disabled, 1=enabled bool block_delete_switch; // set true to enable block deletes (true is default) -// unimplemented gcode parameters -// float cutter_radius; // D - cutter radius compensation (0 is off) -// float cutter_length; // H - cutter length compensation (0 is off) - uint16_t magic_end; - } GCodeStateX_t; @@ -327,11 +322,6 @@ typedef struct GCodeInput { // Gcode model inputs - meaning depends float spindle_speed; // in RPM float spindle_override_factor; // 1.0000 x S spindle speed. Go up or down from there uint8_t spindle_override_enable; // TRUE = override enabled - - // unimplemented gcode parameters - // float cutter_radius; // D - cutter radius compensation (0 is off) - // float cutter_length; // H - cutter length compensation (0 is off) - } GCodeInput_t; typedef struct GCodeFlags { // Gcode model input flags diff --git a/g2core/json_parser.cpp b/g2core/json_parser.cpp index d02096b0..cfd04bc5 100644 --- a/g2core/json_parser.cpp +++ b/g2core/json_parser.cpp @@ -2,8 +2,8 @@ * json_parser.cpp - JSON parser * This file is part of the g2core project * - * Copyright (c) 2011 - 2016 Alden S. Hart, Jr. - * Copyright (c) 2016 Rob Giseburt + * Copyright (c) 2011 - 2017 Alden S. Hart, Jr. + * Copyright (c) 2016 - 2017 Rob Giseburt * * 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 @@ -420,7 +420,7 @@ uint16_t json_serialize(nvObj_t *nv, char *out_buf, uint16_t size) need_a_comma = false; break; } - case (TYPE_FLOAT): { process_outgoing_float(nv); + case (TYPE_FLOAT): { convert_outgoing_float(nv); str += floattoa(str, nv->value, nv->precision); break; } diff --git a/g2core/text_parser.cpp b/g2core/text_parser.cpp index c8abcd85..2757f0fa 100644 --- a/g2core/text_parser.cpp +++ b/g2core/text_parser.cpp @@ -2,7 +2,7 @@ * text_parser.cpp - text parser * This file is part of the g2core project * - * Copyright (c) 2010 - 2016 Alden S. Hart, Jr. + * Copyright (c) 2010 - 2017 Alden S. Hart, Jr. * * 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 @@ -196,7 +196,7 @@ void text_print_multiline_formatted(nvObj_t *nv) { for (uint8_t i=0; ivaluetype != TYPE_PARENT) { - process_outgoing_float(nv); + convert_outgoing_float(nv); nv_print(nv); } if ((nv = nv->nx) == NULL) return;