Skip to content

Commit b24e01d

Browse files
committed
Merge branch 'master' of https://github.com/cprezzi/grbl-LPC
2 parents ba4e837 + 50c13a1 commit b24e01d

File tree

11 files changed

+77
-103
lines changed

11 files changed

+77
-103
lines changed

README.md

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
![GitHub Logo](https://github.com/gnea/gnea-Media/blob/master/Grbl%20Logo/Grbl%20Logo%20250px.png?raw=true)
22

33
***
4-
_Click the `Release` tab to download pre-compiled `.bin` files or just [click here](https://github.com/cprezzi/grbl-LPC/releases)_
4+
Old releases are in the `Release` tab. See [cprezzi's branch](https://github.com/cprezzi/grbl-LPC) for more recent releases.
5+
Note: cprezzi's branch disables current control and has defaults more suitable for other boards.
56
***
67
This is GRBL 1.1 ported to the LPC1769. It can run on Smoothieboard.
78

@@ -10,25 +11,22 @@ Usage notes:
1011
If it doesn't, try installing VCOM_lib/usbser.inf.
1112
* This doesn't pass the sdcard to the host. Once installed you need to use a micro sdcard adaptor to replace or change it.
1213
* Only tested with lasers with PWM. Non-PWM spindle control not ported.
13-
* This special version supports setting PWM frequency by $33. Default is 5000 Hz. Pin can only be changes in config.h.
14-
* Pin 2.5
15-
* 5 kHz
16-
* PWM off value: 0%
17-
* Mimimum PWM value: 0%
18-
* Maximum PWM value: 100%
1914
* These are defaults for easy-to-change config values.
20-
* Maximum S value: 1000.0 ($30)
15+
* WPos enabled for LaserWeb compatability ($10=0)
16+
* Laser mode: ON ($32)
2117
* Minimum S value: 0.0 ($31)
22-
* Laser mode: 1 ($32)
23-
* Laser PWM frequency: 5000 ($33)
18+
* Maximum S value: 1.0 ($30)
2419
* Hard limits not yet ported
2520
* Control inputs not yet ported (e.g. Cycle Start and Safety Door switches)
2621

2722
New configuration settings
2823
* $33 is PWM frequency in Hz
24+
* $34 is PWM off value in %
25+
* $35 is PWM min value in %
26+
* $36 is PWM max value in %
2927
* $140, $141, $142 are X, Y, Z current (amps)
30-
* Default to 0.0 A to avoid burning out your motors
31-
* Your motors will likely stall if you don't set these!
28+
* Default to 0.0 A to avoid burning out your motors
29+
* Your motors will likely stall if you don't set these!
3230

3331
Build notes:
3432
* You should use virtual machines, if you use multiple toolchains on the same PC.

grbl/config.h

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,9 @@
129129
// define to force Grbl to always set the machine origin at the homed location despite switch orientation.
130130
// #define HOMING_FORCE_SET_ORIGIN // Uncomment to enable.
131131

132+
// Uncomment this define to force Grbl to always set the machine origin at bottom left.
133+
#define HOMING_FORCE_POSITIVE_SPACE // Uncomment to enable.
134+
132135
// Number of blocks Grbl executes upon startup. These blocks are stored in EEPROM, where the size
133136
// and addresses are defined in settings.h. With the current settings, up to 2 startup blocks may
134137
// be stored and executed in order. These startup blocks would typically be used to set the g-code
@@ -359,11 +362,6 @@
359362
// pwm = scaled value. settings.rpm_min scales to SPINDLE_PWM_MIN_VALUE. settings.rpm_max
360363
// scales to SPINDLE_PWM_MAX_VALUE.
361364

362-
//#define SPINDLE_PWM_PERIOD (SystemCoreClock / 40000) // SystemCoreClock / frequency
363-
#define SPINDLE_PWM_OFF_VALUE 0.0 // SPINDLE_PWM_PERIOD * fraction
364-
//#define SPINDLE_PWM_MIN_VALUE (SPINDLE_PWM_PERIOD * 0.0) // SPINDLE_PWM_PERIOD * fraction
365-
//#define SPINDLE_PWM_MAX_VALUE (SPINDLE_PWM_PERIOD * 1.0) // SPINDLE_PWM_PERIOD * fraction
366-
367365
// Used by variable spindle output only. This forces the PWM output to a minimum duty cycle when enabled.
368366
// The PWM pin will still read 0V when the spindle is disabled. Most users will not need this option, but
369367
// it may be useful in certain scenarios. This minimum PWM settings coincides with the spindle rpm minimum
@@ -717,10 +715,10 @@
717715
#define CONTROL_INVERT_MASK CONTROL_MASK // May be re-defined to only invert certain control pins.
718716

719717
// Define probe switch input pin.
720-
#define PROBE_DDR NotUsed
721-
#define PROBE_PIN NotUsed
722-
#define PROBE_PORT NotUsed
723-
#define PROBE_BIT 5 // Uno Analog Pin 5
718+
#define PROBE_DDR NotUsed // LPC_GPIO1->FIODIR
719+
#define PROBE_PIN NotUsed // LPC_GPIO1->FIOPIN
720+
#define PROBE_PORT NotUsed // LPC_GPIO1->FIOPIN
721+
#define PROBE_BIT 5
724722
#define PROBE_MASK (1<<PROBE_BIT)
725723

726724
// The LPC17xx has 6 PWM channels. Each channel has 2 pins. It can drive both pins simultaneously to the same value.
@@ -744,18 +742,21 @@
744742
#define DEFAULT_Z_STEPS_PER_MM 160.0
745743
#define DEFAULT_X_MAX_RATE 24000 // mm/min
746744
#define DEFAULT_Y_MAX_RATE 24000 // mm/min
747-
#define DEFAULT_Z_MAX_RATE 24000 // mm/min
745+
#define DEFAULT_Z_MAX_RATE 500.0 // mm/min
748746
#define DEFAULT_X_ACCELERATION (2500.0*60*60) // 5000*60*60 mm/min^2 = 5000 mm/sec^2
749747
#define DEFAULT_Y_ACCELERATION (2500.0*60*60) // 5000*60*60 mm/min^2 = 5000 mm/sec^2
750748
#define DEFAULT_Z_ACCELERATION (2500.0*60*60) // 5000*60*60 mm/min^2 = 5000 mm/sec^2
751-
#define DEFAULT_X_CURRENT 0.0 // amps
752-
#define DEFAULT_Y_CURRENT 0.0 // amps
749+
#define DEFAULT_X_CURRENT 0.4 // amps
750+
#define DEFAULT_Y_CURRENT 0.6 // amps
753751
#define DEFAULT_Z_CURRENT 0.0 // amps
754752
#define DEFAULT_A_CURRENT 0.0 // amps
755753
#define DEFAULT_X_MAX_TRAVEL 300.0 // mm
756754
#define DEFAULT_Y_MAX_TRAVEL 200.0 // mm
757755
#define DEFAULT_Z_MAX_TRAVEL 50.0 // mm
758-
#define DEFAULT_SPINDLE_PWM_FREQ 5000 // Hz
756+
#define DEFAULT_SPINDLE_PWM_FREQ 5000 // Hz
757+
#define DEFAULT_SPINDLE_PWM_OFF_VALUE 0.0 // Percent
758+
#define DEFAULT_SPINDLE_PWM_MIN_VALUE 0.0 // Percent
759+
#define DEFAULT_SPINDLE_PWM_MAX_VALUE 100.0 // Percent
759760
#define DEFAULT_SPINDLE_RPM_MAX 1000.0 // rpm
760761
#define DEFAULT_SPINDLE_RPM_MIN 0.0 // rpm
761762
#define DEFAULT_STEP_PULSE_MICROSECONDS 10
@@ -768,15 +769,15 @@
768769
#define DEFAULT_REPORT_INCHES 0 // false
769770
#define DEFAULT_INVERT_ST_ENABLE 0 // false
770771
#define DEFAULT_INVERT_LIMIT_PINS 1 // false
771-
#define DEFAULT_SOFT_LIMIT_ENABLE 0 // false
772+
#define DEFAULT_SOFT_LIMIT_ENABLE 1 // false
772773
#define DEFAULT_HARD_LIMIT_ENABLE 0 // false
773774
#define DEFAULT_INVERT_PROBE_PIN 0 // false
774775
#define DEFAULT_LASER_MODE 1 // true
775-
#define DEFAULT_HOMING_ENABLE 0 // false
776-
#define DEFAULT_HOMING_DIR_MASK 0 // move positive dir
776+
#define DEFAULT_HOMING_ENABLE 1 // false
777+
#define DEFAULT_HOMING_DIR_MASK 1 // move positive dir
777778
#define DEFAULT_HOMING_FEED_RATE 50.0 // mm/min
778779
#define DEFAULT_HOMING_SEEK_RATE 6000.0 // mm/min
779780
#define DEFAULT_HOMING_DEBOUNCE_DELAY 250 // msec (0-65k)
780-
#define DEFAULT_HOMING_PULLOFF 1.0 // mm
781+
#define DEFAULT_HOMING_PULLOFF 2.0 // mm
781782

782783
#endif

grbl/defaults.h

Lines changed: 0 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@
4141
#define DEFAULT_X_MAX_TRAVEL 200.0 // mm NOTE: Must be a positive value.
4242
#define DEFAULT_Y_MAX_TRAVEL 200.0 // mm NOTE: Must be a positive value.
4343
#define DEFAULT_Z_MAX_TRAVEL 200.0 // mm NOTE: Must be a positive value.
44-
#define DEFAULT_SPINDLE_PWM_FREQ 5000 // Hz
4544
#define DEFAULT_SPINDLE_RPM_MAX 1000.0 // rpm
4645
#define DEFAULT_SPINDLE_RPM_MIN 0.0 // rpm
4746
#define DEFAULT_STEP_PULSE_MICROSECONDS 10
@@ -66,49 +65,6 @@
6665
#define DEFAULT_HOMING_PULLOFF 1.0 // mm
6766
#endif
6867

69-
#ifdef DEFAULTS_K40
70-
// Description: K40 Lasercutter (typical chinese 40W CO2 laser cutter/engraver)
71-
#define DEFAULT_X_STEPS_PER_MM 160.0
72-
#define DEFAULT_Y_STEPS_PER_MM 160.0
73-
#define DEFAULT_Z_STEPS_PER_MM 160.0
74-
#define DEFAULT_X_MAX_RATE 24000.0 // mm/min
75-
#define DEFAULT_Y_MAX_RATE 24000.0 // mm/min
76-
#define DEFAULT_Z_MAX_RATE 24000.0 // mm/min
77-
#define DEFAULT_X_ACCELERATION (2500.0*60*60) // 10*60*60 mm/min^2 = 10 mm/sec^2
78-
#define DEFAULT_Y_ACCELERATION (2500.0*60*60) // 10*60*60 mm/min^2 = 10 mm/sec^2
79-
#define DEFAULT_Z_ACCELERATION (2500.0*60*60) // 10*60*60 mm/min^2 = 10 mm/sec^2
80-
#define DEFAULT_X_CURRENT 0.0 // amps
81-
#define DEFAULT_Y_CURRENT 0.0 // amps
82-
#define DEFAULT_Z_CURRENT 0.0 // amps
83-
#define DEFAULT_A_CURRENT 0.0 // amps
84-
#define DEFAULT_X_MAX_TRAVEL 300.0 // mm NOTE: Must be a positive value.
85-
#define DEFAULT_Y_MAX_TRAVEL 200.0 // mm NOTE: Must be a positive value.
86-
#define DEFAULT_Z_MAX_TRAVEL 50.0 // mm NOTE: Must be a positive value.
87-
#define DEFAULT_SPINDLE_PWM_FREQ 5000 // Hz
88-
#define DEFAULT_SPINDLE_RPM_MAX 1000.0 // rpm
89-
#define DEFAULT_SPINDLE_RPM_MIN 0.0 // rpm
90-
#define DEFAULT_STEP_PULSE_MICROSECONDS 10
91-
#define DEFAULT_STEPPING_INVERT_MASK 0
92-
#define DEFAULT_DIRECTION_INVERT_MASK 0
93-
#define DEFAULT_STEPPER_IDLE_LOCK_TIME 25 // msec (0-254, 255 keeps steppers enabled)
94-
#define DEFAULT_STATUS_REPORT_MASK 0 // WPos enabled
95-
#define DEFAULT_JUNCTION_DEVIATION 0.01 // mm
96-
#define DEFAULT_ARC_TOLERANCE 0.002 // mm
97-
#define DEFAULT_REPORT_INCHES 0 // false
98-
#define DEFAULT_INVERT_ST_ENABLE 0 // false
99-
#define DEFAULT_INVERT_LIMIT_PINS 1 // false
100-
#define DEFAULT_SOFT_LIMIT_ENABLE 0 // false
101-
#define DEFAULT_HARD_LIMIT_ENABLE 0 // false
102-
#define DEFAULT_INVERT_PROBE_PIN 0 // false
103-
#define DEFAULT_LASER_MODE 1 // false
104-
#define DEFAULT_HOMING_ENABLE 0 // false
105-
#define DEFAULT_HOMING_DIR_MASK 0 // move positive dir
106-
#define DEFAULT_HOMING_FEED_RATE 50.0 // mm/min
107-
#define DEFAULT_HOMING_SEEK_RATE 6000.0 // mm/min
108-
#define DEFAULT_HOMING_DEBOUNCE_DELAY 250 // msec (0-65k)
109-
#define DEFAULT_HOMING_PULLOFF 1.0 // mm
110-
#endif
111-
11268
#ifdef DEFAULTS_SHERLINE_5400
11369
// Description: Sherline 5400 mill with three NEMA 23 Keling KL23H256-21-8B 185 oz-in stepper motors,
11470
// driven by three Pololu A4988 stepper drivers with a 30V, 6A power supply at 1.5A per winding.

grbl/limits.c

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -307,9 +307,17 @@ void limits_go_home(uint8_t cycle_mask)
307307
set_axis_position = 0;
308308
#else
309309
if ( bit_istrue(settings.homing_dir_mask,bit(idx)) ) {
310-
set_axis_position = lround((settings.max_travel[idx]+settings.homing_pulloff)*settings.steps_per_mm[idx]);
310+
#ifdef HOMING_FORCE_POSITIVE_SPACE
311+
set_axis_position = 0; //lround(settings.homing_pulloff*settings.steps_per_mm[idx]);
312+
#else
313+
set_axis_position = lround((settings.max_travel[idx]-settings.homing_pulloff)*settings.steps_per_mm[idx]);
314+
#endif
311315
} else {
312-
set_axis_position = lround(-settings.homing_pulloff*settings.steps_per_mm[idx]);
316+
#ifdef HOMING_FORCE_POSITIVE_SPACE
317+
set_axis_position = lround(-settings.max_travel[idx]*settings.steps_per_mm[idx]);
318+
#else
319+
set_axis_position = lround(-settings.homing_pulloff*settings.steps_per_mm[idx]);
320+
#endif
313321
}
314322
#endif
315323

grbl/report.c

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,6 @@ static void report_util_setting_string(uint8_t n) {
7171
case 30: printPgmString(PSTR("rpm max")); break;
7272
case 31: printPgmString(PSTR("rpm min")); break;
7373
case 32: printPgmString(PSTR("laser")); break;
74-
case 33: printPgmString(PSTR("spindle_pwm_freq")); break;
7574
default:
7675
n -= AXIS_SETTINGS_START_VAL;
7776
uint8_t idx = 0;
@@ -97,11 +96,6 @@ static void report_util_uint8_setting(uint8_t n, int val) {
9796
print_uint8_base10(val);
9897
report_util_line_feed(); // report_util_setting_string(n);
9998
}
100-
static void report_util_uint32_setting(uint8_t n, int val) {
101-
report_util_setting_prefix(n);
102-
print_uint32_base10(val);
103-
report_util_line_feed(); // report_util_setting_string(n);
104-
}
10599
static void report_util_float_setting(uint8_t n, float val, uint8_t n_decimal) {
106100
report_util_setting_prefix(n);
107101
printFloat(val,n_decimal);
@@ -214,7 +208,10 @@ void report_grbl_settings() {
214208
#else
215209
report_util_uint8_setting(32,0);
216210
#endif
217-
report_util_uint32_setting(33,settings.spindle_pwm_freq);
211+
report_util_float_setting(33,settings.spindle_pwm_freq,N_DECIMAL_SETTINGVALUE);
212+
report_util_float_setting(34,settings.spindle_pwm_off_value,N_DECIMAL_SETTINGVALUE);
213+
report_util_float_setting(35,settings.spindle_pwm_min_value,N_DECIMAL_SETTINGVALUE);
214+
report_util_float_setting(36,settings.spindle_pwm_max_value,N_DECIMAL_SETTINGVALUE);
218215
// Print axis settings
219216
uint8_t idx, set_idx;
220217
uint8_t val = AXIS_SETTINGS_START_VAL;

grbl/settings.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,9 @@ void settings_restore(uint8_t restore_flag) {
8787
settings.arc_tolerance = DEFAULT_ARC_TOLERANCE;
8888

8989
settings.spindle_pwm_freq = DEFAULT_SPINDLE_PWM_FREQ;
90+
settings.spindle_pwm_off_value = DEFAULT_SPINDLE_PWM_OFF_VALUE;
91+
settings.spindle_pwm_min_value = DEFAULT_SPINDLE_PWM_MIN_VALUE;
92+
settings.spindle_pwm_max_value = DEFAULT_SPINDLE_PWM_MAX_VALUE;
9093
settings.rpm_max = DEFAULT_SPINDLE_RPM_MAX;
9194
settings.rpm_min = DEFAULT_SPINDLE_RPM_MIN;
9295

@@ -319,6 +322,9 @@ uint8_t settings_store_global_setting(uint8_t parameter, float value) {
319322
#endif
320323
break;
321324
case 33: settings.spindle_pwm_freq = value; spindle_init(); break; // Re-initialize spindle pwm calibration
325+
case 34: settings.spindle_pwm_off_value = value; spindle_init(); break; // Re-initialize spindle pwm calibration
326+
case 35: settings.spindle_pwm_min_value = value; spindle_init(); break; // Re-initialize spindle pwm calibration
327+
case 36: settings.spindle_pwm_max_value = value; spindle_init(); break; // Re-initialize spindle pwm calibration
322328
default:
323329
return(STATUS_INVALID_STATEMENT);
324330
}

grbl/settings.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,10 @@ typedef struct {
9292
float junction_deviation;
9393
float arc_tolerance;
9494

95-
uint16_t spindle_pwm_freq;
95+
float spindle_pwm_freq; // Hz
96+
float spindle_pwm_off_value; // Percent
97+
float spindle_pwm_min_value; // Percent
98+
float spindle_pwm_max_value; // Percent
9699
float rpm_max;
97100
float rpm_min;
98101

grbl/spindle_control.c

Lines changed: 14 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -25,23 +25,21 @@
2525

2626
#ifdef VARIABLE_SPINDLE
2727
static float pwm_gradient; // Precalulated value to speed up rpm to PWM conversions.
28-
static float spindle_pwm_period;
29-
static float spindle_pwm_off_value;
30-
static float spindle_pwm_min_value;
31-
static float spindle_pwm_max_value;
28+
float spindle_pwm_period;
29+
float spindle_pwm_off_value;
30+
float spindle_pwm_min_value;
31+
float spindle_pwm_max_value;
3232
#endif
3333

3434

3535
void spindle_init()
3636
{
3737
#ifdef VARIABLE_SPINDLE
3838
spindle_pwm_period = (SystemCoreClock / settings.spindle_pwm_freq);
39-
spindle_pwm_off_value = (spindle_pwm_period * 0.0); // SPINDLE_PWM_PERIOD * fraction
40-
spindle_pwm_min_value = (spindle_pwm_period * 0.0); // SPINDLE_PWM_PERIOD * fraction
41-
spindle_pwm_max_value = (spindle_pwm_period * 1.0); // SPINDLE_PWM_PERIOD * fraction
42-
43-
//pwm_init(&SPINDLE_PWM_CHANNEL, SPINDLE_PWM_USE_PRIMARY_PIN, SPINDLE_PWM_USE_SECONDARY_PIN, SPINDLE_PWM_PERIOD, 0);
44-
pwm_init(&SPINDLE_PWM_CHANNEL, SPINDLE_PWM_USE_PRIMARY_PIN, SPINDLE_PWM_USE_SECONDARY_PIN, spindle_pwm_period, 0); //SPINDLE_PWM_PERIOD
39+
spindle_pwm_off_value = (spindle_pwm_period * settings.spindle_pwm_off_value / 100);
40+
spindle_pwm_min_value = (spindle_pwm_period * settings.spindle_pwm_min_value / 100);
41+
spindle_pwm_max_value = (spindle_pwm_period * settings.spindle_pwm_max_value / 100);
42+
pwm_init(&SPINDLE_PWM_CHANNEL, SPINDLE_PWM_USE_PRIMARY_PIN, SPINDLE_PWM_USE_SECONDARY_PIN, spindle_pwm_period, 0);
4543
pwm_enable(&SPINDLE_PWM_CHANNEL);
4644

4745
/* not ported
@@ -54,7 +52,6 @@ void spindle_init()
5452
#endif
5553
*/
5654

57-
//pwm_gradient = (SPINDLE_PWM_MAX_VALUE-SPINDLE_PWM_MIN_VALUE)/(settings.rpm_max-settings.rpm_min);
5855
pwm_gradient = (spindle_pwm_max_value-spindle_pwm_min_value)/(settings.rpm_max-settings.rpm_min);
5956

6057
#else
@@ -145,21 +142,21 @@ void spindle_stop()
145142
rpm *= (0.010*sys.spindle_speed_ovr); // Scale by spindle speed override value.
146143
if (rpm <= 0) {
147144
sys.spindle_speed = 0;
148-
pwm_value = spindle_pwm_off_value; //SPINDLE_PWM_OFF_VALUE
145+
pwm_value = spindle_pwm_off_value;
149146
}
150147
else if (rpm <= settings.rpm_min) {
151148
sys.spindle_speed = settings.rpm_min;
152-
pwm_value = spindle_pwm_min_value; //SPINDLE_PWM_MIN_VALUE
149+
pwm_value = spindle_pwm_min_value;
153150
}
154151
else if (rpm >= settings.rpm_max) {
155152
sys.spindle_speed = settings.rpm_max;
156-
pwm_value = spindle_pwm_max_value - 1; //SPINDLE_PWM_MAX_VALUE
153+
pwm_value = spindle_pwm_max_value - 1;
157154
}
158155
else {
159156
sys.spindle_speed = rpm;
160-
pwm_value = floor((rpm - settings.rpm_min) * pwm_gradient) + spindle_pwm_min_value; //SPINDLE_PWM_MIN_VALUE
161-
if(pwm_value >= spindle_pwm_max_value) //SPINDLE_PWM_MAX_VALUE
162-
pwm_value = spindle_pwm_max_value - 1; //SPINDLE_PWM_MAX_VALUE
157+
pwm_value = floor((rpm - settings.rpm_min) * pwm_gradient) + spindle_pwm_min_value;
158+
if(pwm_value >= spindle_pwm_max_value)
159+
pwm_value = spindle_pwm_max_value - 1;
163160
}
164161
return(pwm_value);
165162
}

grbl/spindle_control.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,10 @@ uint8_t spindle_get_state();
4040
// Immediately sets spindle running state with direction and spindle rpm via PWM, if enabled.
4141
// Called by spindle_sync() after sync and parking motion/spindle stop override during restore.
4242
#ifdef VARIABLE_SPINDLE
43+
extern float spindle_pwm_period;
44+
extern float spindle_pwm_off_value;
45+
extern float spindle_pwm_min_value;
46+
extern float spindle_pwm_max_value;
4347

4448
// Called by g-code parser when setting spindle state and requires a buffer sync.
4549
void spindle_sync(uint8_t state, float rpm);

grbl/stepper.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -385,7 +385,7 @@ extern "C" void TIMER1_IRQHandler()
385385
st_go_idle();
386386
#ifdef VARIABLE_SPINDLE
387387
// Ensure pwm is set properly upon completion of rate-controlled motion.
388-
if (st.exec_block->is_pwm_rate_adjusted) { spindle_set_speed(SPINDLE_PWM_OFF_VALUE); }
388+
if (st.exec_block->is_pwm_rate_adjusted) { spindle_set_speed(spindle_pwm_off_value); }
389389
#endif
390390
system_set_exec_state_flag(EXEC_CYCLE_STOP); // Flag main program for cycle end
391391
return; // Nothing to do but exit.
@@ -907,7 +907,7 @@ void st_prep_buffer()
907907
prep.current_spindle_pwm = spindle_compute_pwm_value(rpm);
908908
} else {
909909
sys.spindle_speed = 0.0;
910-
prep.current_spindle_pwm = SPINDLE_PWM_OFF_VALUE;
910+
prep.current_spindle_pwm = spindle_pwm_off_value;
911911
}
912912
bit_false(sys.step_control,STEP_CONTROL_UPDATE_SPINDLE_PWM);
913913
}

0 commit comments

Comments
 (0)