mirror of
https://github.com/grblHAL/core.git
synced 2026-02-05 16:50:16 +08:00
Added optional spindle select event to core events, for dual spindle enabled configurations (VFD + PWM spindle).
Attempted fix for weird issue with VFD spindle when spindle at speed tolerance is set > 0 with $340.
This commit is contained in:
20
changelog.md
20
changelog.md
@@ -1,5 +1,25 @@
|
||||
## grblHAL changelog
|
||||
|
||||
Build 20220109:
|
||||
|
||||
Core:
|
||||
|
||||
* Added optional spindle select event to core events, for dual spindle enabled configurations \(VFD + PWM spindle\).
|
||||
* Attempted fix for weird issue with VFD spindle when spindle at speed tolerance is set > 0 with `$340`.
|
||||
|
||||
Plugins:
|
||||
|
||||
* Networking: fix for [dependency issue](https://github.com/grblHAL/core/discussions/106) with iMXRT1062 driver when lwIP library was not installed.
|
||||
* Spindle: updated Huanyang VFD driver to support the new spindle select event.
|
||||
Added experimental M-code for switching spindles, `M401P0` for PWM spindle, `M401P1` for VFD spindle. Only available in `DUAL_SPINDLE` configurations.
|
||||
* Keypad: added many new single character commands, mostly the same as available as standard real time commands.
|
||||
|
||||
Drivers:
|
||||
* STM32F4xx: fixed name case for FatFs driver directory, added FatFs R0.13c source.
|
||||
* iMXRT1062, STM32F4xx and SAM3X8E: added `DUAL_SPINDLE` configuration option \(for testing\).
|
||||
|
||||
---
|
||||
|
||||
Build 20220105:
|
||||
|
||||
Core:
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
Part of grblHAL
|
||||
|
||||
Copyright (c) 2020-2021 Terje Io
|
||||
Copyright (c) 2020-2022 Terje Io
|
||||
|
||||
Grbl is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -81,6 +81,7 @@ typedef void (*on_stream_changed_ptr)(stream_type_t type);
|
||||
typedef bool (*on_laser_ppi_enable_ptr)(uint_fast16_t ppi, uint_fast16_t pulse_length);
|
||||
typedef void (*on_homing_rate_set_ptr)(axes_signals_t axes, float rate, bool pulloff);
|
||||
typedef bool (*on_probe_fixture_ptr)(tool_data_t *tool, bool at_g59_3, bool on);
|
||||
typedef bool (*on_spindle_select_ptr)(uint_fast8_t spindle_id);
|
||||
typedef status_code_t (*on_unknown_sys_command_ptr)(sys_state_t state, char *line); // return Status_Unhandled.
|
||||
typedef status_code_t (*on_user_command_ptr)(char *line);
|
||||
typedef sys_commands_t *(*on_get_commands_ptr)(void);
|
||||
@@ -110,6 +111,7 @@ typedef struct {
|
||||
on_homing_rate_set_ptr on_homing_rate_set;
|
||||
on_probe_fixture_ptr on_probe_fixture;
|
||||
on_laser_ppi_enable_ptr on_laser_ppi_enable;
|
||||
on_spindle_select_ptr on_spindle_select;
|
||||
// core entry points - set up by core before driver_init() is called.
|
||||
enqueue_gcode_ptr enqueue_gcode;
|
||||
enqueue_realtime_command_ptr enqueue_realtime_command;
|
||||
|
||||
@@ -188,6 +188,10 @@
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef DUAL_SPINDLE
|
||||
#define DUAL_SPINDLE 0
|
||||
#endif
|
||||
|
||||
#ifndef QEI_ENABLE
|
||||
#define QEI_ENABLE 0
|
||||
#endif
|
||||
|
||||
17
gcode.c
17
gcode.c
@@ -3,7 +3,7 @@
|
||||
|
||||
Part of grblHAL
|
||||
|
||||
Copyright (c) 2017-2021 Terje Io
|
||||
Copyright (c) 2017-2022 Terje Io
|
||||
Copyright (c) 2011-2016 Sungeun K. Jeon for Gnea Research LLC
|
||||
Copyright (c) 2009-2011 Simen Svale Skogsrud
|
||||
|
||||
@@ -330,6 +330,21 @@ bool gc_laser_ppi_enable (uint_fast16_t ppi, uint_fast16_t pulse_length)
|
||||
return grbl.on_laser_ppi_enable && grbl.on_laser_ppi_enable(ppi, pulse_length);
|
||||
}
|
||||
|
||||
void gc_spindle_off (void)
|
||||
{
|
||||
gc_state.spindle.rpm = 0.0f;
|
||||
gc_state.modal.spindle.value = 0;
|
||||
spindle_set_state(gc_state.modal.spindle, gc_state.spindle.rpm);
|
||||
sys.report.spindle = On;
|
||||
}
|
||||
|
||||
void gc_coolant_off (void)
|
||||
{
|
||||
gc_state.modal.coolant.value = 0;
|
||||
hal.coolant.set_state(gc_state.modal.coolant);
|
||||
sys.report.coolant = On;
|
||||
}
|
||||
|
||||
// Add output command to linked list
|
||||
static bool add_output_command (output_command_t *command)
|
||||
{
|
||||
|
||||
8
gcode.h
8
gcode.h
@@ -3,7 +3,7 @@
|
||||
|
||||
Part of grblHAL
|
||||
|
||||
Copyright (c) 2017-2020 Terje Io
|
||||
Copyright (c) 2017-2022 Terje Io
|
||||
Copyright (c) 2011-2016 Sungeun K. Jeon for Gnea Research LLC
|
||||
Copyright (c) 2009-2011 Simen Svale Skogsrud
|
||||
|
||||
@@ -222,7 +222,8 @@ typedef enum {
|
||||
Trinamic_ReportPrewarnFlags = 911, //!< 911 - M122, Marlin format
|
||||
Trinamic_ClearPrewarnFlags = 912, //!< 912 - M122, Marlin format
|
||||
Trinamic_HybridThreshold = 913, //!< 913 - M122, Marlin format
|
||||
Trinamic_HomingSensitivity = 914 //!< 914 - M122, Marlin format
|
||||
Trinamic_HomingSensitivity = 914, //!< 914 - M122, Marlin format
|
||||
Spindle_Select = UserMCode_Generic4 //!< Value to be assigned later!
|
||||
} user_mcode_t;
|
||||
|
||||
//! Data for M62, M63 and M67 commands when executed synchronized with motion.
|
||||
@@ -560,6 +561,9 @@ float *gc_get_scaling (void);
|
||||
// Get current axis offset.
|
||||
float gc_get_offset (uint_fast8_t idx);
|
||||
|
||||
void gc_spindle_off (void);
|
||||
void gc_coolant_off (void);
|
||||
|
||||
void gc_set_tool_offset (tool_offset_mode_t mode, uint_fast8_t idx, int32_t offset);
|
||||
plane_t *gc_get_plane_data (plane_t *plane, plane_select_t select);
|
||||
|
||||
|
||||
2
grbl.h
2
grbl.h
@@ -34,7 +34,7 @@
|
||||
#else
|
||||
#define GRBL_VERSION "1.1f"
|
||||
#endif
|
||||
#define GRBL_BUILD 20220105
|
||||
#define GRBL_BUILD 20220109
|
||||
|
||||
// The following symbols are set here if not already set by the compiler or in config.h
|
||||
// Do NOT change here!
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
Part of grblHAL
|
||||
|
||||
Copyright (c) 2017-2021 Terje Io
|
||||
Copyright (c) 2017-2022 Terje Io
|
||||
Copyright (c) 2011-2015 Sungeun K. Jeon
|
||||
Copyright (c) 2009-2011 Simen Svale Skogsrud
|
||||
|
||||
@@ -212,6 +212,9 @@ int grbl_enter (void)
|
||||
driver.spindle = (!hal.driver_cap.variable_spindle || (hal.spindle.get_pwm != NULL && hal.spindle.update_pwm != NULL));
|
||||
#endif
|
||||
|
||||
if(grbl.on_spindle_select)
|
||||
grbl.on_spindle_select(hal.driver_cap.dual_spindle && settings.mode == Mode_Laser ? 0 : 1);
|
||||
|
||||
if(driver.ok != 0xFF) {
|
||||
sys.alarm = Alarm_SelftestFailed;
|
||||
protocol_enqueue_rt_command(report_driver_error);
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
Part of grblHAL
|
||||
|
||||
Copyright (c) 2017-2021 Terje Io
|
||||
Copyright (c) 2017-2022 Terje Io
|
||||
Copyright (c) 2011-2016 Sungeun K. Jeon for Gnea Research LLC
|
||||
Copyright (c) 2009-2011 Simen Svale Skogsrud
|
||||
|
||||
@@ -787,16 +787,11 @@ status_code_t mc_homing_cycle (axes_signals_t cycle)
|
||||
hal.limits.enable(false, true); // Disable hard limits pin change register for cycle duration
|
||||
|
||||
// Turn off spindle and coolant (and update parser state)
|
||||
if(hal.spindle.get_state().on) {
|
||||
gc_state.spindle.rpm = 0.0f;
|
||||
gc_state.modal.spindle.on = gc_state.modal.spindle.ccw = Off;
|
||||
spindle_set_state(gc_state.modal.spindle, 0.0f);
|
||||
}
|
||||
if(hal.spindle.get_state().on)
|
||||
gc_spindle_off();
|
||||
|
||||
if(hal.coolant.get_state().mask) {
|
||||
gc_state.modal.coolant.mask = 0;
|
||||
coolant_set_state(gc_state.modal.coolant);
|
||||
}
|
||||
if(hal.coolant.get_state().mask)
|
||||
gc_coolant_off();
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Perform homing routine. NOTE: Special motion case. Only system reset works.
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
|
||||
Part of grblHAL
|
||||
|
||||
Copyright (c) 2021 Terje Io
|
||||
Copyright (c) 2021-2022 Terje Io
|
||||
|
||||
Grbl is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -36,6 +36,10 @@
|
||||
#if VFD_ENABLE
|
||||
extern void vfd_init (void);
|
||||
vfd_init();
|
||||
#if DUAL_SPINDLE
|
||||
extern void spindle_select_init(void);
|
||||
spindle_select_init();
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef GRBL_ESP32 // ESP32 has its own bluetooth_init
|
||||
|
||||
11
protocol.c
11
protocol.c
@@ -3,7 +3,7 @@
|
||||
|
||||
Part of grblHAL
|
||||
|
||||
Copyright (c) 2017-202 Terje Io
|
||||
Copyright (c) 2017-2022 Terje Io
|
||||
Copyright (c) 2011-2016 Sungeun K. Jeon for Gnea Research LLC
|
||||
Copyright (c) 2009-2011 Simen Svale Skogsrud
|
||||
|
||||
@@ -496,15 +496,12 @@ bool protocol_exec_rt_system (void)
|
||||
sys.override.control = gc_state.modal.override_ctrl;
|
||||
|
||||
gc_state.tool_change = false;
|
||||
gc_state.modal.coolant.value = 0;
|
||||
gc_state.modal.spindle.value = 0;
|
||||
gc_state.spindle.rpm = sys.spindle_rpm = 0.0f;
|
||||
gc_state.modal.spindle_rpm_mode = SpindleSpeedMode_RPM;
|
||||
|
||||
// Kill spindle and coolant. TODO: Check Mach3 behaviour?
|
||||
hal.spindle.set_state(gc_state.modal.spindle, 0.0f);
|
||||
hal.coolant.set_state(gc_state.modal.coolant);
|
||||
sys.report.spindle = sys.report.coolant = On; // Set to report change immediately
|
||||
gc_spindle_off();
|
||||
gc_coolant_off();
|
||||
|
||||
// Tell driver/plugins about reset.
|
||||
hal.driver_reset();
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
Part of grblHAL
|
||||
|
||||
Copyright (c) 2017-2021 Terje Io
|
||||
Copyright (c) 2017-2022 Terje Io
|
||||
Copyright (c) 2011-2015 Sungeun K. Jeon
|
||||
Copyright (c) 2009-2011 Simen Svale Skogsrud
|
||||
|
||||
@@ -2122,13 +2122,19 @@ status_code_t settings_store_setting (setting_id_t id, char *svalue)
|
||||
}
|
||||
|
||||
if(status == Status_OK) {
|
||||
|
||||
if(set->save)
|
||||
set->save();
|
||||
|
||||
#ifdef ENABLE_BACKLASH_COMPENSATION
|
||||
mc_backlash_init();
|
||||
#endif
|
||||
|
||||
if(set->on_changed)
|
||||
set->on_changed(&settings);
|
||||
|
||||
if(set == &setting_details && grbl.on_spindle_select)
|
||||
grbl.on_spindle_select(hal.driver_cap.dual_spindle && settings.mode == Mode_Laser ? 0 : 1);
|
||||
}
|
||||
|
||||
return status;
|
||||
@@ -2161,6 +2167,7 @@ void settings_init (void)
|
||||
mc_backlash_init();
|
||||
#endif
|
||||
hal.settings_changed(&settings);
|
||||
|
||||
if(hal.probe.configure) // Initialize probe invert mask.
|
||||
hal.probe.configure(false, false);
|
||||
}
|
||||
|
||||
@@ -84,13 +84,14 @@ bool spindle_sync (spindle_state_t state, float rpm)
|
||||
|
||||
// Empty planner buffer to ensure spindle is set when programmed.
|
||||
if((ok = protocol_buffer_synchronize()) && spindle_set_state(state, rpm) && !at_speed) {
|
||||
float delay = 0.0f;
|
||||
float on_delay = 0.0f;
|
||||
while(!(at_speed = hal.spindle.get_state().at_speed)) {
|
||||
delay_sec(0.1f, DelayMode_Dwell);
|
||||
delay += 0.1f;
|
||||
delay_sec(0.2f, DelayMode_Dwell);
|
||||
on_delay += 0.2f;
|
||||
if(ABORTED)
|
||||
break;
|
||||
if(delay >= settings.safety_door.spindle_on_delay) {
|
||||
if(on_delay >= settings.safety_door.spindle_on_delay) {
|
||||
gc_spindle_off();
|
||||
system_raise_alarm(Alarm_Spindle);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
Part of grblHAL
|
||||
|
||||
Copyright (c) 2018-2021 Terje Io
|
||||
Copyright (c) 2018-2022 Terje Io
|
||||
Copyright (c) 2011-2016 Sungeun K. Jeon for Gnea Research LLC
|
||||
Copyright (c) 2009-2011 Simen Svale Skogsrud
|
||||
|
||||
@@ -539,10 +539,8 @@ static void state_await_resume (uint_fast16_t rt_exec)
|
||||
|
||||
default:
|
||||
if (!settings.flags.restore_after_feed_hold) {
|
||||
if (!hal.spindle.get_state().on) {
|
||||
gc_state.spindle.rpm = 0.0f;
|
||||
gc_state.modal.spindle.on = gc_state.modal.spindle.ccw = Off;
|
||||
}
|
||||
if (!hal.spindle.get_state().on)
|
||||
gc_spindle_off();
|
||||
sys.override.spindle_stop.value = 0; // Clear spindle stop override states
|
||||
} else {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user