mirror of
https://github.com/grblHAL/core.git
synced 2026-09-22 03:08:33 +08:00
Added optional RTC (Real Time Clock) support to the HAL. VFS improvements.
This commit is contained in:
@@ -11,7 +11,7 @@ It has been written to complement grblHAL and has features such as proper keyboa
|
||||
|
||||
---
|
||||
|
||||
Latest build date is 20220903, see the [changelog](changelog.md) for details.
|
||||
Latest build date is 20220904, 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.
|
||||
@@ -84,4 +84,4 @@ List of Supported G-Codes:
|
||||
Some [plugins](https://github.com/grblHAL/plugins) implements additional M-codes.
|
||||
|
||||
---
|
||||
2022-09-03
|
||||
2022-09-04
|
||||
|
||||
@@ -1,5 +1,27 @@
|
||||
## grblHAL changelog
|
||||
|
||||
20220904:
|
||||
|
||||
Core:
|
||||
|
||||
* Added optional RTC (Real Time Clock) support to the HAL. VFS improvements.
|
||||
|
||||
Plugins:
|
||||
|
||||
* Networking: improved websocket protocol handling.
|
||||
|
||||
* WebUI: separated command handlers for v2 and v3 and improved detection of v3 clients. Now sets RTC from ESP800 if HAL allows.
|
||||
|
||||
Drivers:
|
||||
|
||||
* RP2040: Added RTC support++.
|
||||
|
||||
* iMXRT1062: updated uSDFS patch - needed for VFS changes.
|
||||
|
||||
* STM32F7xx: updated FatFs options file for better VFS integration.
|
||||
|
||||
---
|
||||
|
||||
20220903:
|
||||
|
||||
Core:
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
#else
|
||||
#define GRBL_VERSION "1.1f"
|
||||
#endif
|
||||
#define GRBL_BUILD 20220903
|
||||
#define GRBL_BUILD 20220904
|
||||
|
||||
// The following symbols are set here if not already set by the compiler or in config.h
|
||||
// Do NOT change here!
|
||||
|
||||
@@ -26,6 +26,8 @@
|
||||
#ifndef _HAL_H_
|
||||
#define _HAL_H_
|
||||
|
||||
#include <time.h>
|
||||
|
||||
#include "grbl.h"
|
||||
#include "core_handlers.h"
|
||||
#include "gcode.h"
|
||||
@@ -470,6 +472,28 @@ typedef struct {
|
||||
*/
|
||||
typedef bool (*irq_claim_ptr)(irq_type_t irq, uint_fast8_t id, irq_callback_ptr callback);
|
||||
|
||||
|
||||
/**************************
|
||||
* RTC (Real Time Clock *
|
||||
**************************/
|
||||
|
||||
/*! \brief Pointer to function for setting the current datetime.
|
||||
\param datetime pointer to a \a tm struct.
|
||||
\returns true if successful.
|
||||
*/
|
||||
typedef bool (*rtc_get_datetime_ptr)(struct tm *datetime);
|
||||
|
||||
/*! \brief Pointer to function for setting the current datetime.
|
||||
\param datetime pointer to a \a tm struct.
|
||||
\returns true if successful.
|
||||
*/
|
||||
typedef bool (*rtc_set_datetime_ptr)(struct tm *datetime);
|
||||
|
||||
typedef struct {
|
||||
rtc_get_datetime_ptr get_datetime; //!< Optional handler getting the current datetime.
|
||||
rtc_set_datetime_ptr set_datetime; //!< Optional handler setting the current datetime.
|
||||
} rtc_ptrs_t;
|
||||
|
||||
/*! \brief HAL structure used for the driver interface.
|
||||
|
||||
This structure contains properties and function pointers (to handlers) that the core uses to communicate with the driver.
|
||||
@@ -549,6 +573,7 @@ typedef struct {
|
||||
settings_changed_ptr settings_changed; //!< Callback handler to be called on settings loaded or settings changed events.
|
||||
probe_ptrs_t probe; //!< Optional handlers for probe input(s).
|
||||
tool_ptrs_t tool; //!< Optional handlers for tool changes.
|
||||
rtc_ptrs_t rtc; //!< Optional handlers for real time clock (RTC).
|
||||
io_port_t port; //!< Optional handlers for axuillary I/O (adds support for M62-M66).
|
||||
periph_port_t periph_port; //!< Optional handlers for peripheral pin registration.
|
||||
driver_reset_ptr driver_reset; //!< Optional handler, called on soft resets. Set to a dummy handler by the core at startup.
|
||||
|
||||
@@ -24,6 +24,8 @@
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#ifndef ARDUINO_SAM_DUE
|
||||
|
||||
#include "hal.h"
|
||||
#include "vfs.h"
|
||||
//#include <errno.h>
|
||||
@@ -340,6 +342,13 @@ int vfs_stat (const char *filename, vfs_stat_t *st)
|
||||
return mount ? mount->vfs->fstat(get_filename(mount, filename), st) : -1;
|
||||
}
|
||||
|
||||
int vfs_utime (const char *filename, struct tm *modified)
|
||||
{
|
||||
vfs_mount_t *mount = get_mount(filename);
|
||||
|
||||
return mount && mount->vfs->futime ? mount->vfs->futime(get_filename(mount, filename), modified) : -1;
|
||||
}
|
||||
|
||||
vfs_free_t *vfs_fgetfree (const char *path)
|
||||
{
|
||||
static vfs_free_t free;
|
||||
@@ -403,6 +412,8 @@ bool vfs_unmount (const char *path)
|
||||
return true;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/*
|
||||
struct tm *gmtime (const time_t *c_t)
|
||||
{
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
#define vfs_load_plugin(x)
|
||||
#define bcopy(src, dest, len) memmove(dest, src, len)
|
||||
|
||||
#ifndef __time_t_defined
|
||||
#if !(defined(__time_t_defined) || defined(__MSP432P401R__) || defined(PART_TM4C123GH6PM))
|
||||
typedef struct {
|
||||
short date;
|
||||
short time;
|
||||
@@ -120,11 +120,13 @@ typedef vfs_dir_t *(*vfs_opendir_ptr)(const char *path);
|
||||
typedef char *(*vfs_readdir_ptr)(vfs_dir_t *dir, vfs_dirent_t *dirent);
|
||||
typedef void (*vfs_closedir_ptr)(vfs_dir_t *dir);
|
||||
typedef int (*vfs_stat_ptr)(const char *filename, vfs_stat_t *st);
|
||||
typedef int (*vfs_utime_ptr)(const char *filename, struct tm *modified);
|
||||
|
||||
typedef bool (*vfs_getfree_ptr)(vfs_free_t *free);
|
||||
|
||||
typedef struct
|
||||
{
|
||||
const char *fs_name;
|
||||
vfs_st_mode_t mode;
|
||||
vfs_open_ptr fopen;
|
||||
vfs_close_ptr fclose;
|
||||
@@ -142,6 +144,7 @@ typedef struct
|
||||
vfs_readdir_ptr readdir;
|
||||
vfs_closedir_ptr fclosedir;
|
||||
vfs_stat_ptr fstat;
|
||||
vfs_utime_ptr futime;
|
||||
vfs_getcwd_ptr fgetcwd;
|
||||
vfs_getfree_ptr fgetfree;
|
||||
} vfs_t;
|
||||
@@ -177,6 +180,7 @@ vfs_dirent_t *vfs_readdir (vfs_dir_t *dir);
|
||||
void vfs_closedir (vfs_dir_t *dir);
|
||||
char *vfs_getcwd (char *buf, size_t len);
|
||||
int vfs_stat (const char *filename, vfs_stat_t *st);
|
||||
int vfs_utime (const char *filename, struct tm *modified);
|
||||
vfs_free_t *vfs_fgetfree (const char *path);
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user