diff --git a/changelog.md b/changelog.md index 2f54da2..4a31d44 100644 --- a/changelog.md +++ b/changelog.md @@ -1,25 +1,51 @@ ## grblHAL changelog +Build 20240330 + +Core: + +* Added capability flags to HAL for all coolant outputs. + +* Hide related settings when no spindle and/or coolant outputs are available. From [PR #479](https://github.com/grblHAL/core/pull/479). + +* Fixed typo related to Modbus direction signal. Ref. issue [#478](https://github.com/grblHAL/core/issues/478). + +* Fixed typo in handling of aux output port settings. Ref issue [#476](https://github.com/grblHAL/core/issues/476). + +Drivers: + +* All: updated for coolant capability flags core change. + +Plugins: + +* Spindle: added packet length to Modbus RX callback. Ref. [issue #26](https://github.com/grblHAL/Plugins_spindle/issues/26). + +* Macros: fixed typo causing compilation to fail. + +* Trinamic: switched to enum for default driver mode to avoid warnings from TI compiler. + +--- + Build 20240328 Core: -* Added missing null spindle handler for ESP32, issue #473. +* Added missing null spindle handler for ESP32, issue [#473](https://github.com/grblHAL/core/issues/473). -* Fix for unable to set $484 to 0, issue #466. +* Fix for unable to set $484 to 0, issue [#466](https://github.com/grblHAL/core/issues/466). * Added setting $673 for setting coolant on delay after feedhold. Available when safety door handling is not enabled. -Fixed obscure bug carried over from legacy Grbl related to this. Issue #467. +Fixed obscure bug carried over from legacy Grbl related to this. Issue [#467](https://github.com/grblHAL/core/issues/467). * Enabled setting $394 for spindle on delay after feedhold. Available when safety door handling is not enabled. Drivers: -* RP2040: Fixed regression causing step generation for BTT SKR Pico to partly fail in some configurations. "Hardened" code. +* RP2040: fixed regression causing step generation for BTT SKR Pico to partly fail in some configurations. "Hardened" code. Plugins: -* Motors: Fixed bug that left ganged motor drivers in wrong state after leaving the ioSender _Trinamic tuner_ tab. +* Motors: fixed bug that left ganged motor drivers in wrong state after leaving the ioSender _Trinamic tuner_ tab. --- @@ -27,7 +53,7 @@ Plugins: Core: -* Fixes for issue #470 and #472, index overflows. +* Fixes for issue [#470](https://github.com/grblHAL/core/issues/470) and [#472](https://github.com/grblHAL/core/issues/472), index overflows. Drivers: diff --git a/driver_opts.h b/driver_opts.h index cf3a7f5..289526d 100644 --- a/driver_opts.h +++ b/driver_opts.h @@ -337,8 +337,8 @@ #define MODBUS_TCP_ENABLED 0b100 #if MODBUS_ENABLE == 2 -#undef MOBUS_ENABLE -#define MOBUS_ENABLE 0b011 +#undef MODBUS_ENABLE +#define MODBUS_ENABLE 0b011 #endif #ifndef MODBUS_ENABLE diff --git a/gcode.c b/gcode.c index d3768e9..e2f46f1 100644 --- a/gcode.c +++ b/gcode.c @@ -1209,12 +1209,13 @@ status_code_t gc_execute_block (char *block) switch(int_value) { case 7: - if(!hal.driver_cap.mist_control) + if(!hal.coolant_cap.mist) FAIL(Status_GcodeUnsupportedCommand); gc_block.modal.coolant.mist = On; break; case 8: + // TODO: check driver cap? gc_block.modal.coolant.flood = On; break; diff --git a/grbl.h b/grbl.h index 5ebfa93..42e26bd 100644 --- a/grbl.h +++ b/grbl.h @@ -42,7 +42,7 @@ #else #define GRBL_VERSION "1.1f" #endif -#define GRBL_BUILD 20240328 +#define GRBL_BUILD 20240330 #define GRBL_URL "https://github.com/grblHAL" diff --git a/grbllib.c b/grbllib.c index d1d85b7..bbfb460 100644 --- a/grbllib.c +++ b/grbllib.c @@ -191,6 +191,7 @@ int grbl_enter (void) hal.irq_disable = dummy_handler; hal.irq_claim = dummy_irq_claim; hal.nvs.size = GRBL_NVS_SIZE; + hal.coolant_cap.flood = On; hal.limits.interrupt_callback = limit_interrupt_handler; hal.control.interrupt_callback = control_interrupt_handler; hal.stepper.interrupt_callback = stepper_driver_interrupt_handler; diff --git a/hal.h b/hal.h index b7e70f7..aa5f47a 100644 --- a/hal.h +++ b/hal.h @@ -5,18 +5,18 @@ Copyright (c) 2016-2024 Terje Io - Grbl is free software: you can redistribute it and/or modify + grblHAL is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - Grbl is distributed in the hope that it will be useful, + grblHAL is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with Grbl. If not, see . + along with grblHAL. If not, see . */ /*! \file @@ -47,8 +47,7 @@ typedef union { uint32_t value; //!< All bitmap flags. struct { - uint32_t mist_control :1, //!< Mist control (M7) is supported. - software_debounce :1, //!< Software debounce of input switches signals is supported. + uint32_t software_debounce :1, //!< Software debounce of input switches signals is supported. step_pulse_delay :1, //!< Stepper step pulse delay is supported. limits_pull_up :1, //!< Pullup resistors for limit inputs are are supported. control_pull_up :1, //!< Pullup resistors for control inputs are supported. @@ -69,7 +68,7 @@ typedef union { odometers :1, pwm_spindle :1, probe_latch :1, - unassigned :9; + unassigned :10; }; } driver_cap_t; @@ -636,6 +635,7 @@ typedef struct { control_signals_t signals_cap; //!< Control input signals supported by the driver. limit_signals_t limits_cap; //!< Limit input signals supported by the driver. home_signals_t home_cap; //!< Home input signals supported by the driver. + coolant_state_t coolant_cap; //!< Coolant outputs supported by the driver. } grbl_hal_t; diff --git a/ioports.c b/ioports.c index 26a20c6..1dfe90c 100644 --- a/ioports.c +++ b/ioports.c @@ -718,7 +718,7 @@ static void ioport_settings_load (void) } while(port); if(digital.out.ports && (port = digital.out.ports->n_ports)) do { - if((xbar = hal.port.get_pin_info(Port_Digital, Port_Output, ioports_map_reverse(digital.in.ports, --port)))) { + if((xbar = hal.port.get_pin_info(Port_Digital, Port_Output, ioports_map_reverse(digital.out.ports, --port)))) { if(xbar->config && !(xbar->mode.pwm || xbar->mode.servo_pwm)) { out_config.inverted = !!(settings.ioport.invert_out.mask & (1 << xbar->id)); out_config.open_drain = !!(settings.ioport.od_enable_out.mask & (1 << xbar->id)); diff --git a/protocol.c b/protocol.c index 16a66ad..5d7d158 100644 --- a/protocol.c +++ b/protocol.c @@ -742,15 +742,13 @@ bool protocol_exec_rt_system (void) switch(rt_exec) { case CMD_OVERRIDE_COOLANT_MIST_TOGGLE: - if (hal.driver_cap.mist_control && ((state_get() == STATE_IDLE) || (state_get() & (STATE_CYCLE | STATE_HOLD)))) { + if(hal.coolant_cap.mist && ((state_get() == STATE_IDLE) || (state_get() & (STATE_CYCLE | STATE_HOLD)))) coolant_state.mist = !coolant_state.mist; - } break; case CMD_OVERRIDE_COOLANT_FLOOD_TOGGLE: - if ((state_get() == STATE_IDLE) || (state_get() & (STATE_CYCLE | STATE_HOLD))) { + if(hal.coolant_cap.flood && ((state_get() == STATE_IDLE) || (state_get() & (STATE_CYCLE | STATE_HOLD)))) coolant_state.flood = !coolant_state.flood; - } break; default: diff --git a/report.c b/report.c index 867546a..c5fc56f 100644 --- a/report.c +++ b/report.c @@ -834,7 +834,7 @@ void report_build_info (char *line, bool extended) *append++ = 'N'; - if(hal.driver_cap.mist_control) + if(hal.coolant_cap.mist) *append++ = 'M'; #if COREXY diff --git a/settings.c b/settings.c index 7744f83..9d0d826 100644 --- a/settings.c +++ b/settings.c @@ -1994,6 +1994,7 @@ static bool is_setting_available (const setting_detail_t *setting) break; #ifndef NO_SAFETY_DOOR_SUPPORT + case Setting_ParkingEnable: case Setting_ParkingAxis: case Setting_ParkingPulloutIncrement: @@ -2002,10 +2003,16 @@ static bool is_setting_available (const setting_detail_t *setting) case Setting_ParkingFastRate: case Setting_RestoreOverrides: case Setting_DoorOptions: - case Setting_DoorSpindleOnDelay: - case Setting_DoorCoolantOnDelay: available = hal.signals_cap.safety_door_ajar; break; + + case Setting_DoorSpindleOnDelay: + available = hal.signals_cap.safety_door_ajar && spindle_get_count() && !spindle_get_caps(true).at_speed; + break; + + case Setting_DoorCoolantOnDelay: + available = hal.signals_cap.safety_door_ajar && hal.coolant_cap.mask; + break; #endif case Setting_SpindleAtSpeedTolerance: @@ -2013,7 +2020,7 @@ static bool is_setting_available (const setting_detail_t *setting) break; case Setting_SpindleOnDelay: - available = !hal.signals_cap.safety_door_ajar && !spindle_get_caps(true).at_speed; + available = !hal.signals_cap.safety_door_ajar && spindle_get_count() && !spindle_get_caps(true).at_speed; break; case Setting_AutoReportInterval: @@ -2041,7 +2048,7 @@ static bool is_setting_available (const setting_detail_t *setting) break; case Setting_HoldCoolantOnDelay: - available = !hal.signals_cap.safety_door_ajar; + available = !hal.signals_cap.safety_door_ajar && hal.coolant_cap.mask; break; default: @@ -2970,8 +2977,7 @@ void settings_init (void) if(hal.stepper.get_ganged) setting_remove_elements(Setting_GangedDirInvertMask, hal.stepper.get_ganged(false).mask); - if(!hal.driver_cap.mist_control) - setting_remove_element(Setting_CoolantInvertMask, 1); + setting_remove_element(Setting_CoolantInvertMask, hal.coolant_cap.mask); #if COMPATIBILITY_LEVEL <= 1 if(hal.homing.get_state == NULL) { diff --git a/spindle_control.c b/spindle_control.c index a6cbb60..275adc2 100644 --- a/spindle_control.c +++ b/spindle_control.c @@ -301,7 +301,7 @@ uint8_t spindle_get_count (void) if(n_spindle == 0) spindle_select(0); - return n_spindle; + return n_spindle == 1 && spindles[0].cfg->type == SpindleType_Null ? 0 : n_spindle; } static spindle_num_t spindle_get_num (spindle_id_t spindle_id)