From e4ae0c6e3453377f1ffe655ca31de52fd740961d Mon Sep 17 00:00:00 2001 From: bdring Date: Mon, 13 Apr 2020 13:47:43 -0500 Subject: [PATCH] Removed all #ifdef VARIABLE_SPINDLE statement it is always a variable spindle --- Grbl_Esp32/config.h | 6 ------ Grbl_Esp32/gcode.cpp | 4 ---- Grbl_Esp32/planner.cpp | 3 +-- Grbl_Esp32/planner.h | 2 +- Grbl_Esp32/protocol.cpp | 16 ++++++---------- Grbl_Esp32/report.cpp | 21 ++------------------- 6 files changed, 10 insertions(+), 42 deletions(-) diff --git a/Grbl_Esp32/config.h b/Grbl_Esp32/config.h index 4409d561..72cab998 100644 --- a/Grbl_Esp32/config.h +++ b/Grbl_Esp32/config.h @@ -447,12 +447,6 @@ Some features should not be changed. See notes below. // 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. -// 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 // 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. diff --git a/Grbl_Esp32/gcode.cpp b/Grbl_Esp32/gcode.cpp index 369f2b96..6c8e8a66 100644 --- a/Grbl_Esp32/gcode.cpp +++ b/Grbl_Esp32/gcode.cpp @@ -1088,16 +1088,12 @@ uint8_t gc_execute_line(char* line, uint8_t client) { // [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.modal.spindle != SPINDLE_DISABLE) { -#ifdef VARIABLE_SPINDLE if (bit_isfalse(gc_parser_flags, GC_PARSER_LASER_ISMOTION)) { if (bit_istrue(gc_parser_flags, GC_PARSER_LASER_DISABLE)) my_spindle->set_state(gc_state.modal.spindle, 0.0); else 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. } diff --git a/Grbl_Esp32/planner.cpp b/Grbl_Esp32/planner.cpp index c114288e..16130ab5 100644 --- a/Grbl_Esp32/planner.cpp +++ b/Grbl_Esp32/planner.cpp @@ -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]; memset(block, 0, sizeof(plan_block_t)); // Zero all block values. block->condition = pl_data->condition; -#ifdef VARIABLE_SPINDLE block->spindle_speed = pl_data->spindle_speed; -#endif + #ifdef USE_LINE_NUMBERS block->line_number = pl_data->line_number; #endif diff --git a/Grbl_Esp32/planner.h b/Grbl_Esp32/planner.h index e4d5ec3e..68519779 100644 --- a/Grbl_Esp32/planner.h +++ b/Grbl_Esp32/planner.h @@ -81,7 +81,7 @@ typedef struct { 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). - //#ifdef VARIABLE_SPINDLE + // Stored spindle speed data used by spindle overrides and resuming methods. float spindle_speed; // Block spindle speed. Copied from pl_line_data. //#endif diff --git a/Grbl_Esp32/protocol.cpp b/Grbl_Esp32/protocol.cpp index 2f3b825f..0a2cb6bc 100644 --- a/Grbl_Esp32/protocol.cpp +++ b/Grbl_Esp32/protocol.cpp @@ -535,7 +535,6 @@ static void protocol_exec_rt_suspend() { #endif plan_block_t* block = plan_get_current_block(); uint8_t restore_condition; -#ifdef VARIABLE_SPINDLE float restore_spindle_speed; if (block == NULL) { 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)) system_set_exec_accessory_override_flag(EXEC_SPINDLE_OVR_STOP); #endif -#else - if (block == NULL) restore_condition = (gc_state.modal.spindle | gc_state.modal.coolant); - else restore_condition = block->condition; -#endif + while (sys.suspend) { if (sys.abort) return; // 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->spindle_speed = 0.0; my_spindle->set_state((SPINDLE_DISABLE, 0.0); // De-energize - coolant_set_state(COOLANT_DISABLE); // De-energize - // Execute fast parking retract motion to parking target location. + coolant_set_state(COOLANT_DISABLE); // De-energize + // Execute fast parking retract motion to parking target location. 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; 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. // NOTE: Laser mode does not start a parking motion to ensure the laser stops immediately. ->set_state((SPINDLE_DISABLE, 0.0); // De-energize - coolant_set_state(COOLANT_DISABLE); // De-energize - } + coolant_set_state(COOLANT_DISABLE); // De-energize + } #endif sys.suspend &= ~(SUSPEND_RESTART_RETRACT); sys.suspend |= SUSPEND_RETRACT_COMPLETE; diff --git a/Grbl_Esp32/report.cpp b/Grbl_Esp32/report.cpp index c189bbb9..af9a02d0 100644 --- a/Grbl_Esp32/report.cpp +++ b/Grbl_Esp32/report.cpp @@ -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, "$30=%4.3f\r\n", settings.rpm_max); 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); -#else - strcat(rpt, "$32=0\r\n"); -#endif + if (show_extended) { 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); @@ -473,10 +470,8 @@ void report_gcode_modes(uint8_t client) { else sprintf(temp, " F%.0f", gc_state.feed_rate); strcat(modes_rpt, temp); -#ifdef VARIABLE_SPINDLE sprintf(temp, " S%4.3f", gc_state.spindle_speed); strcat(modes_rpt, temp); -#endif strcat(modes_rpt, "]\r\n"); 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 ":"); strcat(build_info, line); strcat(build_info, "]\r\n[OPT:"); -#ifdef VARIABLE_SPINDLE - strcat(build_info, "V"); -#endif -#ifdef USE_LINE_NUMBERS + strcat(build_info, "V"); // variable spindle..always on now strcat(build_info, "N"); -#endif #ifdef COOLANT_MIST_PIN strcat(build_info, "M"); // TODO Need to deal with M8...it could be disabled #endif @@ -681,19 +672,11 @@ void report_realtime_status(uint8_t client) { #endif // Report realtime feed speed #ifdef REPORT_FIELD_CURRENT_FEED_SPEED -#ifdef VARIABLE_SPINDLE if (bit_istrue(settings.flags, BITFLAG_REPORT_INCHES)) sprintf(temp, "|FS:%.1f,%.0f", st_get_realtime_rate(), sys.spindle_speed / MM_PER_INCH); else sprintf(temp, "|FS:%.0f,%.0f", st_get_realtime_rate(), sys.spindle_speed); 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 #ifdef REPORT_FIELD_PIN_STATE uint8_t lim_pin_state = limits_get_state();