Merge branch 'dev-omco-issue-2' of github.com:synthetos/g2 into dev-omco-issue-2

This commit is contained in:
Alden Hart
2015-05-06 08:27:15 -04:00
10 changed files with 493 additions and 56 deletions
+1
View File
@@ -60,6 +60,7 @@ DEBUG ?= 0
SETTINGS_FILE ?= settings_default.h
SETTINGS_FILE="settings_othermill.h"
# SETTINGS_FILE="settings_othermill_test.h"
# SETTINGS_FILE="settings_probotixV90.h"
# SETTINGS_FILE="settings_shapeoko2.h"
# SETTINGS_FILE="settings_shopbot_sbv300.h"
+3
View File
@@ -1243,6 +1243,9 @@
<Compile Include="settings\settings_othermill.h">
<SubType>compile</SubType>
</Compile>
<Compile Include="settings\settings_othermill_test.h">
<SubType>compile</SubType>
</Compile>
<Compile Include="settings\settings_probotixV90.h">
<SubType>compile</SubType>
</Compile>
+3 -1
View File
@@ -1422,7 +1422,9 @@ void cm_request_feedhold(void) {
void cm_request_end_hold(void)
{
cm.end_hold_requested = true;
if (cm.hold_state != FEEDHOLD_OFF) {
cm.end_hold_requested = true;
}
}
void cm_request_queue_flush()
+27 -25
View File
@@ -50,6 +50,7 @@ struct jmJoggingSingleton { // persistent jogging runtime variables
uint8_t saved_units_mode; // G20,G21 global setting
uint8_t saved_coord_system; // G54 - G59 setting
uint8_t saved_distance_mode; // G90,G91 global setting
uint8_t saved_feed_rate_mode;
float saved_jerk; // saved and restored for each axis jogged
};
static struct jmJoggingSingleton jog;
@@ -86,13 +87,15 @@ stat_t cm_jogging_cycle_start(uint8_t axis)
jog.saved_units_mode = cm_get_units_mode(ACTIVE_MODEL); //cm.gm.units_mode;
jog.saved_coord_system = cm_get_coord_system(ACTIVE_MODEL); //cm.gm.coord_system;
jog.saved_distance_mode = cm_get_distance_mode(ACTIVE_MODEL); //cm.gm.distance_mode;
jog.saved_feed_rate = cm_get_distance_mode(ACTIVE_MODEL); //cm.gm.feed_rate;
jog.saved_feed_rate_mode = cm_get_feed_rate_mode(ACTIVE_MODEL);
jog.saved_feed_rate = (ACTIVE_MODEL)->feed_rate; //cm.gm.feed_rate;
jog.saved_jerk = cm.a[axis].jerk_max;
// set working values
cm_set_units_mode(MILLIMETERS);
cm_set_distance_mode(ABSOLUTE_MODE);
cm_set_coord_system(ABSOLUTE_COORDS); // jogging is done in machine coordinates
cm_set_feed_rate_mode(UNITS_PER_MINUTE_MODE);
jog.velocity_start = JOGGING_START_VELOCITY; // see canonical_machine.h for #define
jog.velocity_max = cm.a[axis].velocity_max;
@@ -121,11 +124,15 @@ stat_t cm_jogging_cycle_start(uint8_t axis)
stat_t cm_jogging_cycle_callback(void)
{
if (cm.cycle_state != CYCLE_JOG) { return (STAT_NOOP); } // exit if not in a jogging cycle
if(jog.func == _jogging_finalize_exit && cm_get_runtime_busy() == true)
{ return (STAT_EAGAIN); } // sync to planner move ends
if(jog.func == _jogging_axis_ramp_jog && mp_get_planner_buffers_available() < PLANNER_BUFFER_HEADROOM)
{ return (STAT_EAGAIN); } // prevent flooding the queue with jog moves
if (cm.cycle_state != CYCLE_JOG) {
return (STAT_NOOP); // exit if not in a jogging cycle
}
if (jog.func == _jogging_finalize_exit && cm_get_runtime_busy() == true) {
return (STAT_EAGAIN); // sync to planner move ends
}
if (jog.func == _jogging_axis_ramp_jog && mp_get_planner_buffers_available() < PLANNER_BUFFER_HEADROOM) {
return (STAT_EAGAIN); // prevent flooding the queue with jog moves
}
return (jog.func(jog.axis)); // execute the current jogging move
}
@@ -137,11 +144,7 @@ static stat_t _set_jogging_func(stat_t (*func)(int8_t axis))
static stat_t _jogging_axis_start(int8_t axis)
{
mp_flush_planner();
// if (cm.hold_state == FEEDHOLD_HOLD); {
// cm_end_hold();
// }
cm_end_hold(); // ends hold if on is in effect
// cm_end_hold(); // ends hold if one is in effect
return (_set_jogging_func(_jogging_axis_ramp_jog));
}
@@ -166,10 +169,11 @@ static stat_t _jogging_axis_ramp_jog(int8_t axis) // run the jog ramp
_jogging_axis_move(axis, target, velocity);
jog.step++;
if(last)
if(last) {
return (_set_jogging_func(_jogging_finalize_exit));
else
} else {
return (_set_jogging_func(_jogging_axis_ramp_jog));
}
}
static stat_t _jogging_axis_move(int8_t axis, float target, float velocity)
@@ -185,19 +189,17 @@ static stat_t _jogging_axis_move(int8_t axis, float target, float velocity)
static stat_t _jogging_finalize_exit(int8_t axis) // finish a jog
{
mp_flush_planner();
// if (cm.hold_state == FEEDHOLD_HOLD);
// cm_end_hold();
cm_end_hold(); // ends hold if on is in effect
// cm_end_hold(); // ends hold if one is in effect
cm_set_coord_system(jog.saved_coord_system); // restore to work coordinate system
cm_set_units_mode(jog.saved_units_mode);
cm_set_distance_mode(jog.saved_distance_mode);
cm_set_feed_rate(jog.saved_feed_rate);
cm_set_motion_mode(MODEL, MOTION_MODE_CANCEL_MOTION_MODE);
cm_canned_cycle_end();
printf("{\"jog\":0}\n"); // needed by OMC jogging function
return (STAT_OK);
cm_set_coord_system(jog.saved_coord_system); // restore to work coordinate system
cm_set_units_mode(jog.saved_units_mode);
cm_set_distance_mode(jog.saved_distance_mode);
cm_set_feed_rate_mode(jog.saved_feed_rate_mode);
(MODEL)->feed_rate = jog.saved_feed_rate;
cm_set_motion_mode(MODEL, MOTION_MODE_CANCEL_MOTION_MODE);
cm_canned_cycle_end();
printf("{\"jog\":0}\n"); // needed by OMC jogging function
return (STAT_OK);
}
/*
+16 -15
View File
@@ -58,6 +58,12 @@ stat_t gcode_parser(char *block)
uint8_t block_delete_flag;
_normalize_gcode_block(str, &com, &msg, &block_delete_flag);
// queue a "(MSG" response
if (*msg != NUL) {
(void)cm_message(msg); // queue the message
}
if (str[0] == NUL) { // normalization returned null string
return (STAT_OK); // most likely a comment line
}
@@ -72,11 +78,6 @@ stat_t gcode_parser(char *block)
if (block_delete_flag == true) {
return (STAT_NOOP);
}
// queue a "(MSG" response
if (*msg != NUL) {
(void)cm_message(msg); // queue the message
}
return(_parse_gcode_block(block));
}
@@ -470,24 +471,24 @@ static stat_t _execute_gcode_block()
case NEXT_ACTION_SET_G30_POSITION: { status = cm_set_g30_position(); break;} // G30.1
case NEXT_ACTION_GOTO_G30_POSITION: { status = cm_goto_g30_position(cm.gn.target, cm.gf.target); break;} // G30
case NEXT_ACTION_SEARCH_HOME: { status = cm_homing_cycle_start(); break;} // G28.2
case NEXT_ACTION_SET_ABSOLUTE_ORIGIN: { status = cm_set_absolute_origin(cm.gn.target, cm.gf.target); break;}// G28.3
case NEXT_ACTION_HOMING_NO_SET: { status = cm_homing_cycle_start_no_set(); break;} // G28.4
case NEXT_ACTION_SEARCH_HOME: { status = cm_homing_cycle_start(); break;} // G28.2
case NEXT_ACTION_SET_ABSOLUTE_ORIGIN: { status = cm_set_absolute_origin(cm.gn.target, cm.gf.target); break;}// G28.3
case NEXT_ACTION_HOMING_NO_SET: { status = cm_homing_cycle_start_no_set(); break;} // G28.4
case NEXT_ACTION_STRAIGHT_PROBE: { status = cm_straight_probe(cm.gn.target, cm.gf.target); break;} // G38.2
case NEXT_ACTION_STRAIGHT_PROBE: { status = cm_straight_probe(cm.gn.target, cm.gf.target); break;} // G38.2
case NEXT_ACTION_SET_COORD_DATA: { status = cm_set_coord_offsets(cm.gn.parameter, cm.gn.L_word, cm.gn.target, cm.gf.target); break;}
case NEXT_ACTION_SET_ORIGIN_OFFSETS: { status = cm_set_origin_offsets(cm.gn.target, cm.gf.target); break;}
case NEXT_ACTION_RESET_ORIGIN_OFFSETS: { status = cm_reset_origin_offsets(); break;}
case NEXT_ACTION_SET_COORD_DATA: { status = cm_set_coord_offsets(cm.gn.parameter, cm.gn.L_word, cm.gn.target, cm.gf.target); break;}
case NEXT_ACTION_SET_ORIGIN_OFFSETS: { status = cm_set_origin_offsets(cm.gn.target, cm.gf.target); break;}
case NEXT_ACTION_RESET_ORIGIN_OFFSETS: { status = cm_reset_origin_offsets(); break;}
case NEXT_ACTION_SUSPEND_ORIGIN_OFFSETS: { status = cm_suspend_origin_offsets(); break;}
case NEXT_ACTION_RESUME_ORIGIN_OFFSETS: { status = cm_resume_origin_offsets(); break;}
case NEXT_ACTION_RESUME_ORIGIN_OFFSETS: { status = cm_resume_origin_offsets(); break;}
case NEXT_ACTION_DEFAULT: {
cm_set_absolute_override(MODEL, cm.gn.absolute_override); // apply override setting to gm struct
switch (cm.gn.motion_mode) {
case MOTION_MODE_CANCEL_MOTION_MODE: { cm.gm.motion_mode = cm.gn.motion_mode; break;}
case MOTION_MODE_STRAIGHT_TRAVERSE: { status = cm_straight_traverse(cm.gn.target, cm.gf.target); break;}
case MOTION_MODE_STRAIGHT_FEED: { status = cm_straight_feed(cm.gn.target, cm.gf.target); break;}
case MOTION_MODE_STRAIGHT_TRAVERSE: { status = cm_straight_traverse(cm.gn.target, cm.gf.target); break;}
case MOTION_MODE_STRAIGHT_FEED: { status = cm_straight_feed(cm.gn.target, cm.gf.target); break;}
case MOTION_MODE_CW_ARC:
case MOTION_MODE_CCW_ARC: { status = cm_arc_feed(cm.gn.target,
cm.gf.target,
+6 -6
View File
@@ -154,7 +154,7 @@ void gpio_set_homing_mode(const uint8_t input_num_ext, const bool is_homing)
{
if (input_num_ext == 0) {
return;
}
}
io.in[input_num_ext-1].homing_mode = is_homing;
}
@@ -162,7 +162,7 @@ void gpio_set_probing_mode(const uint8_t input_num_ext, const bool is_probing)
{
if (input_num_ext == 0) {
return;
}
}
io.in[input_num_ext-1].probing_mode = is_probing;
}
@@ -170,7 +170,7 @@ bool gpio_read_input(const uint8_t input_num_ext)
{
if (input_num_ext == 0) {
return false;
}
}
return (io.in[input_num_ext-1].state);
}
@@ -245,16 +245,16 @@ void static _handle_pin_changed(const uint8_t input_num_ext, const int8_t pin_va
if (in->edge == INPUT_EDGE_LEADING) { // we only want the leading edge to fire
en_take_encoder_snapshot();
cm_start_hold();
}
}
return;
}
// perform probing operations if in probing mode
if (in->probing_mode) {
if (in->edge == INPUT_EDGE_LEADING) { // we only want the leading edge to fire
en_take_encoder_snapshot();
cm_start_hold();
}
}
return;
}
+5 -5
View File
@@ -258,7 +258,7 @@ stat_t mp_runtime_command(mpBuf_t *bf)
bf->cm_func(bf->value_vector, bf->flag_vector); // 2 vectors used by callbacks
if (mp_free_run_buffer()) {
cm_cycle_end(); // free buffer & perform cycle_end if planner is empty
}
}
return (STAT_OK);
}
@@ -290,7 +290,7 @@ static stat_t _exec_dwell(mpBuf_t *bf)
st_prep_dwell((uint32_t)(bf->gm.move_time * 1000000.0));// convert seconds to uSec
if (mp_free_run_buffer()) {
cm_cycle_end(); // free buffer & perform cycle_end if planner is empty
}
}
return (STAT_OK);
}
@@ -458,8 +458,8 @@ mpBuf_t * mp_get_run_buffer()
mb.r->buffer_state = MP_BUFFER_RUNNING;
mb.needs_time_accounting = true;
}
// This is the one point where an accurate accounting of the total time in the
// This is the one point where an accurate accounting of the total time in the
// run and the planner is established. _planner_time_accounting() also performs
// the locking of planner buffers to ensure that sufficient "safe" time is reserved.
_planner_time_accounting();
@@ -605,7 +605,7 @@ bool mp_is_it_phat_city_time() {
return ((time_in_planner <= 0) || (PHAT_CITY_TIME < time_in_planner));
}
static void _planner_time_accounting()
static void _planner_time_accounting()
{
// if (((mb.time_in_run + mb.time_locked) > MIN_PLANNED_TIME) && !mb.needs_time_accounting)
// return;
+3 -3
View File
@@ -81,7 +81,7 @@
#define XIO_ENABLE_ECHO false
#define XIO_ENABLE_FLOW_CONTROL FLOW_CONTROL_XON // FLOW_CONTROL_OFF, FLOW_CONTROL_XON, FLOW_CONTROL_RTS
#define JSON_VERBOSITY JV_CONFIGS // one of: JV_SILENT, JV_FOOTER, JV_CONFIGS, JV_MESSAGES, JV_LINENUM, JV_VERBOSE
#define JSON_VERBOSITY JV_MESSAGES // one of: JV_SILENT, JV_FOOTER, JV_CONFIGS, JV_MESSAGES, JV_LINENUM, JV_VERBOSE
#define JSON_SYNTAX_MODE JSON_SYNTAX_STRICT // one of JSON_SYNTAX_RELAXED, JSON_SYNTAX_STRICT
#define QUEUE_REPORT_VERBOSITY QR_SINGLE // one of: QR_OFF, QR_SINGLE, QR_TRIPLE
@@ -182,8 +182,8 @@
// *** 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 JERK_HIGH_SPEED 2000
#define JERK_HIGH_SPEED 1000 // 1000 million mm/(min^3) // Jerk during homing needs to stop *fast*
//#define JERK_HIGH_SPEED 2000
#define LATCH_VELOCITY 25 // reeeeally slow for accuracy
#define JUNCTION_DEVIATION_XY 0.01 // larger is faster
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -38,7 +38,7 @@
/****** REVISIONS ******/
#ifndef TINYG_FIRMWARE_BUILD
#define TINYG_FIRMWARE_BUILD 083.15 // merged spindle fixes in
#define TINYG_FIRMWARE_BUILD 083.18 // changes to jogging function to agree with OMC production
#endif
#define TINYG_FIRMWARE_VERSION 0.98 // firmware major version