G91.1 support. Fixed a config.h option.

- G91.1 support added. This g-code sets the arc IJK distance mode to
incremental, which is the default already. This simply  helps reduce
parsing errors with certain CAM programs that output this command.

- Max step rate checks weren’t being compiled in if the option was
enabled. Fixed now.

- Alarm codes were not displaying correctly when GUI reporting mode was
enabled. Due to unsigned int problem. Changed codes to positive values
since they aren’t shared with other codes.
This commit is contained in:
Sonny Jeon 2015-02-25 08:29:56 -07:00
parent d4ae8f94af
commit 85b0c7a8b4
6 changed files with 41 additions and 24 deletions

View File

@ -69,6 +69,7 @@ List of Supported G-Codes in Grbl v0.9
- Feed Rate Modes: G93, G94 - Feed Rate Modes: G93, G94
- Unit Modes: G20, G21 - Unit Modes: G20, G21
- Distance Modes: G90, G91 - Distance Modes: G90, G91
- Arc IJK Distance Modes: G91.1
- Plane Select Modes: G17, G18, G19 - Plane Select Modes: G17, G18, G19
- Tool Length Offset Modes: G43.1, G49 - Tool Length Offset Modes: G43.1, G49
- Cutter Compensation Modes: G40 - Cutter Compensation Modes: G40

View File

@ -213,9 +213,16 @@ uint8_t gc_execute_line(char *line)
} }
break; break;
case 90: case 91: case 90: case 91:
if (mantissa == 0) {
word_bit = MODAL_GROUP_G3; word_bit = MODAL_GROUP_G3;
if (int_value == 90) { gc_block.modal.distance = DISTANCE_MODE_ABSOLUTE; } // G90 if (int_value == 90) { gc_block.modal.distance = DISTANCE_MODE_ABSOLUTE; } // G90
else { gc_block.modal.distance = DISTANCE_MODE_INCREMENTAL; } // G91 else { gc_block.modal.distance = DISTANCE_MODE_INCREMENTAL; } // G91
} else {
word_bit = MODAL_GROUP_G4;
if (mantissa != 10) { FAIL(STATUS_GCODE_UNSUPPORTED_COMMAND); } // [G90.1 not supported]
mantissa = 0; // Set to zero to indicate valid non-integer G command.
// Otherwise, arc IJK incremental mode is default. G91.1 does nothing.
}
break; break;
case 93: case 94: case 93: case 94:
word_bit = MODAL_GROUP_G5; word_bit = MODAL_GROUP_G5;

View File

@ -33,15 +33,16 @@
#define MODAL_GROUP_G1 1 // [G0,G1,G2,G3,G38.2,G80] Motion #define MODAL_GROUP_G1 1 // [G0,G1,G2,G3,G38.2,G80] Motion
#define MODAL_GROUP_G2 2 // [G17,G18,G19] Plane selection #define MODAL_GROUP_G2 2 // [G17,G18,G19] Plane selection
#define MODAL_GROUP_G3 3 // [G90,G91] Distance mode #define MODAL_GROUP_G3 3 // [G90,G91] Distance mode
#define MODAL_GROUP_G5 4 // [G93,G94] Feed rate mode #define MODAL_GROUP_G4 4 // [G90.1,G91.1] Arc IJK distance mode
#define MODAL_GROUP_G6 5 // [G20,G21] Units #define MODAL_GROUP_G5 5 // [G93,G94] Feed rate mode
#define MODAL_GROUP_G7 6 // [G40] Cutter radius compensation mode. G41/42 NOT SUPPORTED. #define MODAL_GROUP_G6 6 // [G20,G21] Units
#define MODAL_GROUP_G8 7 // [G43,G43.1,G49] Tool length offset #define MODAL_GROUP_G7 7 // [G40] Cutter radius compensation mode. G41/42 NOT SUPPORTED.
#define MODAL_GROUP_G12 8 // [G54,G55,G56,G57,G58,G59] Coordinate system selection #define MODAL_GROUP_G8 8 // [G43,G43.1,G49] Tool length offset
#define MODAL_GROUP_G12 9 // [G54,G55,G56,G57,G58,G59] Coordinate system selection
#define MODAL_GROUP_M4 9 // [M0,M1,M2,M30] Stopping #define MODAL_GROUP_M4 10 // [M0,M1,M2,M30] Stopping
#define MODAL_GROUP_M7 10 // [M3,M4,M5] Spindle turning #define MODAL_GROUP_M7 11 // [M3,M4,M5] Spindle turning
#define MODAL_GROUP_M8 11 // [M7,M8,M9] Coolant control #define MODAL_GROUP_M8 12 // [M7,M8,M9] Coolant control
#define OTHER_INPUT_F 12 #define OTHER_INPUT_F 12
#define OTHER_INPUT_S 13 #define OTHER_INPUT_S 13
@ -82,6 +83,9 @@
#define DISTANCE_MODE_ABSOLUTE 0 // G90 (Default: Must be zero) #define DISTANCE_MODE_ABSOLUTE 0 // G90 (Default: Must be zero)
#define DISTANCE_MODE_INCREMENTAL 1 // G91 #define DISTANCE_MODE_INCREMENTAL 1 // G91
// Modal Group G4: Arc IJK distance mode
#define DISTANCE_ARC_MODE_INCREMENTAL 0 // G91.1 (Default: Must be zero)
// Modal Group M4: Program flow // Modal Group M4: Program flow
#define PROGRAM_FLOW_RUNNING 0 // (Default: Must be zero) #define PROGRAM_FLOW_RUNNING 0 // (Default: Must be zero)
#define PROGRAM_FLOW_PAUSED 1 // M0, M1 #define PROGRAM_FLOW_PAUSED 1 // M0, M1

View File

@ -69,9 +69,10 @@ void report_status_message(uint8_t status_code)
printPgmString(PSTR("Homing not enabled")); break; printPgmString(PSTR("Homing not enabled")); break;
case STATUS_OVERFLOW: case STATUS_OVERFLOW:
printPgmString(PSTR("Line overflow")); break; printPgmString(PSTR("Line overflow")); break;
// case STATUS_MAX_STEP_RATE_EXCEEDED: #ifdef MAX_STEP_RATE_HZ
// printPgmString(PSTR("Step rate > 30kHz")); break; case STATUS_MAX_STEP_RATE_EXCEEDED:
printPgmString(PSTR("Step rate > 30kHz")); break;
#endif
// Common g-code parser errors. // Common g-code parser errors.
case STATUS_GCODE_MODAL_GROUP_VIOLATION: case STATUS_GCODE_MODAL_GROUP_VIOLATION:
printPgmString(PSTR("Modal group violation")); break; printPgmString(PSTR("Modal group violation")); break;

View File

@ -33,7 +33,7 @@
#define STATUS_ALARM_LOCK 9 #define STATUS_ALARM_LOCK 9
#define STATUS_SOFT_LIMIT_ERROR 10 #define STATUS_SOFT_LIMIT_ERROR 10
#define STATUS_OVERFLOW 11 #define STATUS_OVERFLOW 11
// #define STATUS_MAX_STEP_RATE_EXCEEDED 12 #define STATUS_MAX_STEP_RATE_EXCEEDED 12
#define STATUS_GCODE_UNSUPPORTED_COMMAND 20 #define STATUS_GCODE_UNSUPPORTED_COMMAND 20
#define STATUS_GCODE_MODAL_GROUP_VIOLATION 21 #define STATUS_GCODE_MODAL_GROUP_VIOLATION 21
@ -54,12 +54,12 @@
#define STATUS_GCODE_UNUSED_WORDS 36 #define STATUS_GCODE_UNUSED_WORDS 36
#define STATUS_GCODE_G43_DYNAMIC_AXIS_ERROR 37 #define STATUS_GCODE_G43_DYNAMIC_AXIS_ERROR 37
// Define Grbl alarm codes. Less than zero to distinguish alarm error from status error. // Define Grbl alarm codes.
#define ALARM_HARD_LIMIT_ERROR -1 #define ALARM_HARD_LIMIT_ERROR 1
#define ALARM_SOFT_LIMIT_ERROR -2 #define ALARM_SOFT_LIMIT_ERROR 2
#define ALARM_ABORT_CYCLE -3 #define ALARM_ABORT_CYCLE 3
#define ALARM_PROBE_FAIL -4 #define ALARM_PROBE_FAIL 4
#define ALARM_HOMING_FAIL -5 #define ALARM_HOMING_FAIL 5
// Define Grbl feedback message codes. // Define Grbl feedback message codes.
#define MESSAGE_CRITICAL_EVENT 1 #define MESSAGE_CRITICAL_EVENT 1

View File

@ -189,11 +189,15 @@ uint8_t settings_store_global_setting(uint8_t parameter, float value) {
// Valid axis setting found. // Valid axis setting found.
switch (set_idx) { switch (set_idx) {
case 0: case 0:
// if (value*settings.max_rate[parameter] > (MAX_STEP_RATE_HZ*60.0)) { return(STATUS_MAX_STEP_RATE_EXCEEDED); } #ifdef MAX_STEP_RATE_HZ
if (value*settings.max_rate[parameter] > (MAX_STEP_RATE_HZ*60.0)) { return(STATUS_MAX_STEP_RATE_EXCEEDED); }
#endif
settings.steps_per_mm[parameter] = value; settings.steps_per_mm[parameter] = value;
break; break;
case 1: case 1:
// if (value*settings.steps_per_mm[parameter] > (MAX_STEP_RATE_HZ*60.0)) { return(STATUS_MAX_STEP_RATE_EXCEEDED); } #ifdef MAX_STEP_RATE_HZ
if (value*settings.steps_per_mm[parameter] > (MAX_STEP_RATE_HZ*60.0)) { return(STATUS_MAX_STEP_RATE_EXCEEDED); }
#endif
settings.max_rate[parameter] = value; settings.max_rate[parameter] = value;
break; break;
case 2: settings.acceleration[parameter] = value*60*60; break; // Convert to mm/min^2 for grbl internal use. case 2: settings.acceleration[parameter] = value*60*60; break; // Convert to mm/min^2 for grbl internal use.