diff --git a/README.md b/README.md
index 6a7faf9..b943d0c 100644
--- a/README.md
+++ b/README.md
@@ -3,7 +3,7 @@
Latest build date is 20241208, see the [changelog](changelog.md) for details.
> [!NOTE]
-> A settings reset will be performed on an update of builds prior to 20241208. Backup and restore of settings is recommended.
+> A settings reset will be performed on an update of builds prior to 20241217. Backup and restore of settings is recommended.
> [!NOTE]
> Build 20240222 has moved the probe input to the ioPorts pool of inputs and will be allocated from it when configured.
@@ -93,4 +93,4 @@ G/M-codes not supported by [legacy Grbl](https://github.com/gnea/grbl/wiki) are
Some [plugins](https://github.com/grblHAL/plugins) implements additional M-codes.
---
-20241209
+20241217
diff --git a/changelog.md b/changelog.md
index 26f6f2d..3c43501 100644
--- a/changelog.md
+++ b/changelog.md
@@ -1,5 +1,23 @@
## grblHAL changelog
+Build 20241217
+
+Core:
+
+* Added preprocessor support for moving coolant outputs to auxiliary pool. Some minor bug fixes and code cleanup.
+Those who have custom board maps must update pin assignments accordingly when updating to this or later versions.
+
+Drivers:
+
+* Most: moved coolant outputs to auxiliary outputs pool for many boards.
+Web Builder functionality for assigning those outputs as coolant or as auxiliary (controlled by M62-M65) will be forthcoming.
+
+* ESP32: added driver support for second PWM spindle, only configurable for the MKS DLC32 v2 board for now.
+
+Plugins:
+
+* Spindle: removed obsoleted code, fix for second PWM spindle w/o direction output.
+
Build 20241214
Core:
diff --git a/coolant_control.h b/coolant_control.h
index be93609..81f4aba 100644
--- a/coolant_control.h
+++ b/coolant_control.h
@@ -25,8 +25,9 @@
// if changed to > 8 bits planner_cond_t needs to be changed too
typedef union {
+ uint8_t bits; //!< Bitmask bits
+ uint8_t mask; //!< Bitmask
uint8_t value; //!< Bitmask value
- uint8_t mask; //!< Synonym for bitmask value
struct {
uint8_t flood :1, //!< Flood coolant.
mist :1, //!< Mist coolant, optional.
diff --git a/crossbar.h b/crossbar.h
index 0c13722..7fd5f88 100644
--- a/crossbar.h
+++ b/crossbar.h
@@ -165,7 +165,11 @@ typedef enum {
Output_Aux9,
Output_Aux10,
Output_Aux11,
- Output_AuxMax = Output_Aux11,
+ Output_Aux12,
+ Output_Aux13,
+ Output_Aux14,
+ Output_Aux15,
+ Output_AuxMax = Output_Aux15,
Output_Analog_Aux0,
Output_Analog_Aux1,
Output_Analog_Aux2,
@@ -376,6 +380,10 @@ PROGMEM static const pin_name_t pin_names[] = {
{ .function = Output_Aux9, .name = "Aux out 9" },
{ .function = Output_Aux10, .name = "Aux out 10" },
{ .function = Output_Aux11, .name = "Aux out 11" },
+ { .function = Output_Aux12, .name = "Aux out 12" },
+ { .function = Output_Aux13, .name = "Aux out 13" },
+ { .function = Output_Aux14, .name = "Aux out 14" },
+ { .function = Output_Aux15, .name = "Aux out 15" },
{ .function = Output_Analog_Aux0, .name = "Aux analog out 0" },
{ .function = Output_Analog_Aux1, .name = "Aux analog out 1" },
{ .function = Output_Analog_Aux2, .name = "Aux analog out 2" },
diff --git a/driver_opts.h b/driver_opts.h
index fce192b..a724b23 100644
--- a/driver_opts.h
+++ b/driver_opts.h
@@ -231,6 +231,51 @@
#endif
#endif
+#ifndef ESTOP_ENABLE
+ #if COMPATIBILITY_LEVEL <= 1
+ #define ESTOP_ENABLE 1
+ #else
+ #define ESTOP_ENABLE 0
+ #endif
+#elif ESTOP_ENABLE && COMPATIBILITY_LEVEL > 1
+ #warning "Enabling ESTOP may not work with all senders!"
+#endif
+
+#define AUX_CONTROL_SPINDLE 0b0001
+#define AUX_CONTROL_COOLANT 0b0010
+#define AUX_CONTROL_DEVICES 0b0100
+#define AUX_CONTROL_INPUTS 0b1000
+
+// Control signals, keep in sync with control_signals_t
+#define CONTROL_RESET 0b0000001
+#define CONTROL_FEEDHOLD 0b0000010
+#define CONTROL_CYCLESTART 0b0000100
+#define CONTROL_SAFETYDOOR 0b0001000
+#define CONTROL_BLOCKDELETE 0b0010000
+#define CONTROL_STOPDISABLE 0b0100000
+#define CONTROL_ESTOP 0b1000000
+
+#ifndef CONTROL_ENABLE
+#if ESTOP_ENABLE
+#define CONTROL_ENABLE (CONTROL_FEEDHOLD|CONTROL_CYCLESTART|CONTROL_ESTOP)
+#else
+#define CONTROL_ENABLE (CONTROL_RESET|CONTROL_FEEDHOLD|CONTROL_CYCLESTART)
+#endif
+#endif
+
+// Coolant signals, keep in sync with coolant_state_t
+#define COOLANT_FLOOD 0b01
+#define COOLANT_MIST 0b10
+
+#ifndef COOLANT_ENABLE
+#define COOLANT_ENABLE (COOLANT_FLOOD|COOLANT_MIST)
+#endif
+
+// Spindle signals
+#define SPINDLE_ENA 0b001
+#define SPINDLE_PWM 0b010
+#define SPINDLE_DIR 0b100
+
#ifndef SPINDLE0_ENABLE
#define SPINDLE0_ENABLE DEFAULT_SPINDLE
#endif
@@ -269,23 +314,29 @@
// Driver spindle 0
-#if SPINDLE_ENABLE & ((1< 1
-#define DRIVER_SPINDLE1_ENABLE 1
+#if SPINDLE_ENABLE & (1< 1 in grbl/config.h when enabling second driver spindle!"
#endif
@@ -303,17 +362,17 @@
#define DRIVER_SPINDLE1_ENABLE 0
#endif
-#if DRIVER_SPINDLE1_ENABLE && (SPINDLE_ENABLE & ((1< 1
- #warning "Enabling ESTOP may not work with all senders!"
-#endif
-
//
#ifndef WIFI_ENABLE
diff --git a/driver_opts2.h b/driver_opts2.h
index 1e0238e..55254d2 100644
--- a/driver_opts2.h
+++ b/driver_opts2.h
@@ -25,28 +25,20 @@
// NOTE: do NOT change options here - edit the driver specific my_machine.h instead!
//
-#if DRIVER_SPINDLE_ENABLE && !defined(SPINDLE_ENABLE_PIN)
+#if (DRIVER_SPINDLE_ENABLE & SPINDLE_ENA) && !defined(SPINDLE_ENABLE_PIN)
#warning "Selected spindle is not supported!"
-#undef DRIVER_SPINDLE_ENABLE
-#define DRIVER_SPINDLE_ENABLE 0
#endif
-#if DRIVER_SPINDLE_DIR_ENABLE && !defined(SPINDLE_DIRECTION_PIN)
+#if (DRIVER_SPINDLE_ENABLE & SPINDLE_DIR) && !defined(SPINDLE_DIRECTION_PIN)
#warning "Selected spindle is not fully supported - no direction output!"
-#undef DRIVER_SPINDLE_DIR_ENABLE
-#define DRIVER_SPINDLE_DIR_ENABLE 0
#endif
-#if DRIVER_SPINDLE_PWM_ENABLE && (!DRIVER_SPINDLE_ENABLE || !defined(SPINDLE_PWM_PIN))
+#if (DRIVER_SPINDLE_ENABLE & SPINDLE_PWM) && !defined(SPINDLE_PWM_PIN)
#warning "Selected spindle is not supported!"
-#undef DRIVER_SPINDLE_PWM_ENABLE
-#define DRIVER_SPINDLE_PWM_ENABLE 0
#endif
-#if DRIVER_SPINDLE_PWM1_ENABLE && (!DRIVER_SPINDLE1_ENABLE || !defined(SPINDLE1_PWM_PIN))
+#if (DRIVER_SPINDLE1_ENABLE & SPINDLE_PWM) && !defined(SPINDLE_PWM_PIN)
#warning "Selected spindle 1 is not supported!"
-#undef DRIVER_SPINDLE_PWM1_ENABLE
-#define DRIVER_SPINDLE_PWM1_ENABLE 0
#endif
#if MPG_ENABLE == 1 && !defined(MPG_MODE_PIN)
@@ -146,6 +138,12 @@
#endif
#endif
+#if defined(COPROC_RESET_PIN) && defined(COPROC_BOOT0_PIN)
+#define COPROC_PASSTHRU 1
+#else
+#define COPROC_PASSTHRU 0
+#endif
+
#ifndef COPROC_STREAM
#if USB_SERIAL_CDC
#define COPROC_STREAM 0
diff --git a/grbl.h b/grbl.h
index 100168c..dfb2cf2 100644
--- a/grbl.h
+++ b/grbl.h
@@ -42,7 +42,7 @@
#else
#define GRBL_VERSION "1.1f"
#endif
-#define GRBL_BUILD 20241214
+#define GRBL_BUILD 20241217
#define GRBL_URL "https://github.com/grblHAL"
diff --git a/machine_limits.c b/machine_limits.c
index f781bd7..82b31a3 100644
--- a/machine_limits.c
+++ b/machine_limits.c
@@ -558,7 +558,7 @@ status_code_t limits_go_home (axes_signals_t cycle)
// If axes in cycle has different feed rates home them separately
if(axis0 == 254) {
- status_code_t status;
+ status_code_t status = Status_OK;
idx = 0;
while(cycle.mask) {
diff --git a/pin_bits_masks.h b/pin_bits_masks.h
index a3d198d..5c16c43 100644
--- a/pin_bits_masks.h
+++ b/pin_bits_masks.h
@@ -392,42 +392,83 @@ static inline control_signals_t aux_ctrl_scan_status (control_signals_t signals)
#define AUX_CONTROLS_SCAN 0
#endif
-#ifdef AUX_CONTROLS_OUT
+#if defined(AUX_CONTROLS_OUT) && !defined(AUX_CONTROLS)
+#define AUX_CONTROLS AUX_CONTROL_SPINDLE
+#elif !defined(AUX_CONTROLS)
+#define AUX_CONTROLS 0
+#endif
+
+#if AUX_CONTROLS
// The following pins are bound explicitly to aux output pins
static aux_ctrl_out_t aux_ctrl_out[] = {
-#if DRIVER_SPINDLE_ENABLE
+#if AUX_CONTROLS & AUX_CONTROL_SPINDLE
+#ifdef SPINDLE_ENABLE_PIN
+ #ifndef SPINDLE_ENABLE_PORT
+ #define SPINDLE_ENABLE_PORT NULL
+ #endif
{ .function = Output_SpindleOn, .aux_port = 0xFF, .pin = SPINDLE_ENABLE_PIN, .port = SPINDLE_ENABLE_PORT },
-#if DRIVER_SPINDLE_PWM_ENABLE
+#endif
+#ifdef SPINDLE_PWM_PIN
+ #ifndef SPINDLE_PWM_PORT
+ #define SPINDLE_PWM_PORT NULL
+ #endif
{ .function = Output_SpindlePWM, .aux_port = 0xFF, .pin = SPINDLE_PWM_PIN, .port = SPINDLE_PWM_PORT },
#endif
-#if DRIVER_SPINDLE_DIR_ENABLE
+#ifdef SPINDLE_DIRECTION_PIN
+ #ifndef SPINDLE_DIRECTION_PORT
+ #define SPINDLE_DIRECTION_PORT NULL
+ #endif
{ .function = Output_SpindleDir, .aux_port = 0xFF, .pin = SPINDLE_DIRECTION_PIN, .port = SPINDLE_DIRECTION_PORT },
#endif
-#endif // DRIVER_SPINDLE_ENABLE
-#if DRIVER_SPINDLE1_ENABLE
+
+#ifdef SPINDLE1_ENABLE_PIN
+ #ifndef SPINDLE1_ENABLE_PORT
+ #define SPINDLE1_ENABLE_PORT NULL
+ #endif
{ .function = Output_Spindle1On, .aux_port = 0xFF, .pin = SPINDLE1_ENABLE_PIN, .port = SPINDLE1_ENABLE_PORT },
-#if DRIVER_SPINDLE1_PWM_ENABLE
+#endif
+#ifdef SPINDLE1_PWM_PIN
+ #ifndef SPINDLE1_PWM_PORT
+ #define SPINDLE1_PWM_PORT NULL
+ #endif
{ .function = Output_Spindle1PWM, .aux_port = 0xFF, .pin = SPINDLE1_PWM_PIN, .port = SPINDLE1_PWM_PORT },
#endif
-#if DRIVER_SPINDLE1_DIR_ENABLE
+#ifdef SPINDLE1_DIRECTION_PIN
+ #ifndef SPINDLE1_DIRECTION_PORT
+ #define SPINDLE1_DIRECTION_PORT NULL
+ #endif
{ .function = Output_Spindle1Dir, .aux_port = 0xFF, .pin = SPINDLE1_DIRECTION_PIN, .port = SPINDLE1_DIRECTION_PORT },
#endif
-#endif // DRIVER_SPINDLE1_DIR_ENABLE
+#endif // SPINDLES
+
+#if AUX_CONTROLS & AUX_CONTROL_COOLANT
+#ifdef COOLANT_FLOOD_PIN
+ #ifndef COOLANT_FLOOD_PORT
+ #define COOLANT_FLOOD_PORT NULL
+ #endif
+ { .function = Output_CoolantFlood, .aux_port = 0xFF, .pin = COOLANT_FLOOD_PIN, .port = COOLANT_FLOOD_PORT },
+#endif
+#ifdef COOLANT_MIST_PIN
+ #ifndef COOLANT_MIST_PORT
+ #define COOLANT_MIST_PORT NULL
+ #endif
+ { .function = Output_CoolantMist, .aux_port = 0xFF, .pin = COOLANT_MIST_PIN, .port = COOLANT_MIST_PORT },
+#endif
+#endif // COOLANT
+
#ifdef COPROC_RESET_PIN
+ #ifndef COPROC_RESET_PORT
+ #define COPROC_RESET_PORT NULL
+ #endif
{ .function = Output_CoProc_Reset, .aux_port = 0xFF, .pin = COPROC_RESET_PIN, .port = COPROC_RESET_PORT },
#endif
#ifdef COPROC_BOOT0_PIN
+ #ifndef COPROC_BOOT0_PORT
+ #define COPROC_BOOT0_PORT NULL
+ #endif
{ .function = Output_CoProc_Boot0, .aux_port = 0xFF, .pin = COPROC_BOOT0_PIN, .port = COPROC_BOOT0_PORT },
#endif
-/*
-#ifdef COOLANT_FLOOD_PIN
- { .function = Output_CoolantFlood, .aux_port = 0xFF, .pin = COOLANT_FLOOD_PIN, .port = COOLANT_FLOOD_PORT },
-#endif
-#ifdef COOLANT_MIST_PIN
- { .function = Output_CoolantMist, .aux_port = 0xFF, .pin = COOLANT_MIST_PIN, .port = COOLANT_MIST_PORT },
-#endif
-*/
};
static inline aux_ctrl_out_t *aux_out_remap_explicit (void *port, uint8_t pin, uint8_t aux_port, void *output)
@@ -473,7 +514,7 @@ static inline void aux_ctrl_claim_out_ports (aux_claim_explicit_out_ptr aux_clai
}
}
-#endif // AUX_CONTROLS_OUT
+#endif // AUX_CONTROLS
//
diff --git a/plugins_init.h b/plugins_init.h
index 4cd6129..ed0fb39 100644
--- a/plugins_init.h
+++ b/plugins_init.h
@@ -58,7 +58,7 @@
onoff_spindle_init();
#endif
-#if SPINDLE_ENABLE & (1<compute_value = compute_dummy_pwm_value;
}
- pwm_data->flags.invert_pwm = pwm_data->flags.invert_pwm;
- pwm_data->flags.always_on = pwm_data->flags.always_on;
- pwm_data->flags.cloned = pwm_data->flags.cloned;
-
spindle->context.pwm = pwm_data;
#if ENABLE_SPINDLE_LINEARIZATION
diff --git a/system.h b/system.h
index 3ba90bf..f04d98f 100644
--- a/system.h
+++ b/system.h
@@ -135,8 +135,9 @@ typedef union {
// NOTE: the pin_function_t enum must be kept in sync with any changes!
typedef union {
- uint16_t value;
+ uint16_t bits;
uint16_t mask;
+ uint16_t value;
struct {
uint16_t reset :1,
feed_hold :1,