Minor re-factoring. Fix an issue with parking and spindle restore.
- Altered the report counters to be count down, rather than count up. Simplified some of the logic. - Fixed an issue with parking restore. The spindle state would disable then reenable. - Clarified some of the config.h descriptions. - Moved the compile-time checks from config.h to grbl.h. They don’t belong in the config.h file. - Refactored the initialization of the system variables in main.c. System position and probe position were undefined when power cycled, but were zero anyway. Added clear vector code to make it explicit.
This commit is contained in:
parent
498dd62572
commit
f8ca08ad66
@ -1,3 +1,18 @@
|
|||||||
|
----------------
|
||||||
|
Date: 2016-10-23
|
||||||
|
Author: Sonny Jeon
|
||||||
|
Subject: Spindle speed close to minimum fix.
|
||||||
|
|
||||||
|
- When spindle speed is close to the minimum rpm, the PWM value would
|
||||||
|
be zero or lower than allowed. The computation error was caused by
|
||||||
|
setting the minimum PWM value to zero, when it should have been 1.
|
||||||
|
|
||||||
|
- Added a compiler check for minimum PWM to be greater than zero.
|
||||||
|
|
||||||
|
- Moved some of the spindle PWM macros to a more appropriate place in
|
||||||
|
the cpu_map.h.
|
||||||
|
|
||||||
|
|
||||||
----------------
|
----------------
|
||||||
Date: 2016-10-22
|
Date: 2016-10-22
|
||||||
Author: Will Winder
|
Author: Will Winder
|
||||||
|
@ -281,11 +281,11 @@
|
|||||||
// and agressive streaming. There is also a busy and an idle refresh count, which sets up Grbl to send
|
// and agressive streaming. There is also a busy and an idle refresh count, which sets up Grbl to send
|
||||||
// refreshes more often when its not doing anything important. With a good GUI, this data doesn't need
|
// refreshes more often when its not doing anything important. With a good GUI, this data doesn't need
|
||||||
// to be refreshed very often, on the order of a several seconds.
|
// to be refreshed very often, on the order of a several seconds.
|
||||||
// NOTE: The refresh count cannot be set to zero and must be one or greater.
|
// NOTE: WCO refresh must be 2 or greater. OVR refresh must be 1 or greater.
|
||||||
#define REPORT_OVR_REFRESH_BUSY_COUNT 20 // (1-255)
|
#define REPORT_OVR_REFRESH_BUSY_COUNT 20 // (1-255)
|
||||||
#define REPORT_OVR_REFRESH_IDLE_COUNT 10 // (1-255) Must be less than or equal to the busy count
|
#define REPORT_OVR_REFRESH_IDLE_COUNT 10 // (1-255) Must be less than or equal to the busy count
|
||||||
#define REPORT_WCO_REFRESH_BUSY_COUNT 30 // (1-255)
|
#define REPORT_WCO_REFRESH_BUSY_COUNT 30 // (2-255)
|
||||||
#define REPORT_WCO_REFRESH_IDLE_COUNT 10 // (1-255) Must be less than or equal to the busy count
|
#define REPORT_WCO_REFRESH_IDLE_COUNT 10 // (2-255) Must be less than or equal to the busy count
|
||||||
|
|
||||||
// ----- COMPATIBILITY OPTIONS: ------
|
// ----- COMPATIBILITY OPTIONS: ------
|
||||||
// The following options enabled the old-style v0.9 Grbl interface.
|
// The following options enabled the old-style v0.9 Grbl interface.
|
||||||
@ -357,11 +357,13 @@
|
|||||||
// Used by variable spindle output only. This forces the PWM output to a minimum duty cycle when enabled.
|
// Used by variable spindle output only. This forces the PWM output to a minimum duty cycle when enabled.
|
||||||
// The PWM pin will still read 0V when the spindle is disabled. Most users will not need this option, but
|
// The PWM pin will still read 0V when the spindle is disabled. Most users will not need this option, but
|
||||||
// it may be useful in certain scenarios. This minimum PWM settings coincides with the spindle rpm minimum
|
// it may be useful in certain scenarios. This minimum PWM settings coincides with the spindle rpm minimum
|
||||||
// setting, like rpm max to max PWM. So the variable spindle pin will not output the voltage range between
|
// setting, like rpm max to max PWM. This is handy if you need a larger voltage difference between 0V disabled
|
||||||
// 0V for disabled and the voltage set by the minimum PWM for minimum rpm.
|
// and the voltage set by the minimum PWM for minimum rpm. This difference is 0.02V per PWM value. So, when
|
||||||
|
// minimum PWM is at 1, only 0.02 volts separate enabled and disabled. At PWM 5, this would be 0.1V. Keep
|
||||||
|
// in mind that you will begin to lose PWM resolution with increased minimum PWM values, since you have less
|
||||||
|
// and less range over the total 256 PWM levels to signal different spindle speeds.
|
||||||
// NOTE: Compute duty cycle at the minimum PWM by this equation: (% duty cycle)=(SPINDLE_MINIMUM_PWM/256)*100
|
// NOTE: Compute duty cycle at the minimum PWM by this equation: (% duty cycle)=(SPINDLE_MINIMUM_PWM/256)*100
|
||||||
// Value must be greater than zero.
|
// #define SPINDLE_MINIMUM_PWM 5 // Default disabled. Uncomment to enable. Must be greater than zero. Integer (1-255).
|
||||||
// #define SPINDLE_MINIMUM_PWM 5 // Default disabled. Uncomment to enable. Integer (1-255)
|
|
||||||
|
|
||||||
// By default on a 328p(Uno), Grbl combines the variable spindle PWM and the enable into one pin to help
|
// By default on a 328p(Uno), Grbl combines the variable spindle PWM and the enable into one pin to help
|
||||||
// preserve I/O pins. For certain setups, these may need to be separate pins. This configure option uses
|
// preserve I/O pins. For certain setups, these may need to be separate pins. This configure option uses
|
||||||
@ -511,6 +513,8 @@
|
|||||||
// Enable the '$I=(string)' build info write command. If disabled, any existing build info data must
|
// Enable the '$I=(string)' build info write command. If disabled, any existing build info data must
|
||||||
// be placed into EEPROM via external means with a valid checksum value. This macro option is useful
|
// be placed into EEPROM via external means with a valid checksum value. This macro option is useful
|
||||||
// to prevent this data from being over-written by a user, when used to store OEM product data.
|
// to prevent this data from being over-written by a user, when used to store OEM product data.
|
||||||
|
// NOTE: If disabled and to ensure Grbl can never alter the build info line, you'll also need to enable
|
||||||
|
// the SETTING_RESTORE_ALL macro above and remove SETTINGS_RESTORE_BUILD_INFO from the mask.
|
||||||
// NOTE: See the included grblWrite_BuildInfo.ino example file to write this string seperately.
|
// NOTE: See the included grblWrite_BuildInfo.ino example file to write this string seperately.
|
||||||
#define ENABLE_BUILD_INFO_WRITE_COMMAND // '$I=' Default enabled. Comment to disable.
|
#define ENABLE_BUILD_INFO_WRITE_COMMAND // '$I=' Default enabled. Comment to disable.
|
||||||
|
|
||||||
@ -560,33 +564,6 @@
|
|||||||
// Must be positive value or equal to zero.
|
// Must be positive value or equal to zero.
|
||||||
|
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------------------
|
|
||||||
// COMPILE-TIME ERROR CHECKING OF DEFINE VALUES:
|
|
||||||
|
|
||||||
#ifndef HOMING_CYCLE_0
|
|
||||||
#error "Required HOMING_CYCLE_0 not defined."
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(USE_SPINDLE_DIR_AS_ENABLE_PIN) && !defined(VARIABLE_SPINDLE)
|
|
||||||
#error "USE_SPINDLE_DIR_AS_ENABLE_PIN may only be used with VARIABLE_SPINDLE enabled"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(USE_SPINDLE_DIR_AS_ENABLE_PIN) && !defined(CPU_MAP_ATMEGA328P)
|
|
||||||
#error "USE_SPINDLE_DIR_AS_ENABLE_PIN may only be used with a 328p processor"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(PARKING_ENABLE)
|
|
||||||
#if defined(HOMING_FORCE_SET_ORIGIN)
|
|
||||||
#error "HOMING_FORCE_SET_ORIGIN is not supported with PARKING_ENABLE at this time."
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(SPINDLE_MINIMUM_PWM)
|
|
||||||
#if !(SPINDLE_MINIMUM_PWM > 0)
|
|
||||||
#error "SPINDLE_MINIMUM_PWM must be greater than zero."
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* ---------------------------------------------------------------------------------------
|
/* ---------------------------------------------------------------------------------------
|
||||||
OEM Single File Configuration Option
|
OEM Single File Configuration Option
|
||||||
|
|
||||||
|
@ -107,7 +107,7 @@ void coolant_set_state(uint8_t mode)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
}
|
}
|
||||||
sys.report_ovr_counter = REPORT_OVR_REFRESH_BUSY_COUNT; // Set to report change immediately
|
sys.report_ovr_counter = 0; // Set to report change immediately
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
43
grbl/grbl.h
43
grbl/grbl.h
@ -23,7 +23,7 @@
|
|||||||
|
|
||||||
// Grbl versioning system
|
// Grbl versioning system
|
||||||
#define GRBL_VERSION "1.1d"
|
#define GRBL_VERSION "1.1d"
|
||||||
#define GRBL_VERSION_BUILD "20161023"
|
#define GRBL_VERSION_BUILD "20161024"
|
||||||
|
|
||||||
// Define standard libraries used by Grbl.
|
// Define standard libraries used by Grbl.
|
||||||
#include <avr/io.h>
|
#include <avr/io.h>
|
||||||
@ -61,4 +61,45 @@
|
|||||||
#include "stepper.h"
|
#include "stepper.h"
|
||||||
#include "jog.h"
|
#include "jog.h"
|
||||||
|
|
||||||
|
// ---------------------------------------------------------------------------------------
|
||||||
|
// COMPILE-TIME ERROR CHECKING OF DEFINE VALUES:
|
||||||
|
|
||||||
|
#ifndef HOMING_CYCLE_0
|
||||||
|
#error "Required HOMING_CYCLE_0 not defined."
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(USE_SPINDLE_DIR_AS_ENABLE_PIN) && !defined(VARIABLE_SPINDLE)
|
||||||
|
#error "USE_SPINDLE_DIR_AS_ENABLE_PIN may only be used with VARIABLE_SPINDLE enabled"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(USE_SPINDLE_DIR_AS_ENABLE_PIN) && !defined(CPU_MAP_ATMEGA328P)
|
||||||
|
#error "USE_SPINDLE_DIR_AS_ENABLE_PIN may only be used with a 328p processor"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(PARKING_ENABLE)
|
||||||
|
#if defined(HOMING_FORCE_SET_ORIGIN)
|
||||||
|
#error "HOMING_FORCE_SET_ORIGIN is not supported with PARKING_ENABLE at this time."
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(SPINDLE_MINIMUM_PWM)
|
||||||
|
#if !(SPINDLE_MINIMUM_PWM > 0)
|
||||||
|
#error "SPINDLE_MINIMUM_PWM must be greater than zero."
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if (REPORT_WCO_REFRESH_BUSY_COUNT < REPORT_WCO_REFRESH_IDLE_COUNT)
|
||||||
|
#error "WCO busy refresh is less than idle refresh."
|
||||||
|
#endif
|
||||||
|
#if (REPORT_OVR_REFRESH_BUSY_COUNT < REPORT_OVR_REFRESH_IDLE_COUNT)
|
||||||
|
#error "Override busy refresh is less than idle refresh."
|
||||||
|
#endif
|
||||||
|
#if (REPORT_WCO_REFRESH_IDLE_COUNT < 2)
|
||||||
|
#error "WCO refresh must be greater than one."
|
||||||
|
#endif
|
||||||
|
#if (REPORT_OVR_REFRESH_IDLE_COUNT < 1)
|
||||||
|
#error "Override refresh must be greater than zero."
|
||||||
|
#endif
|
||||||
|
// ---------------------------------------------------------------------------------------
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
47
grbl/main.c
47
grbl/main.c
@ -34,10 +34,17 @@ int main(void)
|
|||||||
stepper_init(); // Configure stepper pins and interrupt timers
|
stepper_init(); // Configure stepper pins and interrupt timers
|
||||||
system_init(); // Configure pinout pins and pin-change interrupt
|
system_init(); // Configure pinout pins and pin-change interrupt
|
||||||
|
|
||||||
memset(&sys, 0, sizeof(system_t)); // Clear all system variables
|
memset(sys_position,0,sizeof(sys_position)); // Clear machine position.
|
||||||
sys.abort = true; // Set abort to complete initialization
|
|
||||||
sei(); // Enable interrupts
|
sei(); // Enable interrupts
|
||||||
|
|
||||||
|
// Initialize system state.
|
||||||
|
#ifdef FORCE_INITIALIZATION_ALARM
|
||||||
|
// Force Grbl into an ALARM state upon a power-cycle or hard reset.
|
||||||
|
sys.state = STATE_ALARM;
|
||||||
|
#else
|
||||||
|
sys.state = STATE_IDLE;
|
||||||
|
#endif
|
||||||
|
|
||||||
// Check for power-up and set system alarm if homing is enabled to force homing cycle
|
// Check for power-up and set system alarm if homing is enabled to force homing cycle
|
||||||
// by setting Grbl's alarm state. Alarm locks out all g-code commands, including the
|
// by setting Grbl's alarm state. Alarm locks out all g-code commands, including the
|
||||||
// startup scripts, but allows access to settings and internal commands. Only a homing
|
// startup scripts, but allows access to settings and internal commands. Only a homing
|
||||||
@ -49,17 +56,23 @@ int main(void)
|
|||||||
if (bit_istrue(settings.flags,BITFLAG_HOMING_ENABLE)) { sys.state = STATE_ALARM; }
|
if (bit_istrue(settings.flags,BITFLAG_HOMING_ENABLE)) { sys.state = STATE_ALARM; }
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Force Grbl into an ALARM state upon a power-cycle or hard reset.
|
|
||||||
#ifdef FORCE_INITIALIZATION_ALARM
|
|
||||||
sys.state = STATE_ALARM;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Grbl initialization loop upon power-up or a system abort. For the latter, all processes
|
// Grbl initialization loop upon power-up or a system abort. For the latter, all processes
|
||||||
// will return to this loop to be cleanly re-initialized.
|
// will return to this loop to be cleanly re-initialized.
|
||||||
for(;;) {
|
for(;;) {
|
||||||
|
|
||||||
// TODO: Separate configure task that require interrupts to be disabled, especially upon
|
// Reset system variables.
|
||||||
// a system abort and ensuring any active interrupts are cleanly reset.
|
uint8_t prior_state = sys.state;
|
||||||
|
memset(&sys, 0, sizeof(system_t)); // Clear system struct variable.
|
||||||
|
sys.state = prior_state;
|
||||||
|
sys.f_override = DEFAULT_FEED_OVERRIDE; // Set to 100%
|
||||||
|
sys.r_override = DEFAULT_RAPID_OVERRIDE; // Set to 100%
|
||||||
|
sys.spindle_speed_ovr = DEFAULT_SPINDLE_SPEED_OVERRIDE; // Set to 100%
|
||||||
|
memset(sys_probe_position,0,sizeof(sys_probe_position)); // Clear probe position.
|
||||||
|
sys_probe_state = 0;
|
||||||
|
sys_rt_exec_state = 0;
|
||||||
|
sys_rt_exec_alarm = 0;
|
||||||
|
sys_rt_exec_motion_override = 0;
|
||||||
|
sys_rt_exec_accessory_override = 0;
|
||||||
|
|
||||||
// Reset Grbl primary systems.
|
// Reset Grbl primary systems.
|
||||||
serial_reset_read_buffer(); // Clear serial read buffer
|
serial_reset_read_buffer(); // Clear serial read buffer
|
||||||
@ -75,22 +88,6 @@ int main(void)
|
|||||||
plan_sync_position();
|
plan_sync_position();
|
||||||
gc_sync_position();
|
gc_sync_position();
|
||||||
|
|
||||||
// Reset system variables.
|
|
||||||
sys.abort = sys.suspend = sys.soft_limit = false;
|
|
||||||
sys.step_control = STEP_CONTROL_NORMAL_OP;
|
|
||||||
sys.f_override = DEFAULT_FEED_OVERRIDE;
|
|
||||||
sys.r_override = DEFAULT_RAPID_OVERRIDE;
|
|
||||||
sys.spindle_speed_ovr = DEFAULT_SPINDLE_SPEED_OVERRIDE;
|
|
||||||
sys.spindle_stop_ovr = 0;
|
|
||||||
sys.report_wco_counter = REPORT_WCO_REFRESH_BUSY_COUNT; // Set to include in first report.
|
|
||||||
sys.report_ovr_counter = REPORT_OVR_REFRESH_BUSY_COUNT; // Set to include in first report.
|
|
||||||
|
|
||||||
sys_probe_state = 0;
|
|
||||||
sys_rt_exec_state = 0;
|
|
||||||
sys_rt_exec_alarm = 0;
|
|
||||||
sys_rt_exec_motion_override = 0;
|
|
||||||
sys_rt_exec_accessory_override = 0;
|
|
||||||
|
|
||||||
// Print welcome message. Indicates an initialization has occured at power-up or with a reset.
|
// Print welcome message. Indicates an initialization has occured at power-up or with a reset.
|
||||||
report_init_message();
|
report_init_message();
|
||||||
|
|
||||||
|
@ -424,7 +424,7 @@ void protocol_exec_rt_system()
|
|||||||
if ((new_f_override != sys.f_override) || (new_r_override != sys.r_override)) {
|
if ((new_f_override != sys.f_override) || (new_r_override != sys.r_override)) {
|
||||||
sys.f_override = new_f_override;
|
sys.f_override = new_f_override;
|
||||||
sys.r_override = new_r_override;
|
sys.r_override = new_r_override;
|
||||||
sys.report_ovr_counter = REPORT_OVR_REFRESH_BUSY_COUNT; // Set to report change immediately
|
sys.report_ovr_counter = 0; // Set to report change immediately
|
||||||
plan_update_velocity_profile_parameters();
|
plan_update_velocity_profile_parameters();
|
||||||
plan_cycle_reinitialize();
|
plan_cycle_reinitialize();
|
||||||
}
|
}
|
||||||
@ -447,7 +447,7 @@ void protocol_exec_rt_system()
|
|||||||
if (last_s_override != sys.spindle_speed_ovr) {
|
if (last_s_override != sys.spindle_speed_ovr) {
|
||||||
bit_true(sys.step_control, STEP_CONTROL_UPDATE_SPINDLE_PWM);
|
bit_true(sys.step_control, STEP_CONTROL_UPDATE_SPINDLE_PWM);
|
||||||
sys.spindle_speed_ovr = last_s_override;
|
sys.spindle_speed_ovr = last_s_override;
|
||||||
sys.report_ovr_counter = REPORT_OVR_REFRESH_BUSY_COUNT; // Set to report change immediately
|
sys.report_ovr_counter = 0; // Set to report change immediately
|
||||||
}
|
}
|
||||||
|
|
||||||
if (rt_exec & EXEC_SPINDLE_OVR_STOP) {
|
if (rt_exec & EXEC_SPINDLE_OVR_STOP) {
|
||||||
@ -512,11 +512,6 @@ static void protocol_exec_rt_suspend()
|
|||||||
float retract_waypoint = PARKING_PULLOUT_INCREMENT;
|
float retract_waypoint = PARKING_PULLOUT_INCREMENT;
|
||||||
plan_line_data_t plan_data;
|
plan_line_data_t plan_data;
|
||||||
plan_line_data_t *pl_data = &plan_data;
|
plan_line_data_t *pl_data = &plan_data;
|
||||||
memset(pl_data,0,sizeof(plan_line_data_t));
|
|
||||||
pl_data->condition = (PL_COND_FLAG_SYSTEM_MOTION|PL_COND_FLAG_NO_FEED_OVERRIDE);
|
|
||||||
#ifdef USE_LINE_NUMBERS
|
|
||||||
pl_data->line_number = PARKING_MOTION_LINE_NUMBER;
|
|
||||||
#endif
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
plan_block_t *block = plan_get_current_block();
|
plan_block_t *block = plan_get_current_block();
|
||||||
@ -555,10 +550,17 @@ static void protocol_exec_rt_suspend()
|
|||||||
#ifndef PARKING_ENABLE
|
#ifndef PARKING_ENABLE
|
||||||
|
|
||||||
spindle_set_state(SPINDLE_DISABLE,0.0); // De-energize
|
spindle_set_state(SPINDLE_DISABLE,0.0); // De-energize
|
||||||
coolant_set_state(COOLANT_DISABLE);; // De-energize
|
coolant_set_state(COOLANT_DISABLE); // De-energize
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
|
// Initialize planner state data
|
||||||
|
memset(pl_data,0,sizeof(plan_line_data_t));
|
||||||
|
pl_data->condition = (PL_COND_FLAG_SYSTEM_MOTION|PL_COND_FLAG_NO_FEED_OVERRIDE);
|
||||||
|
#ifdef USE_LINE_NUMBERS
|
||||||
|
pl_data->line_number = PARKING_MOTION_LINE_NUMBER;
|
||||||
|
#endif
|
||||||
|
|
||||||
// Get current position and store restore location and spindle retract waypoint.
|
// Get current position and store restore location and spindle retract waypoint.
|
||||||
system_convert_array_steps_to_mpos(parking_target,sys_position);
|
system_convert_array_steps_to_mpos(parking_target,sys_position);
|
||||||
if (bit_isfalse(sys.suspend,SUSPEND_RESTART_RETRACT)) {
|
if (bit_isfalse(sys.suspend,SUSPEND_RESTART_RETRACT)) {
|
||||||
@ -597,7 +599,7 @@ static void protocol_exec_rt_suspend()
|
|||||||
// Parking motion not possible. Just disable the spindle and coolant.
|
// Parking motion not possible. Just disable the spindle and coolant.
|
||||||
// NOTE: Laser mode does not start a parking motion to ensure the laser stops immediately.
|
// NOTE: Laser mode does not start a parking motion to ensure the laser stops immediately.
|
||||||
spindle_set_state(SPINDLE_DISABLE,0.0); // De-energize
|
spindle_set_state(SPINDLE_DISABLE,0.0); // De-energize
|
||||||
coolant_set_state(COOLANT_DISABLE);; // De-energize
|
coolant_set_state(COOLANT_DISABLE); // De-energize
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -672,7 +674,11 @@ static void protocol_exec_rt_suspend()
|
|||||||
// Regardless if the retract parking motion was a valid/safe motion or not, the
|
// Regardless if the retract parking motion was a valid/safe motion or not, the
|
||||||
// restore parking motion should logically be valid, either by returning to the
|
// restore parking motion should logically be valid, either by returning to the
|
||||||
// original position through valid machine space or by not moving at all.
|
// original position through valid machine space or by not moving at all.
|
||||||
|
// NOTE: If retract is restarted, spindle and coolant states will be cleared in
|
||||||
|
// the beginning of the retract routine.
|
||||||
pl_data->feed_rate = PARKING_PULLOUT_RATE;
|
pl_data->feed_rate = PARKING_PULLOUT_RATE;
|
||||||
|
pl_data->condition = restore_condition;
|
||||||
|
pl_data->spindle_speed = restore_spindle_speed;
|
||||||
mc_parking_motion(restore_target, pl_data);
|
mc_parking_motion(restore_target, pl_data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -803,7 +803,7 @@ void report_realtime_status()
|
|||||||
|
|
||||||
float wco[N_AXIS];
|
float wco[N_AXIS];
|
||||||
if (bit_isfalse(settings.status_report_mask,BITFLAG_RT_STATUS_POSITION_TYPE) ||
|
if (bit_isfalse(settings.status_report_mask,BITFLAG_RT_STATUS_POSITION_TYPE) ||
|
||||||
(sys.report_wco_counter >= REPORT_WCO_REFRESH_BUSY_COUNT) ) {
|
(sys.report_wco_counter == 0) ) {
|
||||||
for (idx=0; idx< N_AXIS; idx++) {
|
for (idx=0; idx< N_AXIS; idx++) {
|
||||||
// Apply work coordinate offsets and tool length offset to current position.
|
// Apply work coordinate offsets and tool length offset to current position.
|
||||||
wco[idx] = gc_state.coord_system[idx]+gc_state.coord_offset[idx];
|
wco[idx] = gc_state.coord_system[idx]+gc_state.coord_offset[idx];
|
||||||
@ -883,23 +883,23 @@ void report_realtime_status()
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef REPORT_FIELD_WORK_COORD_OFFSET
|
#ifdef REPORT_FIELD_WORK_COORD_OFFSET
|
||||||
if (sys.report_wco_counter++ >= REPORT_WCO_REFRESH_BUSY_COUNT) {
|
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)) {
|
if (sys.state & (STATE_HOMING | STATE_CYCLE | STATE_HOLD | STATE_JOG | STATE_SAFETY_DOOR)) {
|
||||||
sys.report_wco_counter = 1; // Reset counter for slow refresh
|
sys.report_wco_counter = (REPORT_WCO_REFRESH_BUSY_COUNT-1); // Reset counter for slow refresh
|
||||||
} else { sys.report_wco_counter = (REPORT_WCO_REFRESH_BUSY_COUNT-REPORT_WCO_REFRESH_IDLE_COUNT+1); }
|
} else { sys.report_wco_counter = (REPORT_WCO_REFRESH_IDLE_COUNT-1); }
|
||||||
if (sys.report_ovr_counter >= REPORT_OVR_REFRESH_BUSY_COUNT) {
|
if (sys.report_ovr_counter == 0) { sys.report_ovr_counter = 1; } // Set override on next report.
|
||||||
sys.report_ovr_counter = (REPORT_OVR_REFRESH_BUSY_COUNT-1); // Set override on next report.
|
|
||||||
}
|
|
||||||
printPgmString(PSTR("|WCO:"));
|
printPgmString(PSTR("|WCO:"));
|
||||||
report_util_axis_values(wco);
|
report_util_axis_values(wco);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef REPORT_FIELD_OVERRIDES
|
#ifdef REPORT_FIELD_OVERRIDES
|
||||||
if (sys.report_ovr_counter++ >= REPORT_OVR_REFRESH_BUSY_COUNT) {
|
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)) {
|
if (sys.state & (STATE_HOMING | STATE_CYCLE | STATE_HOLD | STATE_JOG | STATE_SAFETY_DOOR)) {
|
||||||
sys.report_ovr_counter = 1; // Reset counter for slow refresh
|
sys.report_ovr_counter = (REPORT_OVR_REFRESH_BUSY_COUNT-1); // Reset counter for slow refresh
|
||||||
} else { sys.report_ovr_counter = (REPORT_OVR_REFRESH_BUSY_COUNT-REPORT_OVR_REFRESH_IDLE_COUNT+1); }
|
} else { sys.report_ovr_counter = (REPORT_OVR_REFRESH_IDLE_COUNT-1); }
|
||||||
printPgmString(PSTR("|Ov:"));
|
printPgmString(PSTR("|Ov:"));
|
||||||
print_uint8_base10(sys.f_override);
|
print_uint8_base10(sys.f_override);
|
||||||
serial_write(',');
|
serial_write(',');
|
||||||
|
@ -202,7 +202,7 @@ void spindle_stop()
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
sys.report_ovr_counter = REPORT_OVR_REFRESH_BUSY_COUNT; // Set to report change immediately
|
sys.report_ovr_counter = 0; // Set to report change immediately
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -279,7 +279,7 @@ void system_flag_wco_change()
|
|||||||
#ifdef FORCE_BUFFER_SYNC_DURING_WCO_CHANGE
|
#ifdef FORCE_BUFFER_SYNC_DURING_WCO_CHANGE
|
||||||
protocol_buffer_synchronize();
|
protocol_buffer_synchronize();
|
||||||
#endif
|
#endif
|
||||||
sys.report_wco_counter = REPORT_WCO_REFRESH_BUSY_COUNT;
|
sys.report_wco_counter = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -94,7 +94,7 @@
|
|||||||
#define SUSPEND_JOG_CANCEL bit(7) // Indicates a jog cancel in process and to reset buffers when complete.
|
#define SUSPEND_JOG_CANCEL bit(7) // Indicates a jog cancel in process and to reset buffers when complete.
|
||||||
|
|
||||||
// Define step segment generator state flags.
|
// Define step segment generator state flags.
|
||||||
#define STEP_CONTROL_NORMAL_OP 0
|
#define STEP_CONTROL_NORMAL_OP 0 // Must be zero.
|
||||||
#define STEP_CONTROL_END_MOTION bit(0)
|
#define STEP_CONTROL_END_MOTION bit(0)
|
||||||
#define STEP_CONTROL_EXECUTE_HOLD bit(1)
|
#define STEP_CONTROL_EXECUTE_HOLD bit(1)
|
||||||
#define STEP_CONTROL_EXECUTE_SYS_MOTION bit(2)
|
#define STEP_CONTROL_EXECUTE_SYS_MOTION bit(2)
|
||||||
@ -124,8 +124,8 @@
|
|||||||
|
|
||||||
// Define global system variables
|
// Define global system variables
|
||||||
typedef struct {
|
typedef struct {
|
||||||
uint8_t abort; // System abort flag. Forces exit back to main loop for reset.
|
|
||||||
uint8_t state; // Tracks the current system state of Grbl.
|
uint8_t state; // Tracks the current system state of Grbl.
|
||||||
|
uint8_t abort; // System abort flag. Forces exit back to main loop for reset.
|
||||||
uint8_t suspend; // System suspend bitflag variable that manages holds, cancels, and safety door.
|
uint8_t suspend; // System suspend bitflag variable that manages holds, cancels, and safety door.
|
||||||
uint8_t soft_limit; // Tracks soft limit errors for the state machine. (boolean)
|
uint8_t soft_limit; // Tracks soft limit errors for the state machine. (boolean)
|
||||||
uint8_t step_control; // Governs the step segment generator depending on system state.
|
uint8_t step_control; // Governs the step segment generator depending on system state.
|
||||||
|
Loading…
Reference in New Issue
Block a user