mirror of
https://github.com/bdring/Grbl_Esp32.git
synced 2025-09-07 04:40:43 +02:00
Removed all #ifdef VARIABLE_SPINDLE statement
it is always a variable spindle
This commit is contained in:
@@ -447,12 +447,6 @@ Some features should not be changed. See notes below.
|
|||||||
// tool length offset value is subtracted from the current location.
|
// tool length offset value is subtracted from the current location.
|
||||||
#define TOOL_LENGTH_OFFSET_AXIS Z_AXIS // Default z-axis. Valid values are X_AXIS, Y_AXIS, or Z_AXIS.
|
#define TOOL_LENGTH_OFFSET_AXIS Z_AXIS // Default z-axis. Valid values are X_AXIS, Y_AXIS, or Z_AXIS.
|
||||||
|
|
||||||
// Enables variable spindle output voltage for different RPM values. On the Arduino Uno, the spindle
|
|
||||||
// enable pin will output 5V for maximum RPM with 256 intermediate levels and 0V when disabled.
|
|
||||||
// NOTE: IMPORTANT for Arduino Unos! When enabled, the Z-limit pin D11 and spindle enable pin D12 switch!
|
|
||||||
// The hardware PWM output on pin D11 is required for variable spindle output voltages.
|
|
||||||
#define VARIABLE_SPINDLE // Don't edit this for Grbl_ESP32
|
|
||||||
|
|
||||||
// Alters the behavior of the spindle enable pin. By default Grbl will not disable the enable pin if
|
// Alters the behavior of the spindle enable pin. By default Grbl will not disable the enable pin if
|
||||||
// spindle speed is zero and M3/4 is active, but still sets the PWM output to zero. This allows the users
|
// spindle speed is zero and M3/4 is active, but still sets the PWM output to zero. This allows the users
|
||||||
// to know if the spindle is active and use it as an additional control input.
|
// to know if the spindle is active and use it as an additional control input.
|
||||||
|
@@ -1088,16 +1088,12 @@ uint8_t gc_execute_line(char* line, uint8_t client) {
|
|||||||
// [4. Set spindle speed ]:
|
// [4. Set spindle speed ]:
|
||||||
if ((gc_state.spindle_speed != gc_block.values.s) || bit_istrue(gc_parser_flags, GC_PARSER_LASER_FORCE_SYNC)) {
|
if ((gc_state.spindle_speed != gc_block.values.s) || bit_istrue(gc_parser_flags, GC_PARSER_LASER_FORCE_SYNC)) {
|
||||||
if (gc_state.modal.spindle != SPINDLE_DISABLE) {
|
if (gc_state.modal.spindle != SPINDLE_DISABLE) {
|
||||||
#ifdef VARIABLE_SPINDLE
|
|
||||||
if (bit_isfalse(gc_parser_flags, GC_PARSER_LASER_ISMOTION)) {
|
if (bit_isfalse(gc_parser_flags, GC_PARSER_LASER_ISMOTION)) {
|
||||||
if (bit_istrue(gc_parser_flags, GC_PARSER_LASER_DISABLE))
|
if (bit_istrue(gc_parser_flags, GC_PARSER_LASER_DISABLE))
|
||||||
my_spindle->set_state(gc_state.modal.spindle, 0.0);
|
my_spindle->set_state(gc_state.modal.spindle, 0.0);
|
||||||
else
|
else
|
||||||
my_spindle->set_state(gc_state.modal.spindle, gc_block.values.s);
|
my_spindle->set_state(gc_state.modal.spindle, gc_block.values.s);
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
my_spindle->set_state(gc_state.modal.spindle, 0.0);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
gc_state.spindle_speed = gc_block.values.s; // Update spindle speed state.
|
gc_state.spindle_speed = gc_block.values.s; // Update spindle speed state.
|
||||||
}
|
}
|
||||||
|
@@ -284,9 +284,8 @@ uint8_t plan_buffer_line(float* target, plan_line_data_t* pl_data) {
|
|||||||
plan_block_t* block = &block_buffer[block_buffer_head];
|
plan_block_t* block = &block_buffer[block_buffer_head];
|
||||||
memset(block, 0, sizeof(plan_block_t)); // Zero all block values.
|
memset(block, 0, sizeof(plan_block_t)); // Zero all block values.
|
||||||
block->condition = pl_data->condition;
|
block->condition = pl_data->condition;
|
||||||
#ifdef VARIABLE_SPINDLE
|
|
||||||
block->spindle_speed = pl_data->spindle_speed;
|
block->spindle_speed = pl_data->spindle_speed;
|
||||||
#endif
|
|
||||||
#ifdef USE_LINE_NUMBERS
|
#ifdef USE_LINE_NUMBERS
|
||||||
block->line_number = pl_data->line_number;
|
block->line_number = pl_data->line_number;
|
||||||
#endif
|
#endif
|
||||||
|
@@ -81,7 +81,7 @@ typedef struct {
|
|||||||
float rapid_rate; // Axis-limit adjusted maximum rate for this block direction in (mm/min)
|
float rapid_rate; // Axis-limit adjusted maximum rate for this block direction in (mm/min)
|
||||||
float programmed_rate; // Programmed rate of this block (mm/min).
|
float programmed_rate; // Programmed rate of this block (mm/min).
|
||||||
|
|
||||||
//#ifdef VARIABLE_SPINDLE
|
|
||||||
// Stored spindle speed data used by spindle overrides and resuming methods.
|
// Stored spindle speed data used by spindle overrides and resuming methods.
|
||||||
float spindle_speed; // Block spindle speed. Copied from pl_line_data.
|
float spindle_speed; // Block spindle speed. Copied from pl_line_data.
|
||||||
//#endif
|
//#endif
|
||||||
|
@@ -535,7 +535,6 @@ static void protocol_exec_rt_suspend() {
|
|||||||
#endif
|
#endif
|
||||||
plan_block_t* block = plan_get_current_block();
|
plan_block_t* block = plan_get_current_block();
|
||||||
uint8_t restore_condition;
|
uint8_t restore_condition;
|
||||||
#ifdef VARIABLE_SPINDLE
|
|
||||||
float restore_spindle_speed;
|
float restore_spindle_speed;
|
||||||
if (block == NULL) {
|
if (block == NULL) {
|
||||||
restore_condition = (gc_state.modal.spindle | gc_state.modal.coolant);
|
restore_condition = (gc_state.modal.spindle | gc_state.modal.coolant);
|
||||||
@@ -548,10 +547,7 @@ static void protocol_exec_rt_suspend() {
|
|||||||
if (bit_istrue(settings.flags, BITFLAG_LASER_MODE))
|
if (bit_istrue(settings.flags, BITFLAG_LASER_MODE))
|
||||||
system_set_exec_accessory_override_flag(EXEC_SPINDLE_OVR_STOP);
|
system_set_exec_accessory_override_flag(EXEC_SPINDLE_OVR_STOP);
|
||||||
#endif
|
#endif
|
||||||
#else
|
|
||||||
if (block == NULL) restore_condition = (gc_state.modal.spindle | gc_state.modal.coolant);
|
|
||||||
else restore_condition = block->condition;
|
|
||||||
#endif
|
|
||||||
while (sys.suspend) {
|
while (sys.suspend) {
|
||||||
if (sys.abort) return;
|
if (sys.abort) return;
|
||||||
// Block until initial hold is complete and the machine has stopped motion.
|
// Block until initial hold is complete and the machine has stopped motion.
|
||||||
@@ -600,10 +596,10 @@ static void protocol_exec_rt_suspend() {
|
|||||||
pl_data->condition = (PL_COND_FLAG_SYSTEM_MOTION | PL_COND_FLAG_NO_FEED_OVERRIDE);
|
pl_data->condition = (PL_COND_FLAG_SYSTEM_MOTION | PL_COND_FLAG_NO_FEED_OVERRIDE);
|
||||||
pl_data->spindle_speed = 0.0;
|
pl_data->spindle_speed = 0.0;
|
||||||
my_spindle->set_state((SPINDLE_DISABLE, 0.0); // De-energize
|
my_spindle->set_state((SPINDLE_DISABLE, 0.0); // De-energize
|
||||||
coolant_set_state(COOLANT_DISABLE); // De-energize
|
coolant_set_state(COOLANT_DISABLE); // De-energize
|
||||||
// Execute fast parking retract motion to parking target location.
|
// Execute fast parking retract motion to parking target location.
|
||||||
if (parking_target[PARKING_AXIS] < PARKING_TARGET) {
|
if (parking_target[PARKING_AXIS] < PARKING_TARGET) {
|
||||||
parking_target[PARKING_AXIS] = PARKING_TARGET;
|
parking_target[PARKING_AXIS] = PARKING_TARGET;
|
||||||
pl_data->feed_rate = PARKING_RATE;
|
pl_data->feed_rate = PARKING_RATE;
|
||||||
mc_parking_motion(parking_target, pl_data);
|
mc_parking_motion(parking_target, pl_data);
|
||||||
}
|
}
|
||||||
@@ -611,8 +607,8 @@ 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.
|
||||||
->set_state((SPINDLE_DISABLE, 0.0); // De-energize
|
->set_state((SPINDLE_DISABLE, 0.0); // De-energize
|
||||||
coolant_set_state(COOLANT_DISABLE); // De-energize
|
coolant_set_state(COOLANT_DISABLE); // De-energize
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
sys.suspend &= ~(SUSPEND_RESTART_RETRACT);
|
sys.suspend &= ~(SUSPEND_RESTART_RETRACT);
|
||||||
sys.suspend |= SUSPEND_RETRACT_COMPLETE;
|
sys.suspend |= SUSPEND_RETRACT_COMPLETE;
|
||||||
|
@@ -308,11 +308,8 @@ void report_grbl_settings(uint8_t client, uint8_t show_extended) {
|
|||||||
sprintf(setting, "$27=%4.3f\r\n", settings.homing_pulloff); strcat(rpt, setting);
|
sprintf(setting, "$27=%4.3f\r\n", settings.homing_pulloff); strcat(rpt, setting);
|
||||||
sprintf(setting, "$30=%4.3f\r\n", settings.rpm_max); strcat(rpt, setting);
|
sprintf(setting, "$30=%4.3f\r\n", settings.rpm_max); strcat(rpt, setting);
|
||||||
sprintf(setting, "$31=%4.3f\r\n", settings.rpm_min); strcat(rpt, setting);
|
sprintf(setting, "$31=%4.3f\r\n", settings.rpm_min); strcat(rpt, setting);
|
||||||
#ifdef VARIABLE_SPINDLE
|
|
||||||
sprintf(setting, "$32=%d\r\n", bit_istrue(settings.flags, BITFLAG_LASER_MODE)); strcat(rpt, setting);
|
sprintf(setting, "$32=%d\r\n", bit_istrue(settings.flags, BITFLAG_LASER_MODE)); strcat(rpt, setting);
|
||||||
#else
|
|
||||||
strcat(rpt, "$32=0\r\n");
|
|
||||||
#endif
|
|
||||||
if (show_extended) {
|
if (show_extended) {
|
||||||
sprintf(setting, "$33=%5.3f\r\n", settings.spindle_pwm_freq); strcat(rpt, setting);
|
sprintf(setting, "$33=%5.3f\r\n", settings.spindle_pwm_freq); strcat(rpt, setting);
|
||||||
sprintf(setting, "$34=%3.3f\r\n", settings.spindle_pwm_off_value); strcat(rpt, setting);
|
sprintf(setting, "$34=%3.3f\r\n", settings.spindle_pwm_off_value); strcat(rpt, setting);
|
||||||
@@ -473,10 +470,8 @@ void report_gcode_modes(uint8_t client) {
|
|||||||
else
|
else
|
||||||
sprintf(temp, " F%.0f", gc_state.feed_rate);
|
sprintf(temp, " F%.0f", gc_state.feed_rate);
|
||||||
strcat(modes_rpt, temp);
|
strcat(modes_rpt, temp);
|
||||||
#ifdef VARIABLE_SPINDLE
|
|
||||||
sprintf(temp, " S%4.3f", gc_state.spindle_speed);
|
sprintf(temp, " S%4.3f", gc_state.spindle_speed);
|
||||||
strcat(modes_rpt, temp);
|
strcat(modes_rpt, temp);
|
||||||
#endif
|
|
||||||
strcat(modes_rpt, "]\r\n");
|
strcat(modes_rpt, "]\r\n");
|
||||||
grbl_send(client, modes_rpt);
|
grbl_send(client, modes_rpt);
|
||||||
}
|
}
|
||||||
@@ -499,12 +494,8 @@ void report_build_info(char* line, uint8_t client) {
|
|||||||
strcpy(build_info, "[VER:" GRBL_VERSION "." GRBL_VERSION_BUILD ":");
|
strcpy(build_info, "[VER:" GRBL_VERSION "." GRBL_VERSION_BUILD ":");
|
||||||
strcat(build_info, line);
|
strcat(build_info, line);
|
||||||
strcat(build_info, "]\r\n[OPT:");
|
strcat(build_info, "]\r\n[OPT:");
|
||||||
#ifdef VARIABLE_SPINDLE
|
strcat(build_info, "V"); // variable spindle..always on now
|
||||||
strcat(build_info, "V");
|
|
||||||
#endif
|
|
||||||
#ifdef USE_LINE_NUMBERS
|
|
||||||
strcat(build_info, "N");
|
strcat(build_info, "N");
|
||||||
#endif
|
|
||||||
#ifdef COOLANT_MIST_PIN
|
#ifdef COOLANT_MIST_PIN
|
||||||
strcat(build_info, "M"); // TODO Need to deal with M8...it could be disabled
|
strcat(build_info, "M"); // TODO Need to deal with M8...it could be disabled
|
||||||
#endif
|
#endif
|
||||||
@@ -681,19 +672,11 @@ void report_realtime_status(uint8_t client) {
|
|||||||
#endif
|
#endif
|
||||||
// Report realtime feed speed
|
// Report realtime feed speed
|
||||||
#ifdef REPORT_FIELD_CURRENT_FEED_SPEED
|
#ifdef REPORT_FIELD_CURRENT_FEED_SPEED
|
||||||
#ifdef VARIABLE_SPINDLE
|
|
||||||
if (bit_istrue(settings.flags, BITFLAG_REPORT_INCHES))
|
if (bit_istrue(settings.flags, BITFLAG_REPORT_INCHES))
|
||||||
sprintf(temp, "|FS:%.1f,%.0f", st_get_realtime_rate(), sys.spindle_speed / MM_PER_INCH);
|
sprintf(temp, "|FS:%.1f,%.0f", st_get_realtime_rate(), sys.spindle_speed / MM_PER_INCH);
|
||||||
else
|
else
|
||||||
sprintf(temp, "|FS:%.0f,%.0f", st_get_realtime_rate(), sys.spindle_speed);
|
sprintf(temp, "|FS:%.0f,%.0f", st_get_realtime_rate(), sys.spindle_speed);
|
||||||
strcat(status, temp);
|
strcat(status, temp);
|
||||||
#else
|
|
||||||
if (bit_istrue(settings.flags, BITFLAG_REPORT_INCHES))
|
|
||||||
sprintf(temp, "|F:%.1f", st_get_realtime_rate() / MM_PER_INCH);
|
|
||||||
else
|
|
||||||
sprintf(temp, "|F:%.0f", st_get_realtime_rate());
|
|
||||||
strcat(status, temp);
|
|
||||||
#endif
|
|
||||||
#endif
|
#endif
|
||||||
#ifdef REPORT_FIELD_PIN_STATE
|
#ifdef REPORT_FIELD_PIN_STATE
|
||||||
uint8_t lim_pin_state = limits_get_state();
|
uint8_t lim_pin_state = limits_get_state();
|
||||||
|
Reference in New Issue
Block a user