Skip to content

Commit

Permalink
Bug fixes.
Browse files Browse the repository at this point in the history
- G38.x was not printing correctly in the $G g-code state reports. Now
fixed.

- When investigating the above issue, it was noticed that G38.x
wouldn’t show at all, but instead a G0 would be printed. This was
unlike the v0.9j master build. It turned out volatile variables do not
like to be defined inside a C struct. These are undefined on how to be
handled. Once pulled out, all weird issues went away.

- Also changed two ‘sizeof()’ statements in the mc_probe() and
probe_state_monitor() functions to be more robust later on.

- Updated the commit logs to individual files for each minor release.
Forgot to update the generating script to account for this.
  • Loading branch information
chamnit committed Oct 1, 2015
2 parents dade712 + d226555 commit b9c3461
Show file tree
Hide file tree
Showing 15 changed files with 183 additions and 142 deletions.
80 changes: 0 additions & 80 deletions doc/log/commit_log_v0.9i.txt
Original file line number Diff line number Diff line change
@@ -1,83 +1,3 @@
----------------
Date: 2015-09-05
Author: Sonny Jeon
Subject: Parking motion bug fix.

- Parking motion would intermittently complete the queued tool path
upon resuming in certain scenarios. Now fixed.


----------------
Date: 2015-08-29
Author: Sonny Jeon
Subject: Optional line number reporting bug fix.

- Fixed a bug where it would not compile when USE_LINE_NUMBERS was
enabled.


----------------
Date: 2015-08-27
Author: Sonny Jeon
Subject: Update README


----------------
Date: 2015-08-27
Author: Sonny Jeon
Subject: v1.0 Beta Release.

- Tons of new stuff in this release, which is fairly stable and well
tested. However, much more is coming soon!

- Real-time parking motion with safety door. When this compile option
is enabled, an opened safety door will cause Grbl to automatically feed
hold, retract, de-energize the spindle/coolant, and parks near Z max.
After the door is closed and resume is commanded, this reverses and the
program continues as if nothing happened. This is also highly
configurable. See config.h for details.

- New spindle max and min rpm ‘$’ settings! This has been requested
often. Grbl will output 5V when commanded to turn on the spindle at its
max rpm, and 0.02V with min rpm. The voltage and the rpm range are
linear to each other. This should help users tweak their settings to
get close to true rpm’s.

- If the new max rpm ‘$’ setting is set = 0 or less than min rpm, the
spindle speed PWM pin will act like a regular on/off spindle enable
pin. On pin D11.

- BEWARE: Your old EEPROM settings will be wiped! The new spindle rpm
settings require a new settings version, so Grbl will automatically
wipe and restore the EEPROM with the new defaults.

- Control pin can now be inverted individually with a
CONTROL_INVERT_MASK in the cpu_map header file. Not typical for users
to need this, but handy to have.

- Fixed bug when Grbl receive too many characters in a line and
overflows. Previously it would respond with an error per overflow
character and another acknowledge upon an EOL character. This broke the
streaming protocol. Now fixed to only respond with an error after an
EOL character.

- Fixed a bug with the safety door during an ALARM mode. You now can’t
home or unlock the axes until the safety door has been closed. This is
for safety reasons (obviously.)

- Tweaked some the Mega2560 cpu_map settings . Increased segment buffer
size and fixed the spindle PWM settings to output at a higher PWM
frequency.

- Generalized the delay function used by G4 delay for use by parking
motion. Allows non-blocking status reports and real-time control during
re-energizing of the spindle and coolant.

- Added spindle rpm max and min defaults to default.h files.

- Added a new print float for rpm values.


----------------
Date: 2015-08-14
Author: Sonny Jeon
Expand Down
17 changes: 17 additions & 0 deletions doc/log/commit_log_v0.9j.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
----------------
Date: 2015-08-14
Author: Sonny Jeon
Subject: Individual control pin invert compile-option.

- Control pins may be individually inverted through a
CONTROL_INVERT_MASK macro. This mask is define in the cpu_map.h file.


----------------
Date: 2015-07-17
Author: Sonny Jeon
Subject: Version bump to v0.9j

- Version bump requested by OEMs to easily determine whether the
firmware supports the new EEPROM reset feature. Other than that, no
significant changes.
104 changes: 104 additions & 0 deletions doc/log/commit_log_v1.0b.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
----------------
Date: 2015-09-24
Author: Sonny Jeon
Subject: Updated G28/G30 intermediate motion behavior.

- G28 and G30’s behavior has been updated from the old NIST g-code
standard to LinuxCNC’s. Previously when an intermediate motion was
programmed, the NIST standard would move all axes to the final G28/30
stored coordinates. LinuxCNC states it only moves the axes specified in
the command.

For example, suppose G28’s stored position is (x,y,z) = (1,2,3) for
simplicity, and we want to do an automated z-axis tool retraction and
then park at the x,y location. `G28 G91 Z5` will first move the Z axis
5mm(or inches) up, then move Z to position 3 in machine coordinates.
Next, the command `G28 G91 X0 Y0` would skip the intermediate move
since distance is zero, but then move only the x and y axes to machine
coordinates 1 and 2, respectively. The z-axis wouldn’t move in this
case, since it wasn’t specified.

This change is intended to make Grbl more LinuxCNC compatible while
making commands, like the shown tool retraction, much easier to
implement.


----------------
Date: 2015-09-05
Author: Sonny Jeon
Subject: Parking motion bug fix.

- Parking motion would intermittently complete the queued tool path
upon resuming in certain scenarios. Now fixed.


----------------
Date: 2015-08-29
Author: Sonny Jeon
Subject: Optional line number reporting bug fix.

- Fixed a bug where it would not compile when USE_LINE_NUMBERS was
enabled.


----------------
Date: 2015-08-27
Author: Sonny Jeon
Subject: Update README


----------------
Date: 2015-08-27
Author: Sonny Jeon
Subject: v1.0 Beta Release.

- Tons of new stuff in this release, which is fairly stable and well
tested. However, much more is coming soon!

- Real-time parking motion with safety door. When this compile option
is enabled, an opened safety door will cause Grbl to automatically feed
hold, retract, de-energize the spindle/coolant, and parks near Z max.
After the door is closed and resume is commanded, this reverses and the
program continues as if nothing happened. This is also highly
configurable. See config.h for details.

- New spindle max and min rpm ‘$’ settings! This has been requested
often. Grbl will output 5V when commanded to turn on the spindle at its
max rpm, and 0.02V with min rpm. The voltage and the rpm range are
linear to each other. This should help users tweak their settings to
get close to true rpm’s.

- If the new max rpm ‘$’ setting is set = 0 or less than min rpm, the
spindle speed PWM pin will act like a regular on/off spindle enable
pin. On pin D11.

- BEWARE: Your old EEPROM settings will be wiped! The new spindle rpm
settings require a new settings version, so Grbl will automatically
wipe and restore the EEPROM with the new defaults.

- Control pin can now be inverted individually with a
CONTROL_INVERT_MASK in the cpu_map header file. Not typical for users
to need this, but handy to have.

- Fixed bug when Grbl receive too many characters in a line and
overflows. Previously it would respond with an error per overflow
character and another acknowledge upon an EOL character. This broke the
streaming protocol. Now fixed to only respond with an error after an
EOL character.

- Fixed a bug with the safety door during an ALARM mode. You now can’t
home or unlock the axes until the safety door has been closed. This is
for safety reasons (obviously.)

- Tweaked some the Mega2560 cpu_map settings . Increased segment buffer
size and fixed the spindle PWM settings to output at a higher PWM
frequency.

- Generalized the delay function used by G4 delay for use by parking
motion. Allows non-blocking status reports and real-time control during
re-energizing of the spindle and coolant.

- Added spindle rpm max and min defaults to default.h files.

- Added a new print float for rpm values.

2 changes: 1 addition & 1 deletion grbl/gcode.c
Original file line number Diff line number Diff line change
Expand Up @@ -1044,7 +1044,7 @@ uint8_t gc_execute_line(char *line)
protocol_buffer_synchronize(); // Sync and finish all remaining buffered motions before moving on.
if (gc_state.modal.program_flow == PROGRAM_FLOW_PAUSED) {
if (sys.state != STATE_CHECK_MODE) {
bit_true_atomic(sys.rt_exec_state, EXEC_FEED_HOLD); // Use feed hold for program pause.
bit_true_atomic(sys_rt_exec_state, EXEC_FEED_HOLD); // Use feed hold for program pause.
protocol_execute_realtime(); // Execute suspend.
}
} else { // == PROGRAM_FLOW_COMPLETED
Expand Down
2 changes: 1 addition & 1 deletion grbl/grbl.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

// Grbl versioning system
#define GRBL_VERSION "1.0b"
#define GRBL_VERSION_BUILD "20150924"
#define GRBL_VERSION_BUILD "20150930"

// Define standard libraries used by Grbl.
#include <avr/io.h>
Expand Down
22 changes: 11 additions & 11 deletions grbl/limits.c
Original file line number Diff line number Diff line change
Expand Up @@ -101,16 +101,16 @@ uint8_t limits_get_state()
// locked out until a homing cycle or a kill lock command. Allows the user to disable the hard
// limit setting if their limits are constantly triggering after a reset and move their axes.
if (sys.state != STATE_ALARM) {
if (!(sys.rt_exec_alarm)) {
if (!(sys_rt_exec_alarm)) {
#ifdef HARD_LIMIT_FORCE_STATE_CHECK
// Check limit pin state.
if (limits_get_state()) {
mc_reset(); // Initiate system kill.
bit_true_atomic(sys.rt_exec_alarm, (EXEC_ALARM_HARD_LIMIT|EXEC_CRITICAL_EVENT)); // Indicate hard limit critical event
bit_true_atomic(sys_rt_exec_alarm, (EXEC_ALARM_HARD_LIMIT|EXEC_CRITICAL_EVENT)); // Indicate hard limit critical event
}
#else
mc_reset(); // Initiate system kill.
bit_true_atomic(sys.rt_exec_alarm, (EXEC_ALARM_HARD_LIMIT|EXEC_CRITICAL_EVENT)); // Indicate hard limit critical event
bit_true_atomic(sys_rt_exec_alarm, (EXEC_ALARM_HARD_LIMIT|EXEC_CRITICAL_EVENT)); // Indicate hard limit critical event
#endif
}
}
Expand All @@ -122,11 +122,11 @@ uint8_t limits_get_state()
{
WDTCSR &= ~(1<<WDIE); // Disable watchdog timer.
if (sys.state != STATE_ALARM) { // Ignore if already in alarm state.
if (!(sys.rt_exec_alarm)) {
if (!(sys_rt_exec_alarm)) {
// Check limit pin state.
if (limits_get_state()) {
mc_reset(); // Initiate system kill.
bit_true_atomic(sys.rt_exec_alarm, (EXEC_ALARM_HARD_LIMIT|EXEC_CRITICAL_EVENT)); // Indicate hard limit critical event
bit_true_atomic(sys_rt_exec_alarm, (EXEC_ALARM_HARD_LIMIT|EXEC_CRITICAL_EVENT)); // Indicate hard limit critical event
}
}
}
Expand Down Expand Up @@ -225,17 +225,17 @@ void limits_go_home(uint8_t cycle_mask)
st_prep_buffer(); // Check and prep segment buffer. NOTE: Should take no longer than 200us.

// Exit routines: No time to run protocol_execute_realtime() in this loop.
if (sys.rt_exec_state & (EXEC_SAFETY_DOOR | EXEC_RESET | EXEC_CYCLE_STOP)) {
if (sys_rt_exec_state & (EXEC_SAFETY_DOOR | EXEC_RESET | EXEC_CYCLE_STOP)) {
// Homing failure: Limit switches are still engaged after pull-off motion
if ( (sys.rt_exec_state & (EXEC_SAFETY_DOOR | EXEC_RESET)) || // Safety door or reset issued
if ( (sys_rt_exec_state & (EXEC_SAFETY_DOOR | EXEC_RESET)) || // Safety door or reset issued
(!approach && (limits_get_state() & cycle_mask)) || // Limit switch still engaged after pull-off motion
( approach && (sys.rt_exec_state & EXEC_CYCLE_STOP)) ) { // Limit switch not found during approach.
( approach && (sys_rt_exec_state & EXEC_CYCLE_STOP)) ) { // Limit switch not found during approach.
mc_reset(); // Stop motors, if they are running.
protocol_execute_realtime();
return;
} else {
// Pull-off motion complete. Disable CYCLE_STOP from executing.
bit_false_atomic(sys.rt_exec_state,EXEC_CYCLE_STOP);
bit_false_atomic(sys_rt_exec_state,EXEC_CYCLE_STOP);
break;
}
}
Expand Down Expand Up @@ -335,15 +335,15 @@ void limits_soft_check(float *target)
// workspace volume so just come to a controlled stop so position is not lost. When complete
// enter alarm mode.
if (sys.state == STATE_CYCLE) {
bit_true_atomic(sys.rt_exec_state, EXEC_FEED_HOLD);
bit_true_atomic(sys_rt_exec_state, EXEC_FEED_HOLD);
do {
protocol_execute_realtime();
if (sys.abort) { return; }
} while ( sys.state != STATE_IDLE );
}

mc_reset(); // Issue system reset and ensure spindle and coolant are shutdown.
bit_true_atomic(sys.rt_exec_alarm, (EXEC_ALARM_SOFT_LIMIT|EXEC_CRITICAL_EVENT)); // Indicate soft limit critical event
bit_true_atomic(sys_rt_exec_alarm, (EXEC_ALARM_SOFT_LIMIT|EXEC_CRITICAL_EVENT)); // Indicate soft limit critical event
protocol_execute_realtime(); // Execute to enter critical event loop and system abort
return;
}
Expand Down
4 changes: 2 additions & 2 deletions grbl/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,8 @@ int main(void)

// Reset system variables.
sys.abort = false;
sys.rt_exec_state = 0;
sys.rt_exec_alarm = 0;
sys_rt_exec_state = 0;
sys_rt_exec_alarm = 0;
sys.suspend = false;

// Start Grbl main loop. Processes program inputs and executes them.
Expand Down
24 changes: 12 additions & 12 deletions grbl/motion_control.c
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ void mc_homing_cycle()
#ifdef LIMITS_TWO_SWITCHES_ON_AXES
if (limits_get_state()) {
mc_reset(); // Issue system reset and ensure spindle and coolant are shutdown.
bit_true_atomic(sys.rt_exec_alarm, (EXEC_ALARM_HARD_LIMIT|EXEC_CRITICAL_EVENT));
bit_true_atomic(sys_rt_exec_alarm, (EXEC_ALARM_HARD_LIMIT|EXEC_CRITICAL_EVENT));
return;
}
#endif
Expand Down Expand Up @@ -276,7 +276,7 @@ void mc_homing_cycle()
// After syncing, check if probe is already triggered. If so, halt and issue alarm.
// NOTE: This probe initialization error applies to all probing cycles.
if ( probe_get_state() ) { // Check probe pin state.
bit_true_atomic(sys.rt_exec_alarm, EXEC_ALARM_PROBE_FAIL);
bit_true_atomic(sys_rt_exec_alarm, EXEC_ALARM_PROBE_FAIL);
protocol_execute_realtime();
}
if (sys.abort) { return; } // Return if system reset has been issued.
Expand All @@ -289,10 +289,10 @@ void mc_homing_cycle()
#endif

// Activate the probing state monitor in the stepper module.
sys.probe_state = PROBE_ACTIVE;
sys_probe_state = PROBE_ACTIVE;

// Perform probing cycle. Wait here until probe is triggered or motion completes.
bit_true_atomic(sys.rt_exec_state, EXEC_CYCLE_START);
bit_true_atomic(sys_rt_exec_state, EXEC_CYCLE_START);
do {
protocol_execute_realtime();
if (sys.abort) { return; } // Check for system abort
Expand All @@ -301,13 +301,13 @@ void mc_homing_cycle()
// Probing cycle complete!

// Set state variables and error out, if the probe failed and cycle with error is enabled.
if (sys.probe_state == PROBE_ACTIVE) {
if (is_no_error) { memcpy(sys.probe_position, sys.position, sizeof(float)*N_AXIS); }
else { bit_true_atomic(sys.rt_exec_alarm, EXEC_ALARM_PROBE_FAIL); }
if (sys_probe_state == PROBE_ACTIVE) {
if (is_no_error) { memcpy(sys.probe_position, sys.position, sizeof(sys.position)); }
else { bit_true_atomic(sys_rt_exec_alarm, EXEC_ALARM_PROBE_FAIL); }
} else {
sys.probe_succeeded = true; // Indicate to system the probing cycle completed successfully.
}
sys.probe_state = PROBE_OFF; // Ensure probe state monitor is disabled.
sys_probe_state = PROBE_OFF; // Ensure probe state monitor is disabled.
protocol_execute_realtime(); // Check and execute run-time commands
if (sys.abort) { return; } // Check for system abort

Expand Down Expand Up @@ -365,8 +365,8 @@ void mc_parking_motion(float *parking_target, float feed_rate)
void mc_reset()
{
// Only this function can set the system reset. Helps prevent multiple kill calls.
if (bit_isfalse(sys.rt_exec_state, EXEC_RESET)) {
bit_true_atomic(sys.rt_exec_state, EXEC_RESET);
if (bit_isfalse(sys_rt_exec_state, EXEC_RESET)) {
bit_true_atomic(sys_rt_exec_state, EXEC_RESET);

// Kill spindle and coolant.
spindle_stop();
Expand All @@ -378,8 +378,8 @@ void mc_reset()
// violated, by which, all bets are off.
if ((sys.state & (STATE_CYCLE | STATE_HOMING)) ||
(sys.step_control & (STEP_CONTROL_EXECUTE_HOLD | STEP_CONTROL_EXECUTE_PARK))) {
if (sys.state == STATE_HOMING) { bit_true_atomic(sys.rt_exec_alarm, EXEC_ALARM_HOMING_FAIL); }
else { bit_true_atomic(sys.rt_exec_alarm, EXEC_ALARM_ABORT_CYCLE); }
if (sys.state == STATE_HOMING) { bit_true_atomic(sys_rt_exec_alarm, EXEC_ALARM_HOMING_FAIL); }
else { bit_true_atomic(sys_rt_exec_alarm, EXEC_ALARM_ABORT_CYCLE); }
st_go_idle(); // Force kill steppers. Position has likely been lost.
}
}
Expand Down
8 changes: 4 additions & 4 deletions grbl/probe.c
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,11 @@ uint8_t probe_get_state() { return((PROBE_PIN & PROBE_MASK) ^ probe_invert_mask)
// NOTE: This function must be extremely efficient as to not bog down the stepper ISR.
void probe_state_monitor()
{
if (sys.probe_state == PROBE_ACTIVE) {
if (sys_probe_state == PROBE_ACTIVE) {
if (probe_get_state()) {
sys.probe_state = PROBE_OFF;
memcpy(sys.probe_position, sys.position, sizeof(float)*N_AXIS);
bit_true(sys.rt_exec_state, EXEC_MOTION_CANCEL);
sys_probe_state = PROBE_OFF;
memcpy(sys.probe_position, sys.position, sizeof(sys.position));
bit_true(sys_rt_exec_state, EXEC_MOTION_CANCEL);
}
}
}
Loading

0 comments on commit b9c3461

Please sign in to comment.