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.
This commit is contained in:
		| @@ -1,3 +1,56 @@ | ||||
| ---------------- | ||||
| Date: 2017-01-28 | ||||
| Author: chamnit | ||||
| Subject: v1.1f. Parking override control. Spindle enable pin option. | ||||
|  | ||||
| [ver] v1.1f update due to tweaks to interface from new parking override | ||||
| control. | ||||
|  | ||||
| [new] Parking motion override control via new `M56 P0` and `M56 P1` | ||||
| command, which disables and enables the parking motion, respectively. | ||||
| Requires ENABLE_PARKING_OVERRIDE_CONTROL and PARKING_ENABLE enabled in | ||||
| config.h. Primarily for OEMs. | ||||
|  | ||||
| [new] `M56` appears in the $G report when enabled. | ||||
|  | ||||
| [new] Five new build info identification letters. Some were missing and | ||||
| a couple are new. Updated the CSV and documentation to reflect these | ||||
| new items. | ||||
|  | ||||
| [new] Spindle enable pin configuration option to alter its behavior | ||||
| based on how certain lasers work. By default, Grbl treats the enable | ||||
| pin separately and leaves it on when S is 0. The new option turns the | ||||
| enable pin on and off with S>0 and S=0. This only is in effect when a | ||||
| user enables the USE_SPINDLE_DIR_AS_ENABLE_PIN option. | ||||
|  | ||||
| [fix] M4 is now allowed to work when USE_SPINDLE_DIR_AS_ENABLE_PIN is | ||||
| enabled. Previously this was blocked and was problematic for laser | ||||
| folks using M4. | ||||
|  | ||||
| [fix] Properly declared system variables as extern. Not sure how that | ||||
| went unnoticed or why it worked up until now but it has. | ||||
|  | ||||
| [fix] EXTREMELY RARE. When AMASS is intentionally disabled and sent a | ||||
| motion command that is _one step_ in length, Grbl would not actuate the | ||||
| step due to numerical round-off. Applied a fix to prevent the round-off | ||||
| issue. | ||||
|  | ||||
| [fix] Added a compile-time check for AMASS settings to make sure that | ||||
| the numerical round-off issue doesn’t effect it. This would only happen | ||||
| if someone set AMASS max levels to zero. It does not effect AMASS with | ||||
| its current defaults. | ||||
|  | ||||
| [fix] Wrapped the mc_parking_motion() function in an ifdef for porting | ||||
| purposes. | ||||
|  | ||||
| [fix] Fixed an issue when in inverse time mode and G0’s would require a | ||||
| F word. This was not correct. | ||||
|  | ||||
| [fix] Added a note in the defaults.h file that MAX_TRAVEL values must | ||||
| be positive. Some users were setting this negative and it was causing | ||||
| issues. | ||||
|  | ||||
|  | ||||
| ---------------- | ||||
| Date: 2017-01-14 | ||||
| Author: Sonny Jeon | ||||
|   | ||||
| @@ -575,8 +575,10 @@ | ||||
| // These are controlled by `M56`, `M56 P1`, or `M56 Px` to enable and `M56 P0` to disable.  | ||||
| // The command is modal and will be set after a planner sync. Since it is g-code, it is  | ||||
| // executed in sync with g-code commands. It is not a real-time command. | ||||
| // NOTE: PARKING_ENABLE is required. | ||||
| // NOTE: PARKING_ENABLE is required. By default, M56 is active upon initialization. Use  | ||||
| // DEACTIVATE_PARKING_UPON_INIT to set M56 P0 as the power-up default. | ||||
| // #define ENABLE_PARKING_OVERRIDE_CONTROL   // Default disabled. Uncomment to enable | ||||
| // #define DEACTIVATE_PARKING_UPON_INIT // Default disabled. Uncomment to enable. | ||||
|  | ||||
| // This option will automatically disable the laser during a feed hold by invoking a spindle stop | ||||
| // override immediately after coming to a stop. However, this also means that the laser still may | ||||
|   | ||||
							
								
								
									
										12
									
								
								grbl/gcode.c
									
									
									
									
									
								
							
							
						
						
									
										12
									
								
								grbl/gcode.c
									
									
									
									
									
								
							| @@ -437,7 +437,7 @@ uint8_t gc_execute_line(char *line) | ||||
|   // [8. Coolant control ]: N/A | ||||
|   // [9. Override control ]: Not supported except for a Grbl-only parking motion override control. | ||||
|   #ifdef ENABLE_PARKING_OVERRIDE_CONTROL | ||||
|     if (gc_block.modal.override == OVERRIDE_PARKING_MOTION) { | ||||
|     if (bit_istrue(command_words,bit(MODAL_GROUP_M9))) { // Already set as enabled in parser. | ||||
|       if (bit_istrue(value_words,bit(WORD_P))) { | ||||
|         if (gc_block.values.p == 0.0) { gc_block.modal.override = OVERRIDE_DISABLED; } | ||||
|         bit_false(value_words,bit(WORD_P)); | ||||
| @@ -1102,7 +1102,13 @@ uint8_t gc_execute_line(char *line) | ||||
|       gc_state.modal.coord_select = 0; // G54 | ||||
|       gc_state.modal.spindle = SPINDLE_DISABLE; | ||||
|       gc_state.modal.coolant = COOLANT_DISABLE; | ||||
|       // gc_state.modal.override = OVERRIDE_DISABLE; // Not supported. | ||||
|       #ifdef ENABLE_PARKING_OVERRIDE_CONTROL | ||||
|         #ifdef DEACTIVATE_PARKING_UPON_INIT | ||||
|           gc_state.modal.override = OVERRIDE_DISABLED; | ||||
|         #else | ||||
|           gc_state.modal.override = OVERRIDE_PARKING_MOTION; | ||||
|         #endif | ||||
|       #endif | ||||
|  | ||||
|       #ifdef RESTORE_OVERRIDES_AFTER_PROGRAM_END | ||||
|         sys.f_override = DEFAULT_FEED_OVERRIDE; | ||||
| @@ -1148,7 +1154,7 @@ uint8_t gc_execute_line(char *line) | ||||
|    group 7 = {G41, G42} cutter radius compensation (G40 is supported) | ||||
|    group 8 = {G43} tool length offset (G43.1/G49 are supported) | ||||
|    group 8 = {M7*} enable mist coolant (* Compile-option) | ||||
|    group 9 = {M48, M49} enable/disable feed and speed override switches | ||||
|    group 9 = {M48, M49, M56*} enable/disable override switches (* Compile-option) | ||||
|    group 10 = {G98, G99} return mode canned cycles | ||||
|    group 13 = {G61.1, G64} path control mode (G61 is supported) | ||||
| */ | ||||
|   | ||||
| @@ -124,8 +124,13 @@ | ||||
| #define TOOL_LENGTH_OFFSET_ENABLE_DYNAMIC 1 // G43.1 | ||||
|  | ||||
| // Modal Group M9: Override control | ||||
| #define OVERRIDE_DISABLED  0 // None (Default: Must be zero) | ||||
| #define OVERRIDE_PARKING_MOTION 1 // G56 (Default: Must be zero) | ||||
| #ifdef DEACTIVATE_PARKING_UPON_INIT | ||||
|   #define OVERRIDE_DISABLED  0 // (Default: Must be zero) | ||||
|   #define OVERRIDE_PARKING_MOTION 1 // M56 | ||||
| #else | ||||
|   #define OVERRIDE_PARKING_MOTION 0 // M56 (Default: Must be zero) | ||||
|   #define OVERRIDE_DISABLED  1 // Parking disabled. | ||||
| #endif | ||||
|  | ||||
| // Modal Group G12: Active work coordinate system | ||||
| // N/A: Stores coordinate system value (54-59) to change to. | ||||
|   | ||||
| @@ -23,7 +23,7 @@ | ||||
|  | ||||
| // Grbl versioning system | ||||
| #define GRBL_VERSION "1.1f" | ||||
| #define GRBL_VERSION_BUILD "20170128" | ||||
| #define GRBL_VERSION_BUILD "20170129" | ||||
|  | ||||
| // Define standard libraries used by Grbl. | ||||
| #include <avr/io.h> | ||||
|   | ||||
| @@ -579,7 +579,7 @@ static void protocol_exec_rt_suspend() | ||||
|             if ((bit_istrue(settings.flags,BITFLAG_HOMING_ENABLE)) && | ||||
|                             (parking_target[PARKING_AXIS] < PARKING_TARGET) && | ||||
|                             bit_isfalse(settings.flags,BITFLAG_LASER_MODE) && | ||||
|                             !sys.override_ctrl) { | ||||
|                             (sys.override_ctrl == OVERRIDE_PARKING_MOTION)) { | ||||
|             #else | ||||
|             if ((bit_istrue(settings.flags,BITFLAG_HOMING_ENABLE)) && | ||||
|                             (parking_target[PARKING_AXIS] < PARKING_TARGET) && | ||||
| @@ -650,7 +650,7 @@ static void protocol_exec_rt_suspend() | ||||
|               // NOTE: State is will remain DOOR, until the de-energizing and retract is complete. | ||||
|               #ifdef ENABLE_PARKING_OVERRIDE_CONTROL | ||||
|               if (((settings.flags & (BITFLAG_HOMING_ENABLE|BITFLAG_LASER_MODE)) == BITFLAG_HOMING_ENABLE) && | ||||
|                   !sys.override_ctrl) { | ||||
|                    (sys.override_ctrl == OVERRIDE_PARKING_MOTION)) { | ||||
|               #else | ||||
|               if ((settings.flags & (BITFLAG_HOMING_ENABLE|BITFLAG_LASER_MODE)) == BITFLAG_HOMING_ENABLE) { | ||||
|               #endif | ||||
| @@ -689,7 +689,7 @@ static void protocol_exec_rt_suspend() | ||||
|               // Execute slow plunge motion from pull-out position to resume position. | ||||
|               #ifdef ENABLE_PARKING_OVERRIDE_CONTROL | ||||
|               if (((settings.flags & (BITFLAG_HOMING_ENABLE|BITFLAG_LASER_MODE)) == BITFLAG_HOMING_ENABLE) && | ||||
|                   !sys.override_ctrl) { | ||||
|                    (sys.override_ctrl == OVERRIDE_PARKING_MOTION)) { | ||||
|               #else | ||||
|               if ((settings.flags & (BITFLAG_HOMING_ENABLE|BITFLAG_LASER_MODE)) == BITFLAG_HOMING_ENABLE) { | ||||
|               #endif | ||||
|   | ||||
| @@ -328,7 +328,7 @@ void report_gcode_modes() | ||||
|   #endif | ||||
|  | ||||
|   #ifdef ENABLE_PARKING_OVERRIDE_CONTROL | ||||
|     if (sys.override_ctrl) {  | ||||
|     if (sys.override_ctrl == OVERRIDE_PARKING_MOTION) {  | ||||
|       report_util_gcode_modes_M(); | ||||
|       print_uint8_base10(56); | ||||
|     } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user