From 08baabc63cd74ba18ca633a58c482934c4b305cc Mon Sep 17 00:00:00 2001 From: Sonny Jeon Date: Thu, 28 Mar 2013 10:11:34 -0600 Subject: [PATCH] Minor updates to code and commenting. --- gcode.c | 16 +++++++++------- limits.c | 22 ++++++++-------------- motion_control.c | 13 ++++++++++--- stepper.c | 7 +++---- 4 files changed, 30 insertions(+), 28 deletions(-) diff --git a/gcode.c b/gcode.c index b52de4b..b17a34a 100644 --- a/gcode.c +++ b/gcode.c @@ -77,8 +77,9 @@ static float to_millimeters(float value) // Executes one line of 0-terminated G-Code. The line is assumed to contain only uppercase // characters and signed floating point values (no whitespace). Comments and block delete -// characters have been removed. All units and positions are converted and exported to grbl's -// internal functions in terms of (mm, mm/min) and absolute machine coordinates, respectively. +// characters have been removed. In this function, all units and positions are converted and +// exported to grbl's internal functions in terms of (mm, mm/min) and absolute machine +// coordinates, respectively. uint8_t gc_execute_line(char *line) { @@ -203,7 +204,10 @@ uint8_t gc_execute_line(char *line) /* Pass 2: Parameters. All units converted according to current block commands. Position parameters are converted and flagged to indicate a change. These can have multiple connotations - for different commands. Each will be converted to their proper value upon execution. */ + for different commands. Each will be converted to their proper value upon execution. + NOTE: Grbl unconventionally pre-converts these parameter values based on the block G and M + commands. This is set out of the order of execution defined by NIST only for code efficiency/size + purposes, but should not affect proper g-code execution. */ float p = 0, r = 0; uint8_t l = 0; char_counter = 0; @@ -242,10 +246,8 @@ uint8_t gc_execute_line(char *line) if (gc.status_code) { return(gc.status_code); } - /* Execute Commands: Perform by order of execution defined in NIST RS274-NGC.v3, Table 8, pg.41. - NOTE: Independent non-motion/settings parameters are set out of this order for code efficiency - and simplicity purposes, but this should not affect proper g-code execution. */ - + /* Execute Commands: Perform by order of execution defined in NIST RS274-NGC.v3, Table 8, pg.41. */ + // ([F]: Set feed rate.) if (sys.state != STATE_CHECK_MODE) { diff --git a/limits.c b/limits.c index a235057..3507785 100644 --- a/limits.c +++ b/limits.c @@ -96,22 +96,16 @@ static void homing_cycle(uint8_t cycle_mask, int8_t pos_dir, bool invert_pin, fl // and speedy homing routine. // NOTE: For each axes enabled, the following calculations assume they physically move // an equal distance over each time step until they hit a limit switch, aka dogleg. - uint32_t steps[N_AXIS]; - uint8_t dist = 0; + uint32_t step_event_count, steps[N_AXIS]; + uint8_t i, dist = 0; clear_vector(steps); - if (cycle_mask & (1<rate_delta) { st_go_idle(); bit_true(sys.execute,EXEC_CYCLE_STOP); - busy = false; return; } } @@ -330,7 +329,7 @@ void st_init() TCNT2 = 0; // Clear Timer2 counter TCCR2A = (1<