From 58b4525afc072cb84e0f9ccc0981628ae1794ca3 Mon Sep 17 00:00:00 2001 From: "alden.hart" Date: Sat, 25 Feb 2017 15:06:10 -0500 Subject: [PATCH] Othermill settings; comments --- g2core/cycle_homing.cpp | 115 +++++---- g2core/g2core.cppproj | 4 +- g2core/plan_exec.cpp | 23 +- g2core/settings/settings_othermill.h | 281 ++++++++++++++-------- g2core/settings/settings_othermill_test.h | 15 +- 5 files changed, 279 insertions(+), 159 deletions(-) diff --git a/g2core/cycle_homing.cpp b/g2core/cycle_homing.cpp index b0521b32..cff82b80 100644 --- a/g2core/cycle_homing.cpp +++ b/g2core/cycle_homing.cpp @@ -86,24 +86,15 @@ static stat_t _homing_axis_move(int8_t axis, float target, float velocity); static stat_t _homing_error_exit(int8_t axis, stat_t status); static stat_t _homing_finalize_exit(int8_t axis); static int8_t _get_next_axis(int8_t axis); -static void _homing_axis_move_callback(float* vect, bool* flag); -/**** HELPERS *************************************************************************** - * _set_homing_func() - a convenience for setting the next dispatch vector and exiting - */ - -static stat_t _set_homing_func(stat_t (*func)(int8_t axis)) { - hm.func = func; - return (STAT_EAGAIN); -} /*********************************************************************************** **** G28.2 Homing Cycle *********************************************************** ***********************************************************************************/ /***************************************************************************** - * cm_homing_cycle_start() - G28.2 homing cycle using limit switches - * cm_homing_cycle_callback() - main loop callback for running the homing cycle + * cm_homing_cycle_start() - G28.2 homing cycle using limit switches + * cm_homing_cycle_start_no_set() - G28.4 Homing cycle - do not set values * * --- How does this work? --- * @@ -186,10 +177,14 @@ stat_t cm_homing_cycle_start(const float axes[], const bool flags[]) { stat_t cm_homing_cycle_start_no_set(const float axes[], const bool flags[]) { cm_homing_cycle_start(axes, flags); - hm.set_coordinates = false; // set flag to not update position variables at the end of the cycle + hm.set_coordinates = false; // set flag to not update position variables at the end of the cycle return (STAT_OK); } +/*********************************************************************************** + * cm_homing_cycle_callback() - main loop callback for running the homing cycle + */ + stat_t cm_homing_cycle_callback(void) { if (cm->cycle_state != CYCLE_HOMING) { // exit if not in a homing cycle return (STAT_NOOP); @@ -200,18 +195,21 @@ stat_t cm_homing_cycle_callback(void) { return (hm.func(hm.axis)); // execute the current homing move } -/* - * Homing axis moves - these execute in sequence for each axis - * - * _homing_axis_start() - get next axis, initialize variables, call the clear - * _homing_axis_clear_init() - initiate a clear to move off a switch that is thrown at the start - * _homing_axis_search() - fast search for switch, closes switch - * _homing_axis_clear() - clear off the switch - * _homing_axis_latch() - slow drive until until switch closes again - * _homing_axis_final() - backoff from latch location to zero position - * _homing_axis_move() - helper that actually executes the above moves - */ +/*********************************************************************************** + * Homing axis moves and helpers - these execute in sequence for each axis + ***********************************************************************************/ +/* + * _set_homing_func() - a convenience for setting the next dispatch vector and exiting + */ +static stat_t _set_homing_func(stat_t (*func)(int8_t axis)) { + hm.func = func; + return (STAT_EAGAIN); +} + +/*********************************************************************************** + * _homing_axis_start() - get next axis, initialize variables, call the clear + */ static stat_t _homing_axis_start(int8_t axis) { // get the first or next axis @@ -247,36 +245,40 @@ static stat_t _homing_axis_start(int8_t axis) { // However, here's a good place to stash the homing_switch: hm.homing_input = cm->a[axis].homing_input; gpio_set_homing_mode(hm.homing_input, true); - hm.axis = axis; // persist the axis - hm.search_velocity = fabs(cm->a[axis].search_velocity); // search velocity is always positive - hm.latch_velocity = fabs(cm->a[axis].latch_velocity); // latch velocity is always positive + hm.axis = axis; // persist the axis + hm.search_velocity = fabs(cm->a[axis].search_velocity); // search velocity is always positive + hm.latch_velocity = fabs(cm->a[axis].latch_velocity); // latch velocity is always positive bool homing_to_max = cm->a[axis].homing_dir; // setup parameters for positive or negative travel (homing to the max or min switch) if (homing_to_max) { - hm.search_travel = travel_distance; // search travels in positive direction - hm.latch_backoff = fabs(cm->a[axis].latch_backoff); // latch travels in positive direction - hm.zero_backoff = -max(0.0f, cm->a[axis].zero_backoff); // zero backoff is negative direction (or zero) - // will set the maximum position - // (plus any negative backoff) + hm.search_travel = travel_distance; // search travels in positive direction + hm.latch_backoff = fabs(cm->a[axis].latch_backoff); // latch travels in positive direction + hm.zero_backoff = -max(0.0f, cm->a[axis].zero_backoff);// zero backoff is negative direction (or zero) + // will set the maximum position + // (plus any negative backoff) hm.setpoint = cm->a[axis].travel_max + (max(0.0f, -cm->a[axis].zero_backoff)); } else { hm.search_travel = -travel_distance; // search travels in negative direction - hm.latch_backoff = -fabs(cm->a[axis].latch_backoff); // latch travels in negative direction - hm.zero_backoff = max(0.0f, cm->a[axis].zero_backoff); // zero backoff is positive direction (or zero) + hm.latch_backoff = -fabs(cm->a[axis].latch_backoff); // latch travels in negative direction + hm.zero_backoff = max(0.0f, cm->a[axis].zero_backoff); // zero backoff is positive direction (or zero) // will set the minimum position // (minus any negative backoff) hm.setpoint = cm->a[axis].travel_min + (max(0.0f, -cm->a[axis].zero_backoff)); } // if homing is disabled for the axis then skip to the next axis - hm.saved_jerk = cm_get_axis_jerk(axis); // save the max jerk value - return (_set_homing_func(_homing_axis_clear_init)); // perform an initial clear + hm.saved_jerk = cm_get_axis_jerk(axis); // save the max jerk value + return (_set_homing_func(_homing_axis_clear_init)); // perform an initial clear } -// Handle an initial switch closure by backing off the closed switch -// NOTE: clear_init() relies on independent switches per axis (not shared) +/*********************************************************************************** + * _homing_axis_clear_init() - initiate a clear to move off a switch that is thrown at the start + * + * Handle an initial switch closure by backing off the closed switch + * NOTE: clear_init() relies on independent switches per axis (not shared) + */ static stat_t _homing_axis_clear_init(int8_t axis) // first clear move { if (gpio_read_input(hm.homing_input) == INPUT_ACTIVE) { // the switch is closed at startup @@ -293,6 +295,9 @@ static stat_t _homing_axis_clear_init(int8_t axis) // first clear move return (_set_homing_func(_homing_axis_search)); // start the search } +/*********************************************************************************** + * _homing_axis_search() - fast search for switch, closes switch + */ static stat_t _homing_axis_search(int8_t axis) // drive to switch { cm_set_axis_jerk(axis, cm->a[axis].jerk_high); // use the high-speed jerk for search onward @@ -300,25 +305,37 @@ static stat_t _homing_axis_search(int8_t axis) // drive to switch return (_set_homing_func(_homing_axis_clear)); } +/*********************************************************************************** + * _homing_axis_clear() - clear off the switch + */ static stat_t _homing_axis_clear(int8_t axis) // drive away from switch at search speed { _homing_axis_move(axis, -hm.latch_backoff, hm.search_velocity); return (_set_homing_func(_homing_axis_latch)); } +/*********************************************************************************** + * _homing_axis_latch() - slow drive until until switch closes again + */ static stat_t _homing_axis_latch(int8_t axis) // drive to switch at low speed { _homing_axis_move(axis, hm.latch_backoff, hm.latch_velocity); return (_set_homing_func(_homing_axis_setpoint_backoff)); } -static stat_t _homing_axis_setpoint_backoff(int8_t axis) // backoff to zero or max setpoint position +/*********************************************************************************** + * _homing_axis_setpoint_backoff() - backoff to zero or max setpoint position + */ +static stat_t _homing_axis_setpoint_backoff(int8_t axis) // { _homing_axis_move(axis, hm.zero_backoff, hm.search_velocity); return (_set_homing_func(_homing_axis_set_position)); } -static stat_t _homing_axis_set_position(int8_t axis) // set axis zero / max and finish up +/*********************************************************************************** + * _homing_axis_set_position() - set axis zero / max and finish up + */ +static stat_t _homing_axis_set_position(int8_t axis) { if (hm.set_coordinates) { cm_set_position_by_axis(axis, hm.setpoint); @@ -335,6 +352,15 @@ static stat_t _homing_axis_set_position(int8_t axis) // set axis zero / max and return (_set_homing_func(_homing_axis_start)); } +/*********************************************************************************** + * _homing_axis_move() - helper that actually executes the above moves + * _motion_end_callback() - callback completes when motion has stopped + */ +static void _motion_end_callback(float* vect, bool* flag) +{ + hm.waiting_for_motion_end = false; +} + static stat_t _homing_axis_move(int8_t axis, float target, float velocity) { float vect[] = {0, 0, 0, 0, 0, 0}; bool flags[] = {false, false, false, false, false, false}; @@ -352,15 +378,12 @@ static stat_t _homing_axis_move(int8_t axis, float target, float velocity) { } // the last two arguments are ignored anyway - mp_queue_command(_homing_axis_move_callback, nullptr, nullptr); + mp_queue_command(_motion_end_callback, nullptr, nullptr); return (STAT_EAGAIN); } -static void _homing_axis_move_callback(float* vect, bool* flag) { hm.waiting_for_motion_end = false; } - - -/* +/*********************************************************************************** * _homing_error_exit() * * Generate an error message. Since the error exit returns via the homing callback @@ -382,7 +405,7 @@ static stat_t _homing_error_exit(int8_t axis, stat_t status) { return (STAT_HOMING_CYCLE_FAILED); // homing state remains HOMING_NOT_HOMED } -/* +/*********************************************************************************** * _homing_finalize_exit() - helper to finalize homing */ @@ -398,7 +421,7 @@ static stat_t _homing_finalize_exit(int8_t axis) // third part of return to hom return (STAT_OK); } -/* +/*********************************************************************************** * _get_next_axis() - return next axis in sequence based on axis in arg * * Accepts "axis" arg as the current axis; or -1 to retrieve the first axis diff --git a/g2core/g2core.cppproj b/g2core/g2core.cppproj index 0014b2ec..23ff3756 100644 --- a/g2core/g2core.cppproj +++ b/g2core/g2core.cppproj @@ -73,7 +73,7 @@ SWD com.atmel.avrdbg.tool.atmelice - J41800036434 + J41800021206 Atmel-ICE True @@ -100,7 +100,7 @@ True true - J41800036434 + J41800021206 0x284E0A60 10000000 diff --git a/g2core/plan_exec.cpp b/g2core/plan_exec.cpp index b17e38a5..d3117ad6 100644 --- a/g2core/plan_exec.cpp +++ b/g2core/plan_exec.cpp @@ -993,21 +993,24 @@ static stat_t _exec_aline_feedhold(mpBuf_t *bf) if (mp_runtime_is_idle()) { // wait for steppers to actually finish mp_zero_segment_velocity(); // finalize velocity for reporting purposes - // if probing or homing exit the move and advance to the _motion_end finalization command - if ((cm->cycle_state == CYCLE_HOMING) || (cm->cycle_state == CYCLE_PROBE)) { + // If in a p2 hold, exit the p2 hold set up a flush of the p2 planner queue + if (cm == &cm2) { +// copy_vector(mp->position, mr->position); // update planner position from runtime + cm->hold_state = FEEDHOLD_P2_EXIT; + } + // At this point we know we are in a p1 hold + + // If probing or homing exit the move and advance to the _motion_end finalization command. + // Stop the runtime, clear the bun buffer and do not transition to p2 planner + else if ((cm->cycle_state == CYCLE_HOMING) || (cm->cycle_state == CYCLE_PROBE)) { mr->block_state = BLOCK_INACTIVE; // disable the rest of the runtime movement copy_vector(mp->position, mr->position); // update planner position from runtime mp_free_run_buffer(); // free buffer and enable finalization move to get loaded cm->hold_state = FEEDHOLD_OFF; } - - // if exiting a p2 hold set up a flush of the p2 planner queue - else if (cm == &cm2) { -// copy_vector(mp->position, mr->position); // update planner position from runtime - cm->hold_state = FEEDHOLD_P2_EXIT; - } - - // if exiting a regular p1 hold perform Z-lift, spindle, coolant actions + + // If exiting a regular p1 hold set state to FEEDHOLD_ACTIONS_START. + // This enables transition to p2 planner; then Z-lift, spindle, coolant actions else { cm->hold_state = FEEDHOLD_ACTIONS_START; } diff --git a/g2core/settings/settings_othermill.h b/g2core/settings/settings_othermill.h index 98799bcc..6b3607d5 100644 --- a/g2core/settings/settings_othermill.h +++ b/g2core/settings/settings_othermill.h @@ -32,24 +32,27 @@ //**** GLOBAL / GENERAL SETTINGS ****************************************************** -#define JUNCTION_INTEGRATION_TIME 0.75 // cornering - between 0.10 and 2.00 (higher is faster) -#define CHORDAL_TOLERANCE 0.01 // chordal accuracy for arc drawing (in mm) +#define JUNCTION_INTEGRATION_TIME 0.75 // cornering - between 0.10 and 2.00 (higher is faster) +#define CHORDAL_TOLERANCE 0.01 // chordal accuracy for arc drawing (in mm) -#define SOFT_LIMIT_ENABLE 0 // 0=off, 1=on -#define HARD_LIMIT_ENABLE 1 // 0=off, 1=on -#define SAFETY_INTERLOCK_ENABLE 1 // 0=off, 1=on +#define SOFT_LIMIT_ENABLE 0 // 0=off, 1=on +#define HARD_LIMIT_ENABLE 1 // 0=off, 1=on +#define SAFETY_INTERLOCK_ENABLE 1 // 0=off, 1=on -#define SPINDLE_ENABLE_POLARITY 1 // 0=active low, 1=active high -#define SPINDLE_DIR_POLARITY 0 // 0=clockwise is low, 1=clockwise is high -#define SPINDLE_PAUSE_ON_HOLD true -#define SPINDLE_DWELL_TIME 1.5 // after unpausing and turning the spindle on, dwell for 1.5s +#define SPINDLE_ENABLE_POLARITY 1 // 0=active low, 1=active high +#define SPINDLE_DIR_POLARITY 0 // 0=clockwise is low, 1=clockwise is high +#define SPINDLE_PAUSE_ON_HOLD true +#define SPINDLE_DWELL_TIME 1.5 // after unpausing and turning the spindle on, dwell for 1.5s -#define ESC_BOOT_TIME 5000 // how long the ESC takes to boot, in milliseconds -#define ESC_LOCKOUT_TIME 900 // how long the interlock needs to be engaged before killing power... actually 1s, but be conservative +#define ESC_BOOT_TIME 5000 // how long the ESC takes to boot, in milliseconds +#define ESC_LOCKOUT_TIME 900 // how long the interlock needs to be engaged before killing power... actually 1s, but be conservative -#define COOLANT_MIST_POLARITY 1 // 0=active low, 1=active high -#define COOLANT_FLOOD_POLARITY 1 // 0=active low, 1=active high -#define COOLANT_PAUSE_ON_HOLD true +#define COOLANT_MIST_POLARITY 1 // 0=active low, 1=active high +#define COOLANT_FLOOD_POLARITY 1 // 0=active low, 1=active high +#define COOLANT_PAUSE_ON_HOLD true + +#define FEEDHOLD_Z_LIFT 3 // mm to lift Z on feedhold +#define PROBE_REPORT_ENABLE true // WARNING: Older Othermill machines use a 15deg can stack for their Z axis. // new machines use a stepper which has the same config as the other axis. @@ -66,20 +69,25 @@ // Communications and reporting settings -#define COMM_MODE JSON_MODE // one of: TEXT_MODE, JSON_MODE -#define XIO_ENABLE_FLOW_CONTROL FLOW_CONTROL_RTS // FLOW_CONTROL_OFF, FLOW_CONTROL_RTS +#define USB_SERIAL_PORTS_EXPOSED 1 // Valid options are 1 or 2, only! -#define TEXT_VERBOSITY TV_VERBOSE // one of: TV_SILENT, TV_VERBOSE -#define JSON_VERBOSITY JV_MESSAGES // one of: JV_SILENT, JV_FOOTER, JV_CONFIGS, JV_MESSAGES, JV_LINENUM, JV_VERBOSE -#define QUEUE_REPORT_VERBOSITY QR_SINGLE // one of: QR_OFF, QR_SINGLE, QR_TRIPLE +#define COMM_MODE JSON_MODE // one of: TEXT_MODE, JSON_MODE +#define XIO_ENABLE_FLOW_CONTROL FLOW_CONTROL_RTS // FLOW_CONTROL_OFF, FLOW_CONTROL_RTS -#define STATUS_REPORT_VERBOSITY SR_FILTERED // one of: SR_OFF, SR_FILTERED, SR_VERBOSE -#define STATUS_REPORT_MIN_MS 100 // milliseconds - enforces a viable minimum -#define STATUS_REPORT_INTERVAL_MS 250 // milliseconds - set $SV=0 to disable -#define STATUS_REPORT_DEFAULTS \ - "mpox", "mpoy", "mpoz", "ofsx", "ofsy", "ofsz", "g55x", "g55y", "g55z", "unit", "stat", "coor", "momo", "dist", \ - "home", "mots", "plan", "line", "path", "frmo", "hold", "macs", "cycs" -// "path","frmo","prbe","safe","spe","spd","hold","macs","cycs","sps" +#define TEXT_VERBOSITY TV_VERBOSE // one of: TV_SILENT, TV_VERBOSE +#define JSON_VERBOSITY JV_MESSAGES // one of: JV_SILENT, JV_FOOTER, JV_CONFIGS, JV_MESSAGES, JV_LINENUM, JV_VERBOSE +#define QUEUE_REPORT_VERBOSITY QR_SINGLE // one of: QR_OFF, QR_SINGLE, QR_TRIPLE + +#define STATUS_REPORT_VERBOSITY SR_FILTERED // one of: SR_OFF, SR_FILTERED, SR_VERBOSE +#define STATUS_REPORT_MIN_MS 100 // milliseconds - enforces a viable minimum +#define STATUS_REPORT_INTERVAL_MS 250 // milliseconds - set $SV=0 to disable +#define STATUS_REPORT_DEFAULTS "mpox", "mpoy", "mpoz", \ + "ofsx", "ofsy", "ofsz", \ + "g55x", "g55y", "g55z", \ + "unit", "stat", "coor", "momo", "dist", \ + "home", "mots", "plan", "line", "path", \ + "frmo", "hold", "macs", "cycs" +// "prbe", "safe", "spe", "spd", "sps" // Gcode startup defaults #define GCODE_DEFAULT_UNITS MILLIMETERS // MILLIMETERS or INCHES @@ -92,49 +100,126 @@ // NOTE: Motor numbers are reversed from TinyGv8 in order to maintain compatibility with wiring harnesses -#define MOTOR_POWER_LEVEL_XY 0.375 // default motor power level 0.00 - 1.00 -#define MOTOR_POWER_LEVEL_XY_IDLE 0.15 -#define MOTOR_POWER_LEVEL_Z 0.375 -#define MOTOR_POWER_LEVEL_Z_IDLE 0.15 -#define MOTOR_POWER_LEVEL_DISABLED 0.05 +#define MOTOR_POWER_LEVEL_XY 0.375 // default motor power level 0.00 - 1.00 +#define MOTOR_POWER_LEVEL_XY_IDLE 0.15 +#define MOTOR_POWER_LEVEL_Z 0.375 +#define MOTOR_POWER_LEVEL_Z_IDLE 0.15 +#define MOTOR_POWER_LEVEL_DISABLED 0.05 -#define MOTOR_POWER_MODE MOTOR_POWERED_IN_CYCLE -#define MOTOR_POWER_TIMEOUT 2.00 // motor power timeout in seconds +#define MOTOR_POWER_MODE MOTOR_POWERED_IN_CYCLE +#define MOTOR_POWER_TIMEOUT 2.00 // motor power timeout in seconds -#define M1_MOTOR_MAP AXIS_X // 1ma -#define M1_STEP_ANGLE 1.8 // 1sa -#define M1_TRAVEL_PER_REV 4.8768 // 1tr -#define M1_MICROSTEPS 8 // 1mi 1,2,4,8,16,32 -#define M1_POLARITY 1 // 1po 0=normal, 1=reversed -#define M1_POWER_MODE MOTOR_POWER_MODE // 1pm See enum cmMotorPowerMode in stepper.h -#define M1_POWER_LEVEL MOTOR_POWER_LEVEL_XY // 0.00=off, 1.00=max -#define M1_POWER_LEVEL_IDLE MOTOR_POWER_LEVEL_XY_IDLE +#define M1_MOTOR_MAP AXIS_X // 1ma +#define M1_STEP_ANGLE 1.8 // 1sa +#define M1_TRAVEL_PER_REV 4.8768 // 1tr +#define M1_MICROSTEPS 8 // 1mi 1,2,4,8,16,32 +#define M1_POLARITY 1 // 1po 0=normal, 1=reversed +#define M1_POWER_MODE MOTOR_POWER_MODE // 1pm See enum cmMotorPowerMode in stepper.h +#define M1_POWER_LEVEL MOTOR_POWER_LEVEL_XY // 0.00=off, 1.00=max +#define M1_POWER_LEVEL_IDLE MOTOR_POWER_LEVEL_XY_IDLE -#define M2_MOTOR_MAP AXIS_Y -#define M2_STEP_ANGLE 1.8 -#define M2_TRAVEL_PER_REV 4.8768 -#define M2_MICROSTEPS 8 -#define M2_POLARITY 1 -#define M2_POWER_MODE MOTOR_POWER_MODE -#define M2_POWER_LEVEL MOTOR_POWER_LEVEL_XY -#define M2_POWER_LEVEL_IDLE MOTOR_POWER_LEVEL_XY_IDLE +#define M2_MOTOR_MAP AXIS_Y +#define M2_STEP_ANGLE 1.8 +#define M2_TRAVEL_PER_REV 4.8768 +#define M2_MICROSTEPS 8 +#define M2_POLARITY 1 +#define M2_POWER_MODE MOTOR_POWER_MODE +#define M2_POWER_LEVEL MOTOR_POWER_LEVEL_XY +#define M2_POWER_LEVEL_IDLE MOTOR_POWER_LEVEL_XY_IDLE -#define M3_MOTOR_MAP AXIS_Z +#define M3_MOTOR_MAP AXIS_Z #if HAS_CANSTACK_Z_AXIS -#define M3_STEP_ANGLE 15 -#define M3_TRAVEL_PER_REV 1.27254 +#define M3_STEP_ANGLE 15 +#define M3_TRAVEL_PER_REV 1.27254 #else -#define M3_STEP_ANGLE 1.8 -#define M3_TRAVEL_PER_REV 4.8768 +#define M3_STEP_ANGLE 1.8 +#define M3_TRAVEL_PER_REV 4.8768 #endif -#define M3_MICROSTEPS 8 -#define M3_POLARITY 0 -#define M3_POWER_MODE MOTOR_POWER_MODE -#define M3_POWER_LEVEL MOTOR_POWER_LEVEL_Z -#define M3_POWER_LEVEL_IDLE MOTOR_POWER_LEVEL_Z_IDLE +#define M3_MICROSTEPS 8 +#define M3_POLARITY 0 +#define M3_POWER_MODE MOTOR_POWER_MODE +#define M3_POWER_LEVEL MOTOR_POWER_LEVEL_Z +#define M3_POWER_LEVEL_IDLE MOTOR_POWER_LEVEL_Z_IDLE + +#define M4_MOTOR_MAP AXIS_A +#define M4_STEP_ANGLE 1.8 +#define M4_TRAVEL_PER_REV 360 // degrees moved per motor rev +#define M4_MICROSTEPS 8 +#define M4_POLARITY 1 +#define M4_POWER_MODE MOTOR_DISABLED +#define M4_POWER_LEVEL MOTOR_POWER_LEVEL_DISABLED +#define M4_POWER_LEVEL_IDLE MOTOR_POWER_LEVEL_DISABLED + +#define M5_MOTOR_MAP AXIS_B +#define M5_STEP_ANGLE 1.8 +#define M5_TRAVEL_PER_REV 360 // degrees moved per motor rev +#define M5_MICROSTEPS 8 +#define M5_POLARITY 0 +#define M5_POWER_MODE MOTOR_DISABLED +#define M5_POWER_LEVEL MOTOR_POWER_LEVEL_DISABLED +#define M5_POWER_LEVEL_IDLE MOTOR_POWER_LEVEL_DISABLED + +#define M6_MOTOR_MAP AXIS_C +#define M6_STEP_ANGLE 1.8 +#define M6_TRAVEL_PER_REV 360 // degrees moved per motor rev +#define M6_MICROSTEPS 8 +#define M6_POLARITY 0 +#define M6_POWER_MODE MOTOR_DISABLED +#define M6_POWER_LEVEL MOTOR_POWER_LEVEL_DISABLED +#define M6_POWER_LEVEL_IDLE MOTOR_POWER_LEVEL_DISABLED // *** axis settings ********************************************************************************** +#define JERK_MAX 500 // 500 million mm/(min^3) +#define JERK_HIGH_SPEED 1000 // 1000 million mm/(min^3) // Jerk during homing needs to stop *fast* +#define VELOCITY_MAX 1500 +#define SEARCH_VELOCITY (VELOCITY_MAX / 3) +#define LATCH_VELOCITY 25 // reeeeally slow for accuracy + +#define X_AXIS_MODE AXIS_STANDARD // xam see canonical_machine.h cmAxisMode for valid values +#define X_VELOCITY_MAX VELOCITY_MAX // xvm G0 max velocity in mm/min +#define X_FEEDRATE_MAX X_VELOCITY_MAX // xfr G1 max feed rate in mm/min +#define X_TRAVEL_MIN 0 // xtn minimum travel for soft limits +#define X_TRAVEL_MAX 145.6 // xtr travel between switches or crashes +#define X_JERK_MAX JERK_MAX // xjm +#define X_JERK_HIGH_SPEED JERK_HIGH_SPEED // xjh +#define X_HOMING_INPUT 1 // xhi input used for homing or 0 to disable +#define X_HOMING_DIRECTION 0 // xhd 0=search moves negative, 1= search moves positive +#define X_SEARCH_VELOCITY SEARCH_VELOCITY // xsv +#define X_LATCH_VELOCITY LATCH_VELOCITY // xlv mm/min +#define X_LATCH_BACKOFF 2 // xlb mm +#define X_ZERO_BACKOFF 0.4 // xzb mm + +#define Y_AXIS_MODE AXIS_STANDARD +#define Y_VELOCITY_MAX X_VELOCITY_MAX +#define Y_FEEDRATE_MAX Y_VELOCITY_MAX +#define Y_TRAVEL_MIN 0 +#define Y_TRAVEL_MAX 119.1 +#define Y_JERK_MAX JERK_MAX +#define Y_JERK_HIGH_SPEED JERK_HIGH_SPEED +#define Y_HOMING_INPUT 3 +#define Y_HOMING_DIRECTION 0 +#define Y_SEARCH_VELOCITY (Y_FEEDRATE_MAX / 3) +#define Y_LATCH_VELOCITY LATCH_VELOCITY +#define Y_LATCH_BACKOFF 2 +#define Y_ZERO_BACKOFF 0.4 + +#define Z_AXIS_MODE AXIS_STANDARD +#define Z_VELOCITY_MAX X_VELOCITY_MAX +#define Z_FEEDRATE_MAX Z_VELOCITY_MAX +#define Z_TRAVEL_MIN -60.1 +#define Z_TRAVEL_MAX 0 +#define Z_JERK_MAX JERK_MAX +#define Z_JERK_HIGH_SPEED JERK_HIGH_SPEED +#define Z_HOMING_INPUT 6 +#define Z_HOMING_DIRECTION 1 +#define Z_SEARCH_VELOCITY (Z_FEEDRATE_MAX / 3) +#define Z_LATCH_VELOCITY LATCH_VELOCITY +#define Z_LATCH_BACKOFF 2 +#define Z_ZERO_BACKOFF 0.4 + + +/* #define JERK_MAX 500 // 500 million mm/(min^3) #define JERK_HIGH_SPEED 1000 // 1000 million mm/(min^3) // Jerk during homing needs to stop *fast* #define VELOCITY_MAX 1500 @@ -186,6 +271,7 @@ #define Z_LATCH_VELOCITY LATCH_VELOCITY #define Z_LATCH_BACKOFF 1 #define Z_ZERO_BACKOFF 0.4 +*/ //*** Input / output settings *** /* @@ -212,65 +298,68 @@ */ // Xmin on v9 board // X homing - see X axis setup -#define DI1_MODE NORMALLY_CLOSED -#define DI1_ACTION INPUT_ACTION_NONE -#define DI1_FUNCTION INPUT_FUNCTION_NONE +#define DI1_MODE NORMALLY_CLOSED +#define DI1_ACTION INPUT_ACTION_NONE +#define DI1_FUNCTION INPUT_FUNCTION_NONE // Xmax // External ESTOP -#define DI2_MODE IO_ACTIVE_HIGH -#define DI2_ACTION INPUT_ACTION_HALT -#define DI2_FUNCTION INPUT_FUNCTION_SHUTDOWN +#define DI2_MODE IO_ACTIVE_HIGH +#define DI2_ACTION INPUT_ACTION_HALT +#define DI2_FUNCTION INPUT_FUNCTION_SHUTDOWN // Ymin // Y homing - see Y axis setup -#define DI3_MODE NORMALLY_CLOSED -#define DI3_ACTION INPUT_ACTION_NONE -#define DI3_FUNCTION INPUT_FUNCTION_NONE +#define DI3_MODE NORMALLY_CLOSED +#define DI3_ACTION INPUT_ACTION_NONE +#define DI3_FUNCTION INPUT_FUNCTION_NONE // Ymax // Safety interlock -#define DI4_MODE IO_ACTIVE_HIGH -#define DI4_ACTION INPUT_ACTION_NONE // (hold is performed by Interlock function) -#define DI4_FUNCTION INPUT_FUNCTION_INTERLOCK +#define DI4_MODE IO_ACTIVE_HIGH +#define DI4_ACTION INPUT_ACTION_NONE // (hold is performed by Interlock function) +#define DI4_FUNCTION INPUT_FUNCTION_INTERLOCK // Zmin // Z probe -#define DI5_MODE IO_ACTIVE_LOW -#define DI5_ACTION INPUT_ACTION_NONE -#define DI5_FUNCTION INPUT_FUNCTION_NONE +#define DI5_MODE IO_ACTIVE_LOW +#define DI5_ACTION INPUT_ACTION_NONE +#define DI5_FUNCTION INPUT_FUNCTION_PROBE // Zmax // Z homing - see Z axis for setup -#define DI6_MODE NORMALLY_CLOSED -#define DI6_ACTION INPUT_ACTION_NONE -#define DI6_FUNCTION INPUT_FUNCTION_NONE +#define DI6_MODE NORMALLY_CLOSED +#define DI6_ACTION INPUT_ACTION_NONE +#define DI6_FUNCTION INPUT_FUNCTION_NONE // Amin // Unused -#define DI7_MODE IO_MODE_DISABLED -#define DI7_ACTION INPUT_ACTION_NONE -#define DI7_FUNCTION INPUT_FUNCTION_NONE +#define DI7_MODE IO_MODE_DISABLED +#define DI7_ACTION INPUT_ACTION_NONE +#define DI7_FUNCTION INPUT_FUNCTION_NONE // Amax // Unused -#define DI8_MODE IO_MODE_DISABLED -#define DI8_ACTION INPUT_ACTION_NONE -#define DI8_FUNCTION INPUT_FUNCTION_NONE +#define DI8_MODE IO_MODE_DISABLED +#define DI8_ACTION INPUT_ACTION_NONE +#define DI8_FUNCTION INPUT_FUNCTION_NONE // Safety line w/HW timer // Unused -#define DI9_MODE IO_MODE_DISABLED -#define DI9_ACTION INPUT_ACTION_NONE -#define DI9_FUNCTION INPUT_FUNCTION_NONE +#define DI9_MODE IO_MODE_DISABLED +#define DI9_ACTION INPUT_ACTION_NONE +#define DI9_FUNCTION INPUT_FUNCTION_NONE + // *** PWM SPINDLE CONTROL *** -#define P1_PWM_FREQUENCY 100 // in Hz -#define P1_CW_SPEED_LO 10500 // in RPM (arbitrary units) -#define P1_CW_SPEED_HI 16400 -#define P1_CW_PHASE_LO 0.13 // phase [0..1] -#define P1_CW_PHASE_HI 0.17 -#define P1_CCW_SPEED_LO 0 -#define P1_CCW_SPEED_HI 0 -#define P1_CCW_PHASE_LO 0.1 -#define P1_CCW_PHASE_HI 0.1 -#define P1_PWM_PHASE_OFF 0.1 +#define P1_PWM_FREQUENCY 100 // in Hz +#define P1_CW_SPEED_LO 10500 // in RPM (arbitrary units) +#define P1_CW_SPEED_HI 16400 +#define P1_CW_PHASE_LO 0.13 // phase [0..1] +#define P1_CW_PHASE_HI 0.17 +#define P1_CCW_SPEED_LO 0 +#define P1_CCW_SPEED_HI 0 +#define P1_CCW_PHASE_LO 0.1 +#define P1_CCW_PHASE_HI 0.1 +#define P1_PWM_PHASE_OFF 0.1 +/* #define P1_USE_MAPPING_CUBIC #define P1_MAPPING_CUBIC_X3 2.1225328766717546e-013 #define P1_MAPPING_CUBIC_X2 -7.2900167282605129e-009 #define P1_MAPPING_CUBIC_X1 8.5854646785876479e-005 #define P1_MAPPING_CUBIC_X0 -2.1301489219406905e-001 +*/ \ No newline at end of file diff --git a/g2core/settings/settings_othermill_test.h b/g2core/settings/settings_othermill_test.h index 077b2357..2c8720af 100644 --- a/g2core/settings/settings_othermill_test.h +++ b/g2core/settings/settings_othermill_test.h @@ -47,9 +47,12 @@ #define ESC_BOOT_TIME 5000 // how long the ESC takes to boot, in milliseconds #define ESC_LOCKOUT_TIME 900 // how long the interlock needs to be engaged before killing power... actually 1s, but be conservative -#define COOLANT_MIST_POLARITY 1 // 0=active low, 1=active high -#define COOLANT_FLOOD_POLARITY 1 // 0=active low, 1=active high -#define COOLANT_PAUSE_ON_HOLD true +#define COOLANT_MIST_POLARITY 1 // 0=active low, 1=active high +#define COOLANT_FLOOD_POLARITY 1 // 0=active low, 1=active high +#define COOLANT_PAUSE_ON_HOLD true + +#define FEEDHOLD_Z_LIFT 3 // mm to lift Z on feedhold +#define PROBE_REPORT_ENABLE true // Communications and reporting settings @@ -196,8 +199,8 @@ #define Z_ZERO_BACKOFF 0.4 // Rotary values are chosen to make the motor react the same as X for testing -#define A_AXIS_MODE AXIS_DISABLED // DISABLED -#define A_VELOCITY_MAX ((X_VELOCITY_MAX / M1_TRAVEL_PER_REV) * 360) // set to the same speed as X axis +#define A_AXIS_MODE AXIS_DISABLED // DISABLED +#define A_VELOCITY_MAX ((X_VELOCITY_MAX / M1_TRAVEL_PER_REV) * 360) // set to the same speed as X axis #define A_FEEDRATE_MAX A_VELOCITY_MAX #define A_TRAVEL_MIN -1 // min/max the same means infinite, no limit #define A_TRAVEL_MAX -1 @@ -323,8 +326,10 @@ #define P1_CCW_PHASE_HI 0.1 #define P1_PWM_PHASE_OFF 0.1 +/* #define P1_USE_MAPPING_CUBIC #define P1_MAPPING_CUBIC_X3 2.1225328766717546e-013 #define P1_MAPPING_CUBIC_X2 -7.2900167282605129e-009 #define P1_MAPPING_CUBIC_X1 8.5854646785876479e-005 #define P1_MAPPING_CUBIC_X0 -2.1301489219406905e-001 +*/ \ No newline at end of file