From 97d18f0ffe76f7943b2b2cb907e3bcb12f910a89 Mon Sep 17 00:00:00 2001 From: Sonny Jeon Date: Fri, 18 Jan 2013 17:02:44 -0700 Subject: [PATCH] Merge bug fixes from recent v0.8c push. Added readme for Grbl Sim. --- README.md | 1 + limits.c | 3 +-- motion_control.c | 2 ++ report.c | 3 ++- sim/README.md | 11 +++++++++++ 5 files changed, 17 insertions(+), 3 deletions(-) create mode 100644 sim/README.md diff --git a/README.md b/README.md index 511f6c9..88bd4fb 100644 --- a/README.md +++ b/README.md @@ -16,6 +16,7 @@ Grbl includes full acceleration management with look ahead. That means the contr - Acceleration independence: Each axes may be defined with different acceleration parameters and Grbl will automagically calculate the maximum acceleration through a path depending on the direction traveled. This is very useful for machine that have very different axes properties, like the ShapeOko z-axis. - Maximum velocity independence: As with acceleration, the maximum velocity of individual axes may be defined. All seek/rapids motions will move at these maximum rates, but never exceed any one axes. So, when two or more axes move, the limiting axis will move at its maximum rate, while the other axes are scaled down. - Significantly improved arc performance: Arcs are now defined in terms of chordal tolerance, rather than segment length. Chordal tolerance will automatically scale all arc line segments depending on arc radius, such that the error does not exceed the tolerance value (default: 0.005 mm.) So, for larger radii arcs, Grbl can move faster through them, because the segments are always longer and the planner has more distance to plan with. + - New Grbl SIMULATOR by @jgeisler: A completely independent wrapper of the Grbl main source code that may be compiled as an executable on a computer. No Arduino required. Simply simulates the responses of Grbl as if it was on an Arduino. May be used for many things: checking out how Grbl works, pre-process moves for GUI graphics, debugging of new features, etc. Much left to do, but potentially very powerful, as the dummy AVR variables can be written to output anything you need. - Feedrate overrides: In the works, but planner has begun to be re-factored for this feature. - Jogging controls: Methodology needs to be to figured out first. Last item on the agenda. diff --git a/limits.c b/limits.c index efcc73b..1da9c54 100644 --- a/limits.c +++ b/limits.c @@ -187,8 +187,7 @@ static void homing_cycle(uint8_t cycle_mask, int8_t pos_dir, bool invert_pin, fl } // Check if we are done or for system abort - protocol_execute_runtime(); - if (!(cycle_mask) || sys.abort) { return; } + if (!(cycle_mask) || (sys.execute & EXEC_RESET)) { return; } // Perform step. STEPPING_PORT = (STEPPING_PORT & ~STEP_MASK) | (out_bits & STEP_MASK); diff --git a/motion_control.c b/motion_control.c index c8571f0..ca23c87 100644 --- a/motion_control.c +++ b/motion_control.c @@ -226,6 +226,8 @@ void mc_go_home() LIMIT_PCMSK &= ~LIMIT_MASK; // Disable hard limits pin change register for cycle duration limits_go_home(); // Perform homing routine. + + protocol_execute_runtime(); // Check for reset and set system abort. if (sys.abort) { return; } // Did not complete. Alarm state set by mc_alarm. // The machine should now be homed and machine zero has been located. Upon completion, diff --git a/report.c b/report.c index 0ab85b3..6b810ad 100644 --- a/report.c +++ b/report.c @@ -90,6 +90,7 @@ void report_alarm_message(int8_t alarm_code) printPgmString(PSTR("Abort during cycle")); break; } printPgmString(PSTR(". MPos?\r\n")); + delay_ms(500); // Force delay to ensure message clears serial write buffer. } // Prints feedback messages. This serves as a centralized method to provide additional @@ -326,7 +327,7 @@ void report_realtime_status() print_position[i] -= gc.coord_system[i]+gc.coord_offset[i]; } printFloat(print_position[i]); - if (i < N_AXIS-1) { printPgmString(PSTR(",")); } + if (i < (N_AXIS-1)) { printPgmString(PSTR(",")); } } printPgmString(PSTR(">\r\n")); diff --git a/sim/README.md b/sim/README.md new file mode 100644 index 0000000..6e266b4 --- /dev/null +++ b/sim/README.md @@ -0,0 +1,11 @@ +GRBL SIM : by Jens Geisler + +This directory contains an experimental Grbl simulator that compiles the main Grbl source code into a wrapped executable for use on a computer. No Arduino required. When the executable is run, the user should be able to interact with the Grbl simulator as if connected to an Arduino with Grbl. + +WARNING: Grbl Sim is under heavy development. So many things may not work, or respond in ways unexpected. At the moment, this code is a proof-of-concept. + +What can you do with Grbl Sim? +- Simply checking out how Grbl works without needing an Arduino. +- Visualize a g-code program by having the simulator parse and execute to a GUI. Fluctuations in feed rates by the acceleration planner can be viewed as well. +- A powerful debugging tool for development. +- Each of the AVR functions are replaced with dummy functions, like the stepper ISR. These could be written to whatever you need. For example, output simulated step pulses over time and examine its performance.