diff --git a/README.md b/README.md index 5e356fb..da67bb7 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ It has been written to complement grblHAL and has features such as proper keyboa --- -Latest build date is 20221018, see the [changelog](changelog.md) for details. +Latest build date is 20221021, see the [changelog](changelog.md) for details. __NOTE:__ A settings reset will be performed on an update for versions earlier than 20211122. Backup and restore of settings is recommended. __IMPORTANT!__ A new setting has been introduced for ganged axes motors in version 20211121. I have only bench tested this for a couple of drivers, correct function should be verified after updating by those who have more than three motors configured. diff --git a/changelog.md b/changelog.md index f58b304..8934e05 100644 --- a/changelog.md +++ b/changelog.md @@ -1,6 +1,20 @@ ## grblHAL changelog -Build 202210118 +Build 20221022 + +Core: + +* Fix for old regression, issue #204. + +* Now hides spindle PWM related settings if no PWM spindle is available. + +Drivers: + +Many: Fixes for incorrect code related to new spindle type property introduced in build 20221018. Updated [Web Builder](http://svn.io-engineering.com:8080/) data. + +--- + +Build 20221018 Core: diff --git a/grbl.h b/grbl.h index fc12f78..e86e710 100644 --- a/grbl.h +++ b/grbl.h @@ -34,7 +34,7 @@ #else #define GRBL_VERSION "1.1f" #endif -#define GRBL_BUILD 20221018 +#define GRBL_BUILD 20221022 #define GRBL_URL "https://github.com/grblHAL" diff --git a/hal.h b/hal.h index 839a91f..1b3372a 100644 --- a/hal.h +++ b/hal.h @@ -65,7 +65,8 @@ typedef union { atc :1, //!< Automatic tool changer (ATC) is supported. no_gcode_message_handling :1, odometers :1, - unassigned :12; + pwm_spindle :1, + unassigned :11; }; } driver_cap_t; diff --git a/protocol.c b/protocol.c index 259321b..3ab5fc9 100644 --- a/protocol.c +++ b/protocol.c @@ -198,6 +198,7 @@ bool protocol_main_loop (void) line_flags_t line_flags = {0}; xcommand[0] = '\0'; + char_counter = 0; keep_rt_commands = false; while(true) { diff --git a/settings.c b/settings.c index 62d8a3f..2ff7b59 100644 --- a/settings.c +++ b/settings.c @@ -172,6 +172,7 @@ PROGMEM const settings_t defaults = { .spindle.rpm_max = DEFAULT_SPINDLE_RPM_MAX, .spindle.rpm_min = DEFAULT_SPINDLE_RPM_MIN, + .spindle.flags.pwm_disable = false, .spindle.flags.enable_rpm_controlled = DEFAULT_SPINDLE_ENABLE_OFF_WITH_ZERO_SPEED, .spindle.invert.on = INVERT_SPINDLE_ENABLE_PIN, .spindle.invert.ccw = INVERT_SPINDLE_CCW_PIN, @@ -431,7 +432,7 @@ PROGMEM static const setting_detail_t setting_detail[] = { { Setting_InvertProbePin, Group_Probing, "Invert probe pin", NULL, Format_Bool, NULL, NULL, NULL, Setting_IsLegacyFn, set_probe_invert, get_int, is_setting_available }, { Setting_SpindlePWMBehaviour, Group_Spindle, "Deprecated", NULL, Format_Bool, NULL, NULL, NULL, Setting_IsLegacyFn, set_pwm_mode, get_int, is_setting_available }, { Setting_GangedDirInvertMask, Group_Stepper, "Ganged axes direction invert", NULL, Format_Bitfield, ganged_axes, NULL, NULL, Setting_IsExtendedFn, set_ganged_dir_invert, get_int, is_setting_available }, - { Setting_SpindlePWMOptions, Group_Spindle, "PWM Spindle", NULL, Format_XBitfield, "Enable,RPM controls spindle enable signal", NULL, NULL, Setting_IsExtendedFn, set_pwm_options, get_int, NULL }, + { Setting_SpindlePWMOptions, Group_Spindle, "PWM Spindle", NULL, Format_XBitfield, "Enable,RPM controls spindle enable signal", NULL, NULL, Setting_IsExtendedFn, set_pwm_options, get_int, is_setting_available }, #if COMPATIBILITY_LEVEL <= 1 { Setting_StatusReportMask, Group_General, "Status report options", NULL, Format_Bitfield, "Position in machine coordinate,Buffer state,Line numbers,Feed & speed,Pin state,Work coordinate offset,Overrides,Probe coordinates,Buffer sync on WCO change,Parser state,Alarm substatus,Run substatus", NULL, NULL, Setting_IsExtendedFn, set_report_mask, get_int, NULL }, #else @@ -629,8 +630,8 @@ PROGMEM static const setting_descr_t setting_descr[] = { { Setting_PulseDelayMicroseconds, "Step pulse delay.\\n\\n" "Normally leave this at 0 as there is an implicit delay on direction changes when AMASS is active." }, - { Setting_RpmMax, "Maximum spindle speed. Sets PWM to maximum duty cycle." }, - { Setting_RpmMin, "Minimum spindle speed. Sets PWM to minimum duty cycle." }, + { Setting_RpmMax, "Maximum spindle speed, can be overridden by spindle plugins." }, + { Setting_RpmMin, "Minimum spindle speed, can be overridden by spindle plugins." }, { Setting_Mode, "Laser mode: consecutive G1/2/3 commands will not halt when spindle speed is changed.\\n" "Lathe mode: allows use of G7, G8, G96 and G97." }, @@ -1661,14 +1662,6 @@ static bool is_setting_available (const setting_detail_t *setting) available = hal.stepper.get_ganged && hal.stepper.get_ganged(false).mask != 0; break; - case Setting_SpindlePWMBehaviour: - available = false; - break; - - case Setting_SpindlePWMOptions: - available = spindle_get_caps().laser; - break; - case Setting_InvertProbePin: case Setting_ProbePullUpDisable: case Setting_ProbingFeedOverride: @@ -1678,6 +1671,21 @@ static bool is_setting_available (const setting_detail_t *setting) available = hal.probe.get_state != NULL; break; + case Setting_SpindlePWMBehaviour: + available = false; + break; + + case Setting_SpindlePWMOptions: + available = hal.driver_cap.pwm_spindle && spindle_get_caps().laser; + break; + + case Setting_PWMFreq: + case Setting_PWMOffValue: + case Setting_PWMMinValue: + case Setting_PWMMaxValue: + available = hal.driver_cap.pwm_spindle; + break; + case Setting_SpindleType: available = spindle_get_count() > 1; break; @@ -1688,10 +1696,6 @@ static bool is_setting_available (const setting_detail_t *setting) case Setting_RpmMax: case Setting_RpmMin: - case Setting_PWMFreq: - case Setting_PWMOffValue: - case Setting_PWMMinValue: - case Setting_PWMMaxValue: available = spindle_get_caps().variable; break; diff --git a/spindle_control.c b/spindle_control.c index 5813278..e22206c 100644 --- a/spindle_control.c +++ b/spindle_control.c @@ -44,6 +44,8 @@ spindle_id_t spindle_register (const spindle_ptrs_t *spindle, const char *name) if(n_spindle < N_SPINDLE && settings_add_spindle_type(name)) { spindles[n_spindle++] = spindle; + if(spindle->type == SpindleType_PWM) + hal.driver_cap.pwm_spindle = On; return n_spindle - 1; }