Skip to content

Commit 7edc03b

Browse files
committed
Added setting $677 for stepper spindle options.
1 parent bf0a01a commit 7edc03b

File tree

5 files changed

+37
-4
lines changed

5 files changed

+37
-4
lines changed

changelog.md

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,21 @@
11
## grblHAL changelog
22

3+
<a name="20250313">Build 20250313
4+
5+
Core:
6+
7+
* Added setting $677 for stepper spindle options.
8+
9+
Drivers:
10+
11+
* ESP32: added tentative board map for FluidNC v3 6-pack board.
12+
13+
Plugins:
14+
15+
* Spindle: fixed issues with stepper spindle enable/disable via S-commands. Related to issue [#30](https://github.com/grblHAL/Plugins_spindle/issues/30).
16+
17+
---
18+
319
<a name="20250312">20250312
420

521
Core:
@@ -14,7 +30,7 @@ Drivers:
1430

1531
Plugins:
1632

17-
* Spindle: fix for incorrect sign returned from spindle data function used for spindle sync. Depends on stepper configuration.
33+
* Spindle: fix for incorrect sign returned from stepper spindle data function used for spindle sync. Depends on stepper configuration.
1834

1935
---
2036

grbl.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
#else
4343
#define GRBL_VERSION "1.1f"
4444
#endif
45-
#define GRBL_BUILD 20250311
45+
#define GRBL_BUILD 20250313
4646

4747
#define GRBL_URL "https://github.com/grblHAL"
4848

settings.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -455,6 +455,7 @@ typedef enum {
455455
Setting_THC_Options = 674,
456456
Setting_MacroATC_Options = 675,
457457
Setting_ResetActions = 676,
458+
Setting_StepperSpindle_Options = 677,
458459

459460
Setting_SpindleInvertMask1 = 716,
460461

@@ -877,7 +878,8 @@ typedef struct {
877878
axes_signals_t motor_fault_enable;
878879
axes_signals_t motor_fault_invert;
879880
macro_atc_flags_t macro_atc_flags;
880-
char reserved[19]; // Reserved For future expansion
881+
stepper_spindle_settings_flags_t stepper_spindle_flags;
882+
char reserved[18]; // Reserved For future expansion
881883
} settings_t;
882884

883885
typedef enum {

spindle_control.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,16 @@ typedef union {
208208
};
209209
} spindle_settings_flags_t;
210210

211+
typedef union {
212+
uint8_t value;
213+
uint8_t mask;
214+
struct {
215+
uint8_t allow_axis_control :1,
216+
sync_position :1,
217+
unassigned :6;
218+
};
219+
} stepper_spindle_settings_flags_t;
220+
211221
typedef struct {
212222
spindle_state_t invert;
213223
spindle_settings_flags_t flags;

stepper2.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
44
Part of grblHAL
55
6-
Copyright (c) 2023-2024 Terje Io
6+
Copyright (c) 2023-2025 Terje Io
77
88
Algorithm based on article/code by David Austin:
99
https://www.embedded.com/generate-stepper-motor-speed-profiles-in-real-time/
@@ -315,6 +315,11 @@ Motor will be accelerated or decelerated to the new speed.
315315
*/
316316
float st2_motor_set_speed (st2_motor_t *motor, float speed)
317317
{
318+
if(speed == 0.0f) {
319+
st2_motor_stop(motor);
320+
return speed;
321+
}
322+
318323
motor->speed = speed > settings.axis[motor->idx].max_rate ? settings.axis[motor->idx].max_rate : speed;
319324
motor->speed *= settings.axis[motor->idx].steps_per_mm / 60.0f;
320325

0 commit comments

Comments
 (0)