mirror of
https://github.com/grblHAL/core.git
synced 2026-08-17 08:31:43 +08:00
Changes to VFS API signatures to aid improved handling of file system formatting.
Now turns off spindle(s) on spindle related settings changes.
This commit is contained in:
@@ -1,5 +1,27 @@
|
||||
## grblHAL changelog
|
||||
|
||||
<a name="20260718>Build 20260718
|
||||
|
||||
Core:
|
||||
|
||||
* Changes to VFS API signatures to aid improved handling of file system formatting.
|
||||
|
||||
Drivers:
|
||||
|
||||
* ESP32, PiBot Ultra board: force stream assignments for modbus and MPG.
|
||||
|
||||
* iMXRT1062: fixed typo preventing use of serial port 0 in some configurations.
|
||||
|
||||
Plugins:
|
||||
|
||||
* SD card, networking, WebUI: updated for VFS API changes, improved formatting of SD card \(FatFs\) and littlefs.
|
||||
|
||||
* EEPROM: added support for 1Mbit EEPROMS, improved littlefs EEPROM low-level driver.
|
||||
|
||||
* Keypad, display interface: fix for missing probe state report.
|
||||
|
||||
---
|
||||
|
||||
<a name="20260709">Build 20260709
|
||||
|
||||
Core:
|
||||
|
||||
@@ -326,6 +326,10 @@
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(MPG_STREAM) && MPG_STREAM == 0 && (MODBUS_ENABLE & MODBUS_RTU_ENABLED) && !defined(MODBUS_RTU_STREAM)
|
||||
#define MODBUS_RTU_STREAM (MPG_STREAM + 1)
|
||||
#endif
|
||||
|
||||
#if MPG_ENABLE && MPG_ENABLE != 2 && MPG_STREAM == 20 && BLUETOOTH_ENABLE != 1
|
||||
#error "MPG can only be used with native Bluetooth and character mode switching!"
|
||||
#endif
|
||||
|
||||
+2
-2
@@ -3,7 +3,7 @@
|
||||
|
||||
Part of grblHAL
|
||||
|
||||
Copyright (c) 2025 Terje Io
|
||||
Copyright (c) 2025-2026 Terje Io
|
||||
|
||||
grblHAL is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -220,5 +220,5 @@ void fs_device_mount (void)
|
||||
static bool ok = false;
|
||||
|
||||
if(!ok)
|
||||
ok = vfs_mount("/dev", &fs, (vfs_st_mode_t){ .directory = true, .hidden = true });
|
||||
ok = vfs_mount(NULL, "/dev", &fs, (vfs_st_mode_t){ .directory = true, .hidden = true });
|
||||
}
|
||||
|
||||
@@ -132,6 +132,7 @@ DCRAM parser_state_t gc_state;
|
||||
m98_macro_t *m98_macros = NULL;
|
||||
static tool_data_t *pending_tool = NULL;
|
||||
static output_command_t *output_commands = NULL; // Linked list
|
||||
static settings_changed_ptr settings_changed = NULL;
|
||||
static scale_factor_t scale_factor = {
|
||||
.ijk[X_AXIS] = 1.0f,
|
||||
.ijk[Y_AXIS] = 1.0f,
|
||||
@@ -747,6 +748,14 @@ static status_code_t gc_at_exit (status_code_t status)
|
||||
return status;
|
||||
}
|
||||
|
||||
static void onSettingsChanged (settings_t *settings, settings_changed_flags_t changed)
|
||||
{
|
||||
if(changed.spindle || changed.restore_defaults)
|
||||
gc_spindle_off();
|
||||
|
||||
settings_changed(settings, changed);
|
||||
}
|
||||
|
||||
FLASHMEM void gc_init (bool stop)
|
||||
{
|
||||
#if COMPATIBILITY_LEVEL > 1
|
||||
@@ -788,6 +797,11 @@ FLASHMEM void gc_init (bool stop)
|
||||
}
|
||||
#endif
|
||||
|
||||
if(settings_changed == NULL) {
|
||||
settings_changed = grbl.on_settings_changed;
|
||||
grbl.on_settings_changed = onSettingsChanged;
|
||||
}
|
||||
|
||||
// Clear any pending output commands etc...
|
||||
gc_at_exit(Status_UserException);
|
||||
|
||||
@@ -871,6 +885,7 @@ FLASHMEM void gc_spindle_off (void)
|
||||
report_add_realtime(Report_Spindle);
|
||||
}
|
||||
|
||||
|
||||
FLASHMEM void gc_coolant (coolant_state_t state)
|
||||
{
|
||||
gc_state.modal.coolant = state;
|
||||
|
||||
@@ -42,7 +42,7 @@
|
||||
#else
|
||||
#define GRBL_VERSION "1.1f"
|
||||
#endif
|
||||
#define GRBL_BUILD 20260712
|
||||
#define GRBL_BUILD 20260718
|
||||
|
||||
#define GRBL_URL "https://github.com/grblHAL"
|
||||
|
||||
|
||||
+4
-3
@@ -608,7 +608,7 @@ typedef union {
|
||||
keep_rapids_override_on_reset :1,
|
||||
keep_feed_override_on_reset :1,
|
||||
m98_prescan_enable :1,
|
||||
unassigned :8;
|
||||
unassigned :8;
|
||||
};
|
||||
} settingflags_t;
|
||||
|
||||
@@ -1058,8 +1058,9 @@ typedef struct {
|
||||
typedef union {
|
||||
uint8_t value;
|
||||
struct {
|
||||
uint8_t spindle :1,
|
||||
unassigned :7;
|
||||
uint8_t spindle :1,
|
||||
restore_defaults :1,
|
||||
unassigned :6;
|
||||
};
|
||||
} settings_changed_flags_t;
|
||||
|
||||
|
||||
@@ -48,6 +48,7 @@
|
||||
#define SPINDLE_STEPPER 19
|
||||
#define SPINDLE_NOWFOREVER 20
|
||||
#define SPINDLE_MY_SPINDLE 30
|
||||
#define SPINDLE_REFID_MAX SPINDLE_NOWFOREVER
|
||||
|
||||
#define SPINDLE_ALL_VFD ((1<<SPINDLE_HUANYANG1)|(1<<SPINDLE_HUANYANG2)|(1<<SPINDLE_GS20)|(1<<SPINDLE_YL620A)|(1<<SPINDLE_MODVFD)|(1<<SPINDLE_H100)|(1<<SPINDLE_NOWFOREVER))
|
||||
#define SPINDLE_ALL (SPINDLE_ALL_VFD|(1<<SPINDLE_PWM0))
|
||||
|
||||
@@ -48,6 +48,9 @@ static inline vfs_mount_t *path_is_mount_dir (const char *path)
|
||||
|
||||
size_t mlen;
|
||||
|
||||
if(*(path + plen - 1) == '/')
|
||||
plen--;
|
||||
|
||||
if((mount = mount->next)) do {
|
||||
mlen = strlen(mount->path) - 1;
|
||||
if(mlen == plen && !strncmp(mount->path, path, mlen))
|
||||
@@ -124,21 +127,10 @@ static char *fs_readdir (vfs_dir_t *dir, vfs_dirent_t *dirent)
|
||||
|
||||
vfs_errno = 0;
|
||||
|
||||
if(*mount) {
|
||||
strcpy(dirent->name, (*mount)->path + 1);
|
||||
if(*dirent->name)
|
||||
*(strchr(dirent->name, '\0') - 1) = '\0';
|
||||
dirent->st_mode = (*mount)->mode;
|
||||
dirent->st_mode.directory = true;
|
||||
*mount = NULL;
|
||||
/* while((*mount = (*mount)->next)) {
|
||||
if(!(*mount)->mode.hidden)
|
||||
break;
|
||||
}*/
|
||||
} else
|
||||
|
||||
*dirent->name = '\0';
|
||||
|
||||
return *dirent->name ? dirent->name : NULL;
|
||||
return NULL; //*dirent->name ? dirent->name : NULL;
|
||||
}
|
||||
|
||||
static void fs_closedir (vfs_dir_t *dir)
|
||||
@@ -575,20 +567,24 @@ static bool vfs_get_time (struct tm *time)
|
||||
{
|
||||
memset(time, 0, sizeof(struct tm));
|
||||
|
||||
// 2025-01-01:00:00:00
|
||||
time->tm_year = 2025 - 1900;
|
||||
// 2026-01-01:00:00:00
|
||||
time->tm_year = 2026 - 1900;
|
||||
time->tm_mday = 1;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool vfs_mount (const char *path, const vfs_t *fs, vfs_st_mode_t mode)
|
||||
bool vfs_mount (const void *device, const char *path, const vfs_t *fs, vfs_st_mode_t mode)
|
||||
{
|
||||
vfs_mount_t *mount;
|
||||
|
||||
if((mount = path_is_mount_dir(path)) && mount->vfs != &fs_null)
|
||||
return mount->vfs == fs;
|
||||
|
||||
if(!strcmp(path, "/")) {
|
||||
root.vfs = fs;
|
||||
root.mode = mode;
|
||||
root.device = device;
|
||||
} else if((mount = (vfs_mount_t *)calloc(1, sizeof(vfs_mount_t)))) {
|
||||
|
||||
struct tm tm;
|
||||
@@ -600,6 +596,7 @@ bool vfs_mount (const char *path, const vfs_t *fs, vfs_st_mode_t mode)
|
||||
mount->vfs = fs;
|
||||
mount->mode = mode;
|
||||
mount->next = NULL;
|
||||
mount->device = device;
|
||||
if(hal.rtc.get_datetime && hal.rtc.get_datetime(&tm)) {
|
||||
#ifdef ESP_PLATFORM
|
||||
mount->st_mtim = mktime(&tm);
|
||||
@@ -625,7 +622,7 @@ bool vfs_mount (const char *path, const vfs_t *fs, vfs_st_mode_t mode)
|
||||
return fs != NULL;
|
||||
}
|
||||
|
||||
bool vfs_unmount (const char *path)
|
||||
bool vfs_unmount (const void *device, const char *path)
|
||||
{
|
||||
// TODO: close open files?
|
||||
|
||||
@@ -746,8 +743,31 @@ vfs_free_t *vfs_drive_getfree (vfs_drive_t *drive)
|
||||
int vfs_drive_format (vfs_drive_t *drive)
|
||||
{
|
||||
const vfs_t *fs = drive->fs;
|
||||
vfs_mount_t *mount = path_is_mount_dir(drive->path);
|
||||
|
||||
stream_await_tx_clear(&hal.stream);
|
||||
|
||||
return (vfs_errno = fs->format ? fs->format() : -1);
|
||||
if(mount && fs->format) {
|
||||
|
||||
int errno;
|
||||
|
||||
if(mount == cwdmount)
|
||||
strcpy(cwd, "/");
|
||||
|
||||
if(vfs.on_unmount)
|
||||
vfs.on_unmount(drive->path);
|
||||
|
||||
if((errno = fs->format()) == 0) {
|
||||
if(fs->device_mount && !fs->device_mount(mount->device, true))
|
||||
errno = -1;
|
||||
if(errno == 0 && vfs.on_mount)
|
||||
vfs.on_mount(drive->path, drive->fs, drive->mode);
|
||||
}
|
||||
|
||||
if((vfs_errno = errno) && fs->device_mount)
|
||||
fs->device_mount(mount->device, false); // dismount drive on error
|
||||
} else
|
||||
vfs_errno = -1;
|
||||
|
||||
return vfs_errno;
|
||||
}
|
||||
|
||||
@@ -137,6 +137,7 @@ typedef int (*vfs_utime_ptr)(const char *filename, struct tm *modified);
|
||||
|
||||
typedef bool (*vfs_getfree_ptr)(vfs_free_t *free);
|
||||
typedef int (*vfs_format_ptr)(void);
|
||||
typedef bool (*vfs_device_mount_ptr)(const void *dev, bool mount);
|
||||
|
||||
typedef struct
|
||||
{
|
||||
@@ -163,6 +164,7 @@ typedef struct
|
||||
vfs_getcwd_ptr fgetcwd;
|
||||
vfs_getfree_ptr fgetfree;
|
||||
vfs_format_ptr format;
|
||||
vfs_device_mount_ptr device_mount;
|
||||
} vfs_t;
|
||||
|
||||
typedef void (*on_vfs_changed_ptr)(const vfs_t *fs);
|
||||
@@ -178,6 +180,7 @@ typedef struct {
|
||||
typedef struct vfs_mount
|
||||
{
|
||||
char path[VFS_MOUNT_PATH_LEN];
|
||||
const void *device;
|
||||
const vfs_t *vfs;
|
||||
vfs_st_mode_t mode;
|
||||
#ifdef ESP_PLATFORM // some versions of ESP-IDF/Compiler combos are fcked up
|
||||
@@ -217,8 +220,8 @@ extern vfs_events_t vfs;
|
||||
|
||||
char *vfs_fixpath (char *path);
|
||||
|
||||
bool vfs_mount (const char *path, const vfs_t *fs, vfs_st_mode_t mode);
|
||||
bool vfs_unmount (const char *path);
|
||||
bool vfs_mount (const void *device, const char *path, const vfs_t *fs, vfs_st_mode_t mode);
|
||||
bool vfs_unmount (const void *device, const char *path);
|
||||
vfs_file_t *vfs_open (const char *filename, const char *mode);
|
||||
void vfs_close (vfs_file_t *file);
|
||||
size_t vfs_read (void *buffer, size_t size, size_t count, vfs_file_t *file);
|
||||
|
||||
Reference in New Issue
Block a user