Skip to content

Commit beaa405

Browse files
committed
Tidying up parking override control implementation
[new] Added a default configuration for the parking override control upon a reset or power-up. By default, parking is enabled, but this may be disabled via a config.h option. [fix] Parking override control should be checking if the command word is passed, rather than the value.
1 parent e455764 commit beaa405

File tree

7 files changed

+77
-11
lines changed

7 files changed

+77
-11
lines changed

doc/log/commit_log_v1.1.txt

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,56 @@
1+
----------------
2+
Date: 2017-01-28
3+
Author: chamnit
4+
Subject: v1.1f. Parking override control. Spindle enable pin option.
5+
6+
[ver] v1.1f update due to tweaks to interface from new parking override
7+
control.
8+
9+
[new] Parking motion override control via new `M56 P0` and `M56 P1`
10+
command, which disables and enables the parking motion, respectively.
11+
Requires ENABLE_PARKING_OVERRIDE_CONTROL and PARKING_ENABLE enabled in
12+
config.h. Primarily for OEMs.
13+
14+
[new] `M56` appears in the $G report when enabled.
15+
16+
[new] Five new build info identification letters. Some were missing and
17+
a couple are new. Updated the CSV and documentation to reflect these
18+
new items.
19+
20+
[new] Spindle enable pin configuration option to alter its behavior
21+
based on how certain lasers work. By default, Grbl treats the enable
22+
pin separately and leaves it on when S is 0. The new option turns the
23+
enable pin on and off with S>0 and S=0. This only is in effect when a
24+
user enables the USE_SPINDLE_DIR_AS_ENABLE_PIN option.
25+
26+
[fix] M4 is now allowed to work when USE_SPINDLE_DIR_AS_ENABLE_PIN is
27+
enabled. Previously this was blocked and was problematic for laser
28+
folks using M4.
29+
30+
[fix] Properly declared system variables as extern. Not sure how that
31+
went unnoticed or why it worked up until now but it has.
32+
33+
[fix] EXTREMELY RARE. When AMASS is intentionally disabled and sent a
34+
motion command that is _one step_ in length, Grbl would not actuate the
35+
step due to numerical round-off. Applied a fix to prevent the round-off
36+
issue.
37+
38+
[fix] Added a compile-time check for AMASS settings to make sure that
39+
the numerical round-off issue doesn’t effect it. This would only happen
40+
if someone set AMASS max levels to zero. It does not effect AMASS with
41+
its current defaults.
42+
43+
[fix] Wrapped the mc_parking_motion() function in an ifdef for porting
44+
purposes.
45+
46+
[fix] Fixed an issue when in inverse time mode and G0’s would require a
47+
F word. This was not correct.
48+
49+
[fix] Added a note in the defaults.h file that MAX_TRAVEL values must
50+
be positive. Some users were setting this negative and it was causing
51+
issues.
52+
53+
154
----------------
255
Date: 2017-01-14
356
Author: Sonny Jeon

grbl/config.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -575,8 +575,10 @@
575575
// These are controlled by `M56`, `M56 P1`, or `M56 Px` to enable and `M56 P0` to disable.
576576
// The command is modal and will be set after a planner sync. Since it is g-code, it is
577577
// executed in sync with g-code commands. It is not a real-time command.
578-
// NOTE: PARKING_ENABLE is required.
578+
// NOTE: PARKING_ENABLE is required. By default, M56 is active upon initialization. Use
579+
// DEACTIVATE_PARKING_UPON_INIT to set M56 P0 as the power-up default.
579580
// #define ENABLE_PARKING_OVERRIDE_CONTROL // Default disabled. Uncomment to enable
581+
// #define DEACTIVATE_PARKING_UPON_INIT // Default disabled. Uncomment to enable.
580582

581583
// This option will automatically disable the laser during a feed hold by invoking a spindle stop
582584
// override immediately after coming to a stop. However, this also means that the laser still may

grbl/gcode.c

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -437,7 +437,7 @@ uint8_t gc_execute_line(char *line)
437437
// [8. Coolant control ]: N/A
438438
// [9. Override control ]: Not supported except for a Grbl-only parking motion override control.
439439
#ifdef ENABLE_PARKING_OVERRIDE_CONTROL
440-
if (gc_block.modal.override == OVERRIDE_PARKING_MOTION) {
440+
if (bit_istrue(command_words,bit(MODAL_GROUP_M9))) { // Already set as enabled in parser.
441441
if (bit_istrue(value_words,bit(WORD_P))) {
442442
if (gc_block.values.p == 0.0) { gc_block.modal.override = OVERRIDE_DISABLED; }
443443
bit_false(value_words,bit(WORD_P));
@@ -1102,7 +1102,13 @@ uint8_t gc_execute_line(char *line)
11021102
gc_state.modal.coord_select = 0; // G54
11031103
gc_state.modal.spindle = SPINDLE_DISABLE;
11041104
gc_state.modal.coolant = COOLANT_DISABLE;
1105-
// gc_state.modal.override = OVERRIDE_DISABLE; // Not supported.
1105+
#ifdef ENABLE_PARKING_OVERRIDE_CONTROL
1106+
#ifdef DEACTIVATE_PARKING_UPON_INIT
1107+
gc_state.modal.override = OVERRIDE_DISABLED;
1108+
#else
1109+
gc_state.modal.override = OVERRIDE_PARKING_MOTION;
1110+
#endif
1111+
#endif
11061112

11071113
#ifdef RESTORE_OVERRIDES_AFTER_PROGRAM_END
11081114
sys.f_override = DEFAULT_FEED_OVERRIDE;
@@ -1148,7 +1154,7 @@ uint8_t gc_execute_line(char *line)
11481154
group 7 = {G41, G42} cutter radius compensation (G40 is supported)
11491155
group 8 = {G43} tool length offset (G43.1/G49 are supported)
11501156
group 8 = {M7*} enable mist coolant (* Compile-option)
1151-
group 9 = {M48, M49} enable/disable feed and speed override switches
1157+
group 9 = {M48, M49, M56*} enable/disable override switches (* Compile-option)
11521158
group 10 = {G98, G99} return mode canned cycles
11531159
group 13 = {G61.1, G64} path control mode (G61 is supported)
11541160
*/

grbl/gcode.h

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,8 +124,13 @@
124124
#define TOOL_LENGTH_OFFSET_ENABLE_DYNAMIC 1 // G43.1
125125

126126
// Modal Group M9: Override control
127-
#define OVERRIDE_DISABLED 0 // None (Default: Must be zero)
128-
#define OVERRIDE_PARKING_MOTION 1 // G56 (Default: Must be zero)
127+
#ifdef DEACTIVATE_PARKING_UPON_INIT
128+
#define OVERRIDE_DISABLED 0 // (Default: Must be zero)
129+
#define OVERRIDE_PARKING_MOTION 1 // M56
130+
#else
131+
#define OVERRIDE_PARKING_MOTION 0 // M56 (Default: Must be zero)
132+
#define OVERRIDE_DISABLED 1 // Parking disabled.
133+
#endif
129134

130135
// Modal Group G12: Active work coordinate system
131136
// N/A: Stores coordinate system value (54-59) to change to.

grbl/grbl.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323

2424
// Grbl versioning system
2525
#define GRBL_VERSION "1.1f"
26-
#define GRBL_VERSION_BUILD "20170128"
26+
#define GRBL_VERSION_BUILD "20170129"
2727

2828
// Define standard libraries used by Grbl.
2929
#include <avr/io.h>

grbl/protocol.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -579,7 +579,7 @@ static void protocol_exec_rt_suspend()
579579
if ((bit_istrue(settings.flags,BITFLAG_HOMING_ENABLE)) &&
580580
(parking_target[PARKING_AXIS] < PARKING_TARGET) &&
581581
bit_isfalse(settings.flags,BITFLAG_LASER_MODE) &&
582-
!sys.override_ctrl) {
582+
(sys.override_ctrl == OVERRIDE_PARKING_MOTION)) {
583583
#else
584584
if ((bit_istrue(settings.flags,BITFLAG_HOMING_ENABLE)) &&
585585
(parking_target[PARKING_AXIS] < PARKING_TARGET) &&
@@ -650,7 +650,7 @@ static void protocol_exec_rt_suspend()
650650
// NOTE: State is will remain DOOR, until the de-energizing and retract is complete.
651651
#ifdef ENABLE_PARKING_OVERRIDE_CONTROL
652652
if (((settings.flags & (BITFLAG_HOMING_ENABLE|BITFLAG_LASER_MODE)) == BITFLAG_HOMING_ENABLE) &&
653-
!sys.override_ctrl) {
653+
(sys.override_ctrl == OVERRIDE_PARKING_MOTION)) {
654654
#else
655655
if ((settings.flags & (BITFLAG_HOMING_ENABLE|BITFLAG_LASER_MODE)) == BITFLAG_HOMING_ENABLE) {
656656
#endif
@@ -689,7 +689,7 @@ static void protocol_exec_rt_suspend()
689689
// Execute slow plunge motion from pull-out position to resume position.
690690
#ifdef ENABLE_PARKING_OVERRIDE_CONTROL
691691
if (((settings.flags & (BITFLAG_HOMING_ENABLE|BITFLAG_LASER_MODE)) == BITFLAG_HOMING_ENABLE) &&
692-
!sys.override_ctrl) {
692+
(sys.override_ctrl == OVERRIDE_PARKING_MOTION)) {
693693
#else
694694
if ((settings.flags & (BITFLAG_HOMING_ENABLE|BITFLAG_LASER_MODE)) == BITFLAG_HOMING_ENABLE) {
695695
#endif

grbl/report.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,7 @@ void report_gcode_modes()
328328
#endif
329329

330330
#ifdef ENABLE_PARKING_OVERRIDE_CONTROL
331-
if (sys.override_ctrl) {
331+
if (sys.override_ctrl == OVERRIDE_PARKING_MOTION) {
332332
report_util_gcode_modes_M();
333333
print_uint8_base10(56);
334334
}

0 commit comments

Comments
 (0)