diff --git a/doc/log/commit_log_v1.1.txt b/doc/log/commit_log_v1.1.txt index 8e0b8a6..f0c623e 100644 --- a/doc/log/commit_log_v1.1.txt +++ b/doc/log/commit_log_v1.1.txt @@ -1,3 +1,26 @@ +---------------- +Date: 2016-12-04 +Author: chamnit +Subject: Fixed unintended laser mode pausing. Updated documentation. Min SS OVR lowered to 10%. + +- [laser] Tested a working version and pushed the wrong one for the +last! 20161203 was pausing upon every spindle speed change. That’s not +right. Fixed so nearly all motions are passed through and does not stop. + +- Minimum spindle speed override lower from 50% to 10%. Lasers could +use the lower speeds. + +- Fixed a very minor bug related to G80 error checking. Allowed no +error with non-modal motions with axis words. Not correct and fixed. + +- Fixed a compile error when disabling VARIABLE_SPINDLE + +- [doc] Updated some obsolete documentation. + +- [doc] Started a “Laser Mode” document that summarizes how Grbl’s new +laser mode works. + + ---------------- Date: 2016-12-03 Author: Sonny Jeon diff --git a/grbl/config.h b/grbl/config.h index 2cc03c2..7529b25 100644 --- a/grbl/config.h +++ b/grbl/config.h @@ -287,22 +287,6 @@ #define REPORT_WCO_REFRESH_BUSY_COUNT 30 // (2-255) #define REPORT_WCO_REFRESH_IDLE_COUNT 10 // (2-255) Must be less than or equal to the busy count -// ----- COMPATIBILITY OPTIONS: ------ -// The following options enabled the old-style v0.9 Grbl interface. -// WARNING: DO NOT USE these compatibility options unless there is a really good reason to. If you are -// trying to use Grbl v1.1 with a GUI that supports a v0.9-style interface, it will still not likely work. -// A few things have been added, like override and accessory data and a new sleep state. These things will -// still likely require the GUI to be updated to handle these. In other words, IT WILL STILL NOT WORK! -// IT'S HIGHLY RECOMMENDED FOR GUIs TO UPDATE TO THE NEW INTERFACE FOR v1.1. Don't try to make it -// compatible with this old v0.9 style. It will be dropped in the near future. You have been warned. -// NOTE: The compiled size of Grbl with these options enabled will exceed the flash limit of FTDI-based -// Arduinos, like the Duemilanove and Nano. This will only fit on an Uno with the Optiboot bootloader. -// #define USE_CLASSIC_GRBL_INTERFACE // Default disabled. Uncomment to enable. -// #define REPORT_ALL_PIN_STATES // Default disabled. Uncomment to enable. Option obsolete in v1.1. -// #define REPORT_REALTIME_RATE // Disabled by default. Uncomment to enable. Option obsolete in v1.1. -// Enables minimal reporting feedback mode for GUIs, where human-readable strings are not as important. -// ----------------------------------- - // The temporal resolution of the acceleration management subsystem. A higher number gives smoother // acceleration, particularly noticeable on machines that run at very high feedrates, but may negatively // impact performance. The correct value for this parameter is machine dependent, so it's advised to diff --git a/grbl/grbl.h b/grbl/grbl.h index 3e9707c..5b25b25 100644 --- a/grbl/grbl.h +++ b/grbl/grbl.h @@ -23,7 +23,7 @@ // Grbl versioning system #define GRBL_VERSION "1.1e" -#define GRBL_VERSION_BUILD "20161204" +#define GRBL_VERSION_BUILD "20161208" // Define standard libraries used by Grbl. #include diff --git a/grbl/jog.c b/grbl/jog.c index e08119b..553af77 100644 --- a/grbl/jog.c +++ b/grbl/jog.c @@ -29,7 +29,7 @@ uint8_t jog_execute(plan_line_data_t *pl_data, parser_block_t *gc_block) pl_data->feed_rate = gc_block->values.f; pl_data->condition |= PL_COND_FLAG_NO_FEED_OVERRIDE; #ifdef USE_LINE_NUMBERS - pl_data->line_number = gc_block.values.n; + pl_data->line_number = gc_block->values.n; #endif if (bit_istrue(settings.flags,BITFLAG_SOFT_LIMIT_ENABLE)) { diff --git a/grbl/report.c b/grbl/report.c index 62a4607..78cda83 100644 --- a/grbl/report.c +++ b/grbl/report.c @@ -91,18 +91,16 @@ static void report_util_setting_string(uint8_t n) { } */ -#ifndef USE_CLASSIC_GRBL_INTERFACE - static void report_util_uint8_setting(uint8_t n, int val) { - report_util_setting_prefix(n); - print_uint8_base10(val); - report_util_line_feed(); // report_util_setting_string(n); - } - static void report_util_float_setting(uint8_t n, float val, uint8_t n_decimal) { - report_util_setting_prefix(n); - printFloat(val,n_decimal); - report_util_line_feed(); // report_util_setting_string(n); - } -#endif +static void report_util_uint8_setting(uint8_t n, int val) { + report_util_setting_prefix(n); + print_uint8_base10(val); + report_util_line_feed(); // report_util_setting_string(n); +} +static void report_util_float_setting(uint8_t n, float val, uint8_t n_decimal) { + report_util_setting_prefix(n); + printFloat(val,n_decimal); + report_util_line_feed(); // report_util_setting_string(n); +} // Handles the primary confirmation protocol response for streaming interfaces and human-feedback. @@ -118,59 +116,8 @@ void report_status_message(uint8_t status_code) case STATUS_OK: // STATUS_OK printPgmString(PSTR("ok\r\n")); break; default: - #ifdef USE_CLASSIC_GRBL_INTERFACE - printPgmString(PSTR("error: ")); - switch(status_code) { - case STATUS_EXPECTED_COMMAND_LETTER: - printPgmString(PSTR("Expected command letter")); break; - case STATUS_BAD_NUMBER_FORMAT: - printPgmString(PSTR("Bad number format")); break; - case STATUS_INVALID_STATEMENT: - printPgmString(PSTR("Invalid statement")); break; - case STATUS_NEGATIVE_VALUE: - printPgmString(PSTR("Value < 0")); break; - case STATUS_SETTING_DISABLED: - printPgmString(PSTR("Setting disabled")); break; - case STATUS_SETTING_STEP_PULSE_MIN: - printPgmString(PSTR("Value < 3 usec")); break; - case STATUS_SETTING_READ_FAIL: - printPgmString(PSTR("EEPROM read fail. Using defaults")); break; - case STATUS_IDLE_ERROR: - printPgmString(PSTR("Not idle")); break; - case STATUS_SYSTEM_GC_LOCK: - printPgmString(PSTR("G-code lock")); break; - case STATUS_SOFT_LIMIT_ERROR: - printPgmString(PSTR("Homing not enabled")); break; - case STATUS_OVERFLOW: - printPgmString(PSTR("Line overflow")); break; - #ifdef MAX_STEP_RATE_HZ - case STATUS_MAX_STEP_RATE_EXCEEDED: - printPgmString(PSTR("Step rate > 30kHz")); break; - #endif - case STATUS_CHECK_DOOR: - printPgmString(PSTR("Check Door")); break; - // case STATUS_LINE_LENGTH_EXCEEDED: // Supported on Grbl-Mega only. - // printPgmString(PSTR("Line length exceeded")); break; - case STATUS_TRAVEL_EXCEEDED: - printPgmString(PSTR("Travel exceeded")); break; - case STATUS_INVALID_JOG_COMMAND: - printPgmString(PSTR("Invalid jog command")); break; - // Common g-code parser errors. - case STATUS_GCODE_UNSUPPORTED_COMMAND: - printPgmString(PSTR("Unsupported command")); break; - case STATUS_GCODE_MODAL_GROUP_VIOLATION: - printPgmString(PSTR("Modal group violation")); break; - case STATUS_GCODE_UNDEFINED_FEED_RATE: - printPgmString(PSTR("Undefined feed rate")); break; - default: - // Remaining g-code parser errors with error codes - printPgmString(PSTR("Invalid gcode ID:")); - print_uint8_base10(status_code); // Print error code for user reference - } - #else - printPgmString(PSTR("error:")); - print_uint8_base10(status_code); - #endif + printPgmString(PSTR("error:")); + print_uint8_base10(status_code); report_util_line_feed(); } } @@ -178,28 +125,8 @@ void report_status_message(uint8_t status_code) // Prints alarm messages. void report_alarm_message(int8_t alarm_code) { - #ifdef USE_CLASSIC_GRBL_INTERFACE - printPgmString(PSTR("ALARM: ")); - switch (alarm_code) { - case ALARM_HARD_LIMIT_ERROR: - printPgmString(PSTR("Hard limit")); break; - case ALARM_SOFT_LIMIT_ERROR: - printPgmString(PSTR("Soft limit")); break; - case ALARM_ABORT_CYCLE: - printPgmString(PSTR("Abort during cycle")); break; - case ALARM_PROBE_FAIL_INITIAL: - case ALARM_PROBE_FAIL_CONTACT: - printPgmString(PSTR("Probe fail")); break; - case ALARM_HOMING_FAIL_RESET: - case ALARM_HOMING_FAIL_DOOR: - case ALARM_HOMING_FAIL_PULLOFF: - case ALARM_HOMING_FAIL_APPROACH: - printPgmString(PSTR("Homing fail")); break; - } - #else - printPgmString(PSTR("ALARM:")); - print_uint8_base10(alarm_code); - #endif + printPgmString(PSTR("ALARM:")); + print_uint8_base10(alarm_code); report_util_line_feed(); delay_ms(500); // Force delay to ensure message clears serial write buffer. } @@ -211,11 +138,7 @@ void report_alarm_message(int8_t alarm_code) // is installed, the message number codes are less than zero. void report_feedback_message(uint8_t message_code) { - #ifdef USE_CLASSIC_GRBL_INTERFACE - serial_write('['); - #else - printPgmString(PSTR("[MSG:")); - #endif + printPgmString(PSTR("[MSG:")); switch(message_code) { case MESSAGE_CRITICAL_EVENT: printPgmString(PSTR("Reset to continue")); break; @@ -252,26 +175,7 @@ void report_init_message() // Grbl help message void report_grbl_help() { - #ifdef USE_CLASSIC_GRBL_INTERFACE - printPgmString(PSTR("$$ (view Grbl settings)\r\n" - "$# (view # parameters)\r\n" - "$G (view parser state)\r\n" - "$I (view build info)\r\n" - "$N (view startup blocks)\r\n" - "$x=value (save Grbl setting)\r\n" - "$Nx=line (save startup block)\r\n" - "$J=line (jog)\r\n" - "$SLP (sleep mode)\r\n" - "$C (check gcode mode)\r\n" - "$X (kill alarm lock)\r\n" - "$H (run homing cycle)\r\n" - "~ (cycle start)\r\n" - "! (feed hold)\r\n" - "? (current status)\r\n" - "ctrl-x (reset Grbl)\r\n")); - #else - printPgmString(PSTR("[HLP:$$ $# $G $I $N $x=val $Nx=line $J=line $SLP $C $X $H ~ ! ? ctrl-x]\r\n")); - #endif + printPgmString(PSTR("[HLP:$$ $# $G $I $N $x=val $Nx=line $J=line $SLP $C $X $H ~ ! ? ctrl-x]\r\n")); } @@ -279,107 +183,46 @@ void report_grbl_help() { // NOTE: The numbering scheme here must correlate to storing in settings.c void report_grbl_settings() { // Print Grbl settings. - #ifdef USE_CLASSIC_GRBL_INTERFACE - printPgmString(PSTR("$0=")); print_uint8_base10(settings.pulse_microseconds); - printPgmString(PSTR(" (step pulse, usec)\r\n$1=")); print_uint8_base10(settings.stepper_idle_lock_time); - printPgmString(PSTR(" (step idle delay, msec)\r\n$2=")); print_uint8_base10(settings.step_invert_mask); - printPgmString(PSTR(" (step port invert mask)\r\n$3=")); print_uint8_base10(settings.dir_invert_mask); - printPgmString(PSTR(" (dir port invert mask)\r\n$4=")); print_uint8_base10(bit_istrue(settings.flags,BITFLAG_INVERT_ST_ENABLE)); - printPgmString(PSTR(" (step enable invert, bool)\r\n$5=")); print_uint8_base10(bit_istrue(settings.flags,BITFLAG_INVERT_LIMIT_PINS)); - printPgmString(PSTR(" (limit pins invert, bool)\r\n$6=")); print_uint8_base10(bit_istrue(settings.flags,BITFLAG_INVERT_PROBE_PIN)); - printPgmString(PSTR(" (probe pin invert, bool)\r\n$10=")); print_uint8_base10(settings.status_report_mask); - printPgmString(PSTR(" (status report mask)\r\n$11=")); printFloat(settings.junction_deviation,N_DECIMAL_SETTINGVALUE); - printPgmString(PSTR(" (junction deviation, mm)\r\n$12=")); printFloat(settings.arc_tolerance,N_DECIMAL_SETTINGVALUE); - printPgmString(PSTR(" (arc tolerance, mm)\r\n$13=")); print_uint8_base10(bit_istrue(settings.flags,BITFLAG_REPORT_INCHES)); - printPgmString(PSTR(" (report inches, bool)\r\n$20=")); print_uint8_base10(bit_istrue(settings.flags,BITFLAG_SOFT_LIMIT_ENABLE)); - printPgmString(PSTR(" (soft limits, bool)\r\n$21=")); print_uint8_base10(bit_istrue(settings.flags,BITFLAG_HARD_LIMIT_ENABLE)); - printPgmString(PSTR(" (hard limits, bool)\r\n$22=")); print_uint8_base10(bit_istrue(settings.flags,BITFLAG_HOMING_ENABLE)); - printPgmString(PSTR(" (homing cycle, bool)\r\n$23=")); print_uint8_base10(settings.homing_dir_mask); - printPgmString(PSTR(" (homing dir invert mask)\r\n$24=")); printFloat(settings.homing_feed_rate,N_DECIMAL_SETTINGVALUE); - printPgmString(PSTR(" (homing feed, mm/min)\r\n$25=")); printFloat(settings.homing_seek_rate,N_DECIMAL_SETTINGVALUE); - printPgmString(PSTR(" (homing seek, mm/min)\r\n$26=")); print_uint8_base10(settings.homing_debounce_delay); - printPgmString(PSTR(" (homing debounce, msec)\r\n$27=")); printFloat(settings.homing_pulloff,N_DECIMAL_SETTINGVALUE); - printPgmString(PSTR(" (homing pull-off, mm)\r\n$30=")); printFloat(settings.rpm_max,N_DECIMAL_RPMVALUE); - printPgmString(PSTR(" (rpm max)\r\n$31=")); printFloat(settings.rpm_min,N_DECIMAL_RPMVALUE); - #ifdef VARIABLE_SPINDLE - printPgmString(PSTR(" (rpm min)\r\n$32=")); print_uint8_base10(bit_istrue(settings.flags,BITFLAG_LASER_MODE)); - printPgmString(PSTR(" (laser mode, bool)\r\n")); - #else - printPgmString(PSTR(" (rpm min)\r\n$32=0 (laser mode, bool)\r\n")); - #endif - // Print axis settings - uint8_t idx, set_idx; - uint8_t val = AXIS_SETTINGS_START_VAL; - for (set_idx=0; set_idx= MOTION_MODE_PROBE_TOWARD) { printPgmString(PSTR("38.")); print_uint8_base10(gc_state.modal.motion - (MOTION_MODE_PROBE_TOWARD-2)); @@ -515,79 +354,69 @@ void report_startup_line(uint8_t n, char *line) void report_execute_startup_message(char *line, uint8_t status_code) { - #ifdef USE_CLASSIC_GRBL_INTERFACE - printString(line); - report_status_message(status_code); - #else - serial_write('>'); - printString(line); - serial_write(':'); - report_status_message(status_code); - #endif + serial_write('>'); + printString(line); + serial_write(':'); + report_status_message(status_code); } // Prints build info line void report_build_info(char *line) { - #ifdef USE_CLASSIC_GRBL_INTERFACE - printPgmString(PSTR("[" GRBL_VERSION "." GRBL_VERSION_BUILD ":")); - printString(line); - #else - printPgmString(PSTR("[VER:" GRBL_VERSION "." GRBL_VERSION_BUILD ":")); - printString(line); - report_util_feedback_line_feed(); - printPgmString(PSTR("[OPT:")); // Generate compile-time build option list - #ifdef VARIABLE_SPINDLE - serial_write('V'); - #endif - #ifdef USE_LINE_NUMBERS - serial_write('N'); - #endif - #ifdef ENABLE_M7 - serial_write('M'); - #endif - #ifdef COREXY - serial_write('C'); - #endif - #ifdef PARKING_ENABLE - serial_write('P'); - #endif - #ifdef HOMING_FORCE_SET_ORIGIN - serial_write('Z'); - #endif - #ifdef HOMING_SINGLE_AXIS_COMMANDS - serial_write('H'); - #endif - #ifdef LIMITS_TWO_SWITCHES_ON_AXES - serial_write('L'); - #endif - #ifdef ALLOW_FEED_OVERRIDE_DURING_PROBE_CYCLES - serial_write('A'); - #endif - #ifdef USE_CLASSIC_GRBL_INTERFACE - serial_write('R'); - #endif - #ifndef ENABLE_RESTORE_EEPROM_WIPE_ALL // NOTE: Shown when disabled. - serial_write('*'); - #endif - #ifndef ENABLE_RESTORE_EEPROM_DEFAULT_SETTINGS // NOTE: Shown when disabled. - serial_write('$'); - #endif - #ifndef ENABLE_RESTORE_EEPROM_CLEAR_PARAMETERS // NOTE: Shown when disabled. - serial_write('#'); - #endif - #ifndef ENABLE_BUILD_INFO_WRITE_COMMAND // NOTE: Shown when disabled. - serial_write('I'); - #endif - #ifndef FORCE_BUFFER_SYNC_DURING_EEPROM_WRITE // NOTE: Shown when disabled. - serial_write('E'); - #endif - #ifndef FORCE_BUFFER_SYNC_DURING_WCO_CHANGE // NOTE: Shown when disabled. - serial_write('W'); - #endif - // NOTE: Compiled values, like override increments/max/min values, may be added at some point later. - // These will likely have a comma delimiter to separate them. + printPgmString(PSTR("[VER:" GRBL_VERSION "." GRBL_VERSION_BUILD ":")); + printString(line); + report_util_feedback_line_feed(); + printPgmString(PSTR("[OPT:")); // Generate compile-time build option list + #ifdef VARIABLE_SPINDLE + serial_write('V'); #endif + #ifdef USE_LINE_NUMBERS + serial_write('N'); + #endif + #ifdef ENABLE_M7 + serial_write('M'); + #endif + #ifdef COREXY + serial_write('C'); + #endif + #ifdef PARKING_ENABLE + serial_write('P'); + #endif + #ifdef HOMING_FORCE_SET_ORIGIN + serial_write('Z'); + #endif + #ifdef HOMING_SINGLE_AXIS_COMMANDS + serial_write('H'); + #endif + #ifdef LIMITS_TWO_SWITCHES_ON_AXES + serial_write('L'); + #endif + #ifdef ALLOW_FEED_OVERRIDE_DURING_PROBE_CYCLES + serial_write('A'); + #endif + #ifdef USE_CLASSIC_GRBL_INTERFACE + serial_write('R'); + #endif + #ifndef ENABLE_RESTORE_EEPROM_WIPE_ALL // NOTE: Shown when disabled. + serial_write('*'); + #endif + #ifndef ENABLE_RESTORE_EEPROM_DEFAULT_SETTINGS // NOTE: Shown when disabled. + serial_write('$'); + #endif + #ifndef ENABLE_RESTORE_EEPROM_CLEAR_PARAMETERS // NOTE: Shown when disabled. + serial_write('#'); + #endif + #ifndef ENABLE_BUILD_INFO_WRITE_COMMAND // NOTE: Shown when disabled. + serial_write('I'); + #endif + #ifndef FORCE_BUFFER_SYNC_DURING_EEPROM_WRITE // NOTE: Shown when disabled. + serial_write('E'); + #endif + #ifndef FORCE_BUFFER_SYNC_DURING_WCO_CHANGE // NOTE: Shown when disabled. + serial_write('W'); + #endif + // NOTE: Compiled values, like override increments/max/min values, may be added at some point later. + // These will likely have a comma delimiter to separate them. report_util_feedback_line_feed(); } @@ -609,128 +438,157 @@ void report_echo_line_received(char *line) // especially during g-code programs with fast, short line segments and high frequency reports (5-20Hz). void report_realtime_status() { - #ifdef USE_CLASSIC_GRBL_INTERFACE + uint8_t idx; + int32_t current_position[N_AXIS]; // Copy current state of the system position variable + memcpy(current_position,sys_position,sizeof(sys_position)); + float print_position[N_AXIS]; + system_convert_array_steps_to_mpos(print_position,current_position); - uint8_t idx; - int32_t current_position[N_AXIS]; // Copy current state of the system position variable - memcpy(current_position,sys_position,sizeof(sys_position)); - float print_position[N_AXIS]; - - // Report current machine state - switch (sys.state) { - case STATE_IDLE: printPgmString(PSTR("line_number; + plan_block_t * cur_block = plan_get_current_block(); + if (cur_block != NULL) { + uint32_t ln = cur_block->line_number; + if (ln > 0) { + printPgmString(PSTR("|Ln:")); + printInteger(ln); + } } - printInteger(ln); #endif + #endif - #ifdef REPORT_REALTIME_RATE - // Report realtime rate - printPgmString(PSTR(",F:")); + // Report realtime feed speed + #ifdef REPORT_FIELD_CURRENT_FEED_SPEED + #ifdef VARIABLE_SPINDLE + printPgmString(PSTR("|FS:")); printFloat_RateValue(st_get_realtime_rate()); - #endif - - #ifdef REPORT_ALL_PIN_STATES - if (bit_istrue(settings.status_report_mask, - ( BITFLAG_RT_STATUS_LIMIT_PINS| BITFLAG_RT_STATUS_PROBE_PIN | BITFLAG_RT_STATUS_CONTROL_PINS ))) { - printPgmString(PSTR(",Pin:")); - if (bit_istrue(settings.status_report_mask,BITFLAG_RT_STATUS_LIMIT_PINS)) { - print_uint8_base2_ndigit(limits_get_state(),N_AXIS); - } - printPgmString(PSTR("|")); - if (bit_istrue(settings.status_report_mask,BITFLAG_RT_STATUS_PROBE_PIN)) { - if (probe_get_state()) { printPgmString(PSTR("1")); } - else { printPgmString(PSTR("0")); } - } - printPgmString(PSTR("|")); - if (bit_istrue(settings.status_report_mask,BITFLAG_RT_STATUS_CONTROL_PINS)) { - print_uint8_base2_ndigit(system_control_get_state(),N_CONTROL_PIN); - } - } + serial_write(','); + printFloat(sys.spindle_speed,N_DECIMAL_RPMVALUE); #else - if (bit_istrue(settings.status_report_mask,BITFLAG_RT_STATUS_LIMIT_PINS)) { - printPgmString(PSTR(",Lim:")); - print_uint8_base2_ndigit(limits_get_state(),N_AXIS); - } - #endif + printPgmString(PSTR("|F:")); + printFloat_RateValue(st_get_realtime_rate()); + #endif + #endif - if (bit_istrue(settings.status_report_mask,BITFLAG_RT_STATUS_OVERRIDES)) { - printPgmString(PSTR(",Ov:")); + #ifdef REPORT_FIELD_PIN_STATE + uint8_t lim_pin_state = limits_get_state(); + uint8_t ctrl_pin_state = system_control_get_state(); + uint8_t prb_pin_state = probe_get_state(); + if (lim_pin_state | ctrl_pin_state | prb_pin_state) { + printPgmString(PSTR("|Pn:")); + if (prb_pin_state) { serial_write('P'); } + if (lim_pin_state) { + if (bit_istrue(lim_pin_state,bit(X_AXIS))) { serial_write('X'); } + if (bit_istrue(lim_pin_state,bit(Y_AXIS))) { serial_write('Y'); } + if (bit_istrue(lim_pin_state,bit(Z_AXIS))) { serial_write('Z'); } + } + if (ctrl_pin_state) { + #ifdef ENABLE_SAFETY_DOOR_INPUT_PIN + if (bit_istrue(ctrl_pin_state,CONTROL_PIN_INDEX_SAFETY_DOOR)) { serial_write('D'); } + #endif + if (bit_istrue(ctrl_pin_state,CONTROL_PIN_INDEX_RESET)) { serial_write('R'); } + if (bit_istrue(ctrl_pin_state,CONTROL_PIN_INDEX_FEED_HOLD)) { serial_write('H'); } + if (bit_istrue(ctrl_pin_state,CONTROL_PIN_INDEX_CYCLE_START)) { serial_write('S'); } + } + } + #endif + + #ifdef REPORT_FIELD_WORK_COORD_OFFSET + if (sys.report_wco_counter > 0) { sys.report_wco_counter--; } + else { + if (sys.state & (STATE_HOMING | STATE_CYCLE | STATE_HOLD | STATE_JOG | STATE_SAFETY_DOOR)) { + sys.report_wco_counter = (REPORT_WCO_REFRESH_BUSY_COUNT-1); // Reset counter for slow refresh + } else { sys.report_wco_counter = (REPORT_WCO_REFRESH_IDLE_COUNT-1); } + if (sys.report_ovr_counter == 0) { sys.report_ovr_counter = 1; } // Set override on next report. + printPgmString(PSTR("|WCO:")); + report_util_axis_values(wco); + } + #endif + + #ifdef REPORT_FIELD_OVERRIDES + if (sys.report_ovr_counter > 0) { sys.report_ovr_counter--; } + else { + if (sys.state & (STATE_HOMING | STATE_CYCLE | STATE_HOLD | STATE_JOG | STATE_SAFETY_DOOR)) { + sys.report_ovr_counter = (REPORT_OVR_REFRESH_BUSY_COUNT-1); // Reset counter for slow refresh + } else { sys.report_ovr_counter = (REPORT_OVR_REFRESH_IDLE_COUNT-1); } + printPgmString(PSTR("|Ov:")); print_uint8_base10(sys.f_override); serial_write(','); print_uint8_base10(sys.r_override); serial_write(','); print_uint8_base10(sys.spindle_speed_ovr); - + uint8_t sp_state = spindle_get_state(); - uint8_t cl_state = coolant_get_state(); - if (sp_state | cl_state) { - printPgmString(PSTR(",A:")); + uint8_t cl_state = coolant_get_state(); + if (sp_state || cl_state) { + printPgmString(PSTR("|A:")); if (sp_state) { // != SPINDLE_STATE_DISABLE #ifdef VARIABLE_SPINDLE #ifdef USE_SPINDLE_DIR_AS_ENABLE_PIN @@ -750,187 +608,10 @@ void report_realtime_status() #endif } } - - printPgmString(PSTR(">\r\n")); - - #else - - uint8_t idx; - int32_t current_position[N_AXIS]; // Copy current state of the system position variable - memcpy(current_position,sys_position,sizeof(sys_position)); - float print_position[N_AXIS]; - system_convert_array_steps_to_mpos(print_position,current_position); - - // Report current machine state and sub-states - serial_write('<'); - switch (sys.state) { - case STATE_IDLE: printPgmString(PSTR("Idle")); break; - case STATE_CYCLE: printPgmString(PSTR("Run")); break; - case STATE_HOLD: - if (!(sys.suspend & SUSPEND_JOG_CANCEL)) { - printPgmString(PSTR("Hold:")); - if (sys.suspend & SUSPEND_HOLD_COMPLETE) { serial_write('0'); } // Ready to resume - else { serial_write('1'); } // Actively holding - break; - } // Continues to print jog state during jog cancel. - case STATE_JOG: printPgmString(PSTR("Jog")); break; - case STATE_HOMING: printPgmString(PSTR("Home")); break; - case STATE_ALARM: printPgmString(PSTR("Alarm")); break; - case STATE_CHECK_MODE: printPgmString(PSTR("Check")); break; - case STATE_SAFETY_DOOR: - printPgmString(PSTR("Door:")); - if (sys.suspend & SUSPEND_INITIATE_RESTORE) { - serial_write('3'); // Restoring - } else { - if (sys.suspend & SUSPEND_RETRACT_COMPLETE) { - if (sys.suspend & SUSPEND_SAFETY_DOOR_AJAR) { - serial_write('1'); // Door ajar - } else { - serial_write('0'); - } // Door closed and ready to resume - } else { - serial_write('2'); // Retracting - } - } - break; - case STATE_SLEEP: printPgmString(PSTR("Sleep")); break; - } - - float wco[N_AXIS]; - if (bit_isfalse(settings.status_report_mask,BITFLAG_RT_STATUS_POSITION_TYPE) || - (sys.report_wco_counter == 0) ) { - for (idx=0; idx< N_AXIS; idx++) { - // Apply work coordinate offsets and tool length offset to current position. - wco[idx] = gc_state.coord_system[idx]+gc_state.coord_offset[idx]; - if (idx == TOOL_LENGTH_OFFSET_AXIS) { wco[idx] += gc_state.tool_length_offset; } - if (bit_isfalse(settings.status_report_mask,BITFLAG_RT_STATUS_POSITION_TYPE)) { - print_position[idx] -= wco[idx]; - } - } - } - - // Report machine position - if (bit_istrue(settings.status_report_mask,BITFLAG_RT_STATUS_POSITION_TYPE)) { - printPgmString(PSTR("|MPos:")); - } else { - printPgmString(PSTR("|WPos:")); - } - report_util_axis_values(print_position); - - // Returns planner and serial read buffer states. - #ifdef REPORT_FIELD_BUFFER_STATE - if (bit_istrue(settings.status_report_mask,BITFLAG_RT_STATUS_BUFFER_STATE)) { - printPgmString(PSTR("|Bf:")); - print_uint8_base10(plan_get_block_buffer_available()); - serial_write(','); - print_uint8_base10(serial_get_rx_buffer_available()); - } - #endif - - #ifdef USE_LINE_NUMBERS - #ifdef REPORT_FIELD_LINE_NUMBERS - // Report current line number - plan_block_t * cur_block = plan_get_current_block(); - if (cur_block != NULL) { - uint32_t ln = cur_block->line_number; - if (ln > 0) { - printPgmString(PSTR("|Ln:")); - printInteger(ln); - } - } - #endif - #endif - - // Report realtime feed speed - #ifdef REPORT_FIELD_CURRENT_FEED_SPEED - #ifdef VARIABLE_SPINDLE - printPgmString(PSTR("|FS:")); - printFloat_RateValue(st_get_realtime_rate()); - serial_write(','); - printFloat(sys.spindle_speed,N_DECIMAL_RPMVALUE); - #else - printPgmString(PSTR("|F:")); - printFloat_RateValue(st_get_realtime_rate()); - #endif - #endif - - #ifdef REPORT_FIELD_PIN_STATE - uint8_t lim_pin_state = limits_get_state(); - uint8_t ctrl_pin_state = system_control_get_state(); - uint8_t prb_pin_state = probe_get_state(); - if (lim_pin_state | ctrl_pin_state | prb_pin_state) { - printPgmString(PSTR("|Pn:")); - if (prb_pin_state) { serial_write('P'); } - if (lim_pin_state) { - if (bit_istrue(lim_pin_state,bit(X_AXIS))) { serial_write('X'); } - if (bit_istrue(lim_pin_state,bit(Y_AXIS))) { serial_write('Y'); } - if (bit_istrue(lim_pin_state,bit(Z_AXIS))) { serial_write('Z'); } - } - if (ctrl_pin_state) { - #ifdef ENABLE_SAFETY_DOOR_INPUT_PIN - if (bit_istrue(ctrl_pin_state,CONTROL_PIN_INDEX_SAFETY_DOOR)) { serial_write('D'); } - #endif - if (bit_istrue(ctrl_pin_state,CONTROL_PIN_INDEX_RESET)) { serial_write('R'); } - if (bit_istrue(ctrl_pin_state,CONTROL_PIN_INDEX_FEED_HOLD)) { serial_write('H'); } - if (bit_istrue(ctrl_pin_state,CONTROL_PIN_INDEX_CYCLE_START)) { serial_write('S'); } - } - } - #endif - - #ifdef REPORT_FIELD_WORK_COORD_OFFSET - if (sys.report_wco_counter > 0) { sys.report_wco_counter--; } - else { - if (sys.state & (STATE_HOMING | STATE_CYCLE | STATE_HOLD | STATE_JOG | STATE_SAFETY_DOOR)) { - sys.report_wco_counter = (REPORT_WCO_REFRESH_BUSY_COUNT-1); // Reset counter for slow refresh - } else { sys.report_wco_counter = (REPORT_WCO_REFRESH_IDLE_COUNT-1); } - if (sys.report_ovr_counter == 0) { sys.report_ovr_counter = 1; } // Set override on next report. - printPgmString(PSTR("|WCO:")); - report_util_axis_values(wco); - } - #endif - - #ifdef REPORT_FIELD_OVERRIDES - if (sys.report_ovr_counter > 0) { sys.report_ovr_counter--; } - else { - if (sys.state & (STATE_HOMING | STATE_CYCLE | STATE_HOLD | STATE_JOG | STATE_SAFETY_DOOR)) { - sys.report_ovr_counter = (REPORT_OVR_REFRESH_BUSY_COUNT-1); // Reset counter for slow refresh - } else { sys.report_ovr_counter = (REPORT_OVR_REFRESH_IDLE_COUNT-1); } - printPgmString(PSTR("|Ov:")); - print_uint8_base10(sys.f_override); - serial_write(','); - print_uint8_base10(sys.r_override); - serial_write(','); - print_uint8_base10(sys.spindle_speed_ovr); - - uint8_t sp_state = spindle_get_state(); - uint8_t cl_state = coolant_get_state(); - if (sp_state || cl_state) { - printPgmString(PSTR("|A:")); - if (sp_state) { // != SPINDLE_STATE_DISABLE - #ifdef VARIABLE_SPINDLE - #ifdef USE_SPINDLE_DIR_AS_ENABLE_PIN - serial_write('S'); // CW - #else - if (sp_state == SPINDLE_STATE_CW) { serial_write('S'); } // CW - else { serial_write('C'); } // CCW - #endif - #else - if (sp_state & SPINDLE_STATE_CW) { serial_write('S'); } // CW - else { serial_write('C'); } // CCW - #endif - } - if (cl_state & COOLANT_STATE_FLOOD) { serial_write('F'); } - #ifdef ENABLE_M7 - if (cl_state & COOLANT_STATE_MIST) { serial_write('M'); } - #endif - } - } - #endif - - serial_write('>'); - report_util_line_feed(); - #endif + + serial_write('>'); + report_util_line_feed(); } diff --git a/grbl/settings.h b/grbl/settings.h index 0e5047a..0116b54 100644 --- a/grbl/settings.h +++ b/grbl/settings.h @@ -40,19 +40,8 @@ #define BITFLAG_INVERT_PROBE_PIN bit(7) // Define status reporting boolean enable bit flags in settings.status_report_mask -#ifdef USE_CLASSIC_GRBL_INTERFACE - #define BITFLAG_RT_STATUS_MACHINE_POSITION bit(0) - #define BITFLAG_RT_STATUS_WORK_POSITION bit(1) - #define BITFLAG_RT_STATUS_PLANNER_BUFFER bit(2) - #define BITFLAG_RT_STATUS_SERIAL_RX bit(3) - #define BITFLAG_RT_STATUS_LIMIT_PINS bit(4) - #define BITFLAG_RT_STATUS_PROBE_PIN bit(5) - #define BITFLAG_RT_STATUS_CONTROL_PINS bit(6) - #define BITFLAG_RT_STATUS_OVERRIDES bit(7) -#else - #define BITFLAG_RT_STATUS_POSITION_TYPE bit(0) - #define BITFLAG_RT_STATUS_BUFFER_STATE bit(1) -#endif +#define BITFLAG_RT_STATUS_POSITION_TYPE bit(0) +#define BITFLAG_RT_STATUS_BUFFER_STATE bit(1) // Define settings restore bitflags. #define SETTINGS_RESTORE_DEFAULTS bit(0)