From 2f55555f771450e3d83b0b676f8f45811148dc66 Mon Sep 17 00:00:00 2001 From: Terje Io Date: Thu, 27 Apr 2023 10:14:59 +0200 Subject: [PATCH] Fixed some typos, incorrect default value for setting $63 - Disable laser during hold flag. Added VFS property. --- README.md | 2 +- changelog.md | 24 ++++++++++++++++++++++++ config.h | 20 ++++++++++---------- grbl.h | 2 +- report.c | 2 +- settings.c | 30 +++++++++++++----------------- spindle_control.c | 6 ++++-- spindle_control.h | 2 +- vfs.c | 2 ++ vfs.h | 4 +++- 10 files changed, 60 insertions(+), 34 deletions(-) diff --git a/README.md b/README.md index 600f38c..96811de 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 20230411, see the [changelog](changelog.md) for details. +Latest build date is 20230427 see the [changelog](changelog.md) for details. __NOTE:__ A settings reset will be performed on an update of builds earlier than 20230125. Backup and restore of settings is recommended. __IMPORTANT!__ A new setting has been introduced for ganged axes motors in build 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 883480c..929b570 100644 --- a/changelog.md +++ b/changelog.md @@ -1,5 +1,29 @@ ## grblHAL changelog +Build 20230427 + +Core: + +* Fixed some typos, incorrect default value for setting $63 - _Disable laser during hold_ flag. Added VFS property. + +Drivers: + +* STM32F1xx: fix for [issue #34](https://github.com/grblHAL/STM32F1xx/issues/34), typo blocking GPIO interrupt for pin 4. + +* ESP32: improved handling of I2S/GPIO pin assignments, added _CMakeLists.txt_ option to enable custom _my_plugin.c_. + +* RP2040: added _CMakeLists.txt_ option to enable custom _my_plugin.c_. + +Plugins: + +* WebUI: fix for [issue #10](https://github.com/grblHAL/Plugin_WebUI/issues/10) - problem with saving files. + +* Networking: fix for [WebUI issue #10](https://github.com/grblHAL/Plugin_WebUI/issues/10) - incorrect handling of gzipped files. + +* SDCard: added VFS property. + +--- + 20230417 Core: diff --git a/config.h b/config.h index 563a70b..0cc796a 100644 --- a/config.h +++ b/config.h @@ -736,8 +736,8 @@ be re-enabled by disabling the spindle stop override, if needed. This is purely to ensure the laser doesn't inadvertently remain powered while at a stop and cause a fire. */ ///@{ -#if !defined DEFAULT_ENABLE_LASER_DURING_HOLD || defined __DOXYGEN__ -#define DEFAULT_ENABLE_LASER_DURING_HOLD Off +#if !defined DEFAULT_DISABLE_LASER_DURING_HOLD || defined __DOXYGEN__ +#define DEFAULT_DISABLE_LASER_DURING_HOLD On #endif ///@} @@ -1773,28 +1773,28 @@ Timezone offset from UTC in hours, allowed range is -12.0 - 12.0. */ ///@{ #if !defined DEFAULT_X_ACCELERATION || defined __DOXYGEN__ -#define DEFAULT_X_ACCELERATION 10.0f // mm/min^2 +#define DEFAULT_X_ACCELERATION 10.0f // mm/sec^2 #endif #if !defined DEFAULT_Y_ACCELERATION || defined __DOXYGEN__ -#define DEFAULT_Y_ACCELERATION 10.0f // mm/min^2 +#define DEFAULT_Y_ACCELERATION 10.0f // mm/sec^2 #endif #if !defined DEFAULT_Z_ACCELERATION || defined __DOXYGEN__ -#define DEFAULT_Z_ACCELERATION 10.0f // mm/min^2 +#define DEFAULT_Z_ACCELERATION 10.0f // mm/sec^2 #endif #if (defined A_AXIS && !defined DEFAULT_A_ACCELERATION) || defined __DOXYGEN__ -#define DEFAULT_A_ACCELERATION 10.0f // mm/min^2 +#define DEFAULT_A_ACCELERATION 10.0f // mm/sec^2 #endif #if (defined B_AXIS && !defined DEFAULT_B_ACCELERATION) || defined __DOXYGEN__ -#define DEFAULT_B_ACCELERATION 10.0f // mm/min^2 +#define DEFAULT_B_ACCELERATION 10.0f // mm/sec^2 #endif #if (defined C_AXIS && !defined DEFAULT_C_ACCELERATION) || defined __DOXYGEN__ -#define DEFAULT_C_ACCELERATION 10.0f // mm/min^2 +#define DEFAULT_C_ACCELERATION 10.0f // mm/sec^2 #endif #if (defined U_AXIS && !defined DEFAULT_U_ACCELERATION) || defined __DOXYGEN__ -#define DEFAULT_U_ACCELERATION 10.0f // mm/min^2 +#define DEFAULT_U_ACCELERATION 10.0f // mm/sec^2 #endif #if (defined V_AXIS && !defined DEFAULT_V_ACCELERATION) || defined __DOXYGEN__ -#define DEFAULT_V_ACCELERATION 10.0f // mm/min^2 +#define DEFAULT_V_ACCELERATION 10.0f // mm/sec^2 #endif ///@} diff --git a/grbl.h b/grbl.h index 02d743a..8b96c93 100644 --- a/grbl.h +++ b/grbl.h @@ -42,7 +42,7 @@ #else #define GRBL_VERSION "1.1f" #endif -#define GRBL_BUILD 20230411 +#define GRBL_BUILD 20230427 #define GRBL_URL "https://github.com/grblHAL" diff --git a/report.c b/report.c index ea82d61..ea59379 100644 --- a/report.c +++ b/report.c @@ -816,7 +816,7 @@ void report_build_info (char *line, bool extended) strcpy(buf, "[OPT:"); - if(spindle_get_caps().variable) + if(spindle_get_caps(false).variable) *append++ = 'V'; *append++ = 'N'; diff --git a/settings.c b/settings.c index 16c5b00..4035817 100644 --- a/settings.c +++ b/settings.c @@ -71,7 +71,7 @@ PROGMEM const settings_t defaults = { #endif #if DEFAULT_LASER_MODE .mode = Mode_Laser, - .flags.disable_laser_during_hold = DEFAULT_ENABLE_LASER_DURING_HOLD, + .flags.disable_laser_during_hold = DDEFAULT_DISABLE_LASER_DURING_HOLD #else .flags.disable_laser_during_hold = 0, #if DEFAULT_LATHE_MODE @@ -954,7 +954,7 @@ static status_code_t set_spindle_type (setting_id_t id, uint_fast16_t int_value) static status_code_t set_spindle_invert (setting_id_t id, uint_fast16_t int_value) { settings.spindle.invert.mask = int_value; - if(settings.spindle.invert.pwm && !spindle_get_caps().pwm_invert) { + if(settings.spindle.invert.pwm && !spindle_get_caps(false).pwm_invert) { settings.spindle.invert.pwm = Off; return Status_SettingDisabled; } @@ -1058,20 +1058,16 @@ static status_code_t set_mode (setting_id_t id, uint_fast16_t int_value) switch((machine_mode_t)int_value) { case Mode_Standard: - settings.flags.disable_laser_during_hold = 0; gc_state.modal.diameter_mode = false; break; case Mode_Laser: -// if(!spindle_get_caps().laser) -// return Status_SettingDisabledLaser; - if(settings.mode != Mode_Laser) - settings.flags.disable_laser_during_hold = DEFAULT_ENABLE_LASER_DURING_HOLD; + if(!spindle_get_caps(false).laser) + return Status_SettingDisabledLaser; gc_state.modal.diameter_mode = false; break; case Mode_Lathe: - settings.flags.disable_laser_during_hold = 0; break; default: // Mode_Standard @@ -1755,7 +1751,7 @@ static bool is_setting_available (const setting_detail_t *setting) break; case Setting_SpindlePWMOptions: - available = hal.driver_cap.pwm_spindle && spindle_get_caps().laser; + available = hal.driver_cap.pwm_spindle && spindle_get_caps(false).laser; break; case Setting_PWMFreq: @@ -1775,7 +1771,7 @@ static bool is_setting_available (const setting_detail_t *setting) case Setting_RpmMax: case Setting_RpmMin: - available = spindle_get_caps().variable; + available = spindle_get_caps(false).variable; break; case Setting_DualAxisLengthFailPercent: @@ -1802,11 +1798,11 @@ static bool is_setting_available (const setting_detail_t *setting) #endif case Setting_SpindleAtSpeedTolerance: - available = spindle_get_caps().at_speed || hal.driver_cap.spindle_sync; + available = spindle_get_caps(true).at_speed || hal.driver_cap.spindle_sync; break; case Setting_SpindleOnDelay: - available = !hal.signals_cap.safety_door_ajar && spindle_get_caps().at_speed; + available = !hal.signals_cap.safety_door_ajar && spindle_get_caps(true).at_speed; break; case Setting_AutoReportInterval: @@ -1936,7 +1932,7 @@ bool read_global_settings () bool ok = hal.nvs.type != NVS_None && SETTINGS_VERSION == hal.nvs.get_byte(0) && hal.nvs.memcpy_from_nvs((uint8_t *)&settings, NVS_ADDR_GLOBAL, sizeof(settings_t), true) == NVS_TransferResult_OK; // Sanity check of settings, board map could have been changed... - if(settings.mode == Mode_Laser && !spindle_get_caps().laser) + if(settings.mode == Mode_Laser && !spindle_get_caps(false).laser) settings.mode = Mode_Standard; if(settings.spindle.flags.type >= spindle_get_count()) @@ -1990,8 +1986,8 @@ void settings_restore (settings_restore_t restore) memcpy(&settings, &defaults, sizeof(settings_t)); settings.control_invert.mask &= hal.signals_cap.mask; - settings.spindle.invert.ccw &= spindle_get_caps().direction; - settings.spindle.invert.pwm &= spindle_get_caps().pwm_invert; + settings.spindle.invert.ccw &= spindle_get_caps(false).direction; + settings.spindle.invert.pwm &= spindle_get_caps(false).pwm_invert; #if ENABLE_BACKLASH_COMPENSATION if(sys.driver_started) mc_backlash_init((axes_signals_t){AXES_BITMASK}); @@ -2733,8 +2729,8 @@ void settings_init (void) .on = On, }; - spindle_cap.ccw = spindle_get_caps().direction; - spindle_cap.pwm = spindle_get_caps().pwm_invert; + spindle_cap.ccw = spindle_get_caps(false).direction; + spindle_cap.pwm = spindle_get_caps(false).pwm_invert; setting_remove_elements(Setting_SpindleInvertMask, spindle_cap.mask); setting_remove_elements(Setting_ControlInvertMask, hal.signals_cap.mask); diff --git a/spindle_control.c b/spindle_control.c index 7855704..c2e93e4 100644 --- a/spindle_control.c +++ b/spindle_control.c @@ -228,15 +228,17 @@ spindle_id_t spindle_get_default (void) } /*! \brief Get the merged spindle capabilities of all registered spindles. +\param active true to return active capabilities, false to return default capabilities. \returns capabilities in a \ref spindle_cap_t structure. */ -spindle_cap_t spindle_get_caps (void) +spindle_cap_t spindle_get_caps (bool active) { spindle_cap_t caps = {0}; uint_fast8_t idx = n_spindle; do { - caps.value |= spindles[--idx].hal.cap.value; + --idx; + caps.value |= (active ? spindles[idx].hal.cap.value : spindles[idx].cfg->cap.value); } while(idx); return caps; diff --git a/spindle_control.h b/spindle_control.h index 47d6fdb..6a0411c 100644 --- a/spindle_control.h +++ b/spindle_control.h @@ -268,7 +268,7 @@ uint8_t spindle_get_count (void); bool spindle_select (spindle_id_t spindle_id); -spindle_cap_t spindle_get_caps (void); +spindle_cap_t spindle_get_caps (bool active); void spindle_update_caps (spindle_ptrs_t *spindle, spindle_pwm_t *pwm_caps); diff --git a/vfs.c b/vfs.c index 7a29f68..f063056 100644 --- a/vfs.c +++ b/vfs.c @@ -451,6 +451,7 @@ vfs_drive_t *vfs_get_drive (const char *path) drive.name = mount->vfs->fs_name; drive.path = (const char *)mount->path; drive.mode = mount->vfs->mode; + drive.removable = mount->vfs->removable; drive.fs = mount->vfs; return &drive; @@ -491,6 +492,7 @@ vfs_drive_t *vfs_drives_read (vfs_drives_t *handle) drive.name = handle->mount->vfs->fs_name; drive.path = (const char *)handle->mount->path; drive.mode = handle->mount->vfs->mode; + drive.removable = handle->mount->vfs->removable; drive.fs = handle->mount->vfs; handle->mount = handle->mount->next; diff --git a/vfs.h b/vfs.h index 2089e76..4c160b8 100644 --- a/vfs.h +++ b/vfs.h @@ -5,7 +5,7 @@ Part of grblHAL - Copyright (c) 2022 Terje Io + Copyright (c) 2022-2023 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 @@ -128,6 +128,7 @@ typedef int (*vfs_format_ptr)(void); typedef struct { const char *fs_name; + bool removable; vfs_st_mode_t mode; vfs_open_ptr fopen; vfs_close_ptr fclose; @@ -165,6 +166,7 @@ typedef struct { typedef struct { const char *name; const char *path; + bool removable; vfs_st_mode_t mode; const void *fs; } vfs_drive_t;