From 81fe93adb80fdd943154f8146abfe3ce84352ebb Mon Sep 17 00:00:00 2001 From: Terje Io Date: Thu, 7 Nov 2024 20:44:16 +0100 Subject: [PATCH] Removed deprecated stream flags, added stream event for line state (RTS, DTR) changes - initially for USB streams. --- README.md | 2 +- changelog.md | 20 ++++++++++++++++++++ grbl.h | 2 +- stream.c | 1 - stream.h | 27 +++++++++++++++++++++------ 5 files changed, 43 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index e1f79c2..b288b61 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 20241025, see the [changelog](changelog.md) for details. +Latest build date is 20241107, see the [changelog](changelog.md) for details. __NOTE:__ Build 20240222 has moved the probe input to the ioPorts pool of inputs and will be allocated from it when configured. The change is major and _potentially dangerous_, it may damage your probe, so please _verify correct operation_ after installing this, or later, builds. diff --git a/changelog.md b/changelog.md index cb0346a..ba8195b 100644 --- a/changelog.md +++ b/changelog.md @@ -1,5 +1,25 @@ ## grblHAL changelog +20241107 + +Core: + +* Removed deprecated stream flags, added stream event for line state \(RTS, DTR\) changes - initially for USB streams. + +Drivers: + +* Many: updated for removal of deprecated stream flags in the core. + +* STM32 drivers: added support for line state changed event. + +Plugins: + +* Trinamic: fix for incorrect min/max stepper current validation for TMC2130 and TMC2209. Ref. STM32F4xx [issue #197](https://github.com/grblHAL/STM32F4xx/issues/197). + +* Networking: updated WebSocket daemon for removal of deprecated stream flags in the core. + +--- + 20241030 Core: diff --git a/grbl.h b/grbl.h index 7453bae..76ddaca 100644 --- a/grbl.h +++ b/grbl.h @@ -42,7 +42,7 @@ #else #define GRBL_VERSION "1.1f" #endif -#define GRBL_BUILD 20241025 +#define GRBL_BUILD 20241107 #define GRBL_URL "https://github.com/grblHAL" diff --git a/stream.c b/stream.c index 96faf70..0152e43 100644 --- a/stream.c +++ b/stream.c @@ -63,7 +63,6 @@ static const io_stream_properties_t null_stream = { .instance = 0, .flags.claimable = On, .flags.claimed = Off, - .flags.connected = On, .flags.can_set_baud = On, .claim = stream_null_init }; diff --git a/stream.h b/stream.h index 8a3983f..9e81619 100644 --- a/stream.h +++ b/stream.h @@ -3,7 +3,7 @@ Part of grblHAL - Copyright (c) 2019-2023 Terje Io + Copyright (c) 2019-2024 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 @@ -91,6 +91,15 @@ typedef enum { StreamType_Null } stream_type_t; +typedef union { + uint8_t value; + struct { + uint8_t dtr :1, + rts :1, + unused :6; + }; +} serial_linestate_t; + /*! \brief Pointer to function for getting stream connected status. \returns \a true connected, \a false otherwise. */ @@ -201,26 +210,31 @@ for handing feed-holds, overrides, soft resets etc. */ typedef bool (*disable_rx_stream_ptr)(bool disable); +/*! \brief Pointer to function for handling line state changed events. + +\param \a serial_linestate_t enum. +*/ +typedef void (*on_linestate_changed_ptr)(serial_linestate_t state); + typedef union { uint8_t value; struct { - uint8_t connected :1, //!< deprecated - claimable :1, + uint8_t claimable :1, claimed :1, can_set_baud :1, rx_only :1, modbus_ready :1, rts_handshake :1, - unused :1; + unused :2; }; } io_stream_flags_t; typedef union { uint8_t value; struct { - uint8_t connected :1, - webui_connected :1, + uint8_t webui_connected :1, is_usb :1, + linestate_event :1, //!< Set when driver supports on_linestate_changed event. unused :5; }; } io_stream_state_t; @@ -247,6 +261,7 @@ typedef struct { get_stream_buffer_count_ptr get_tx_buffer_count; //!< Optional handler for getting number of characters in the output buffer(s). Count shall include any unsent characters in any transmit FIFO and/or transmit register. Required for Modbus support. flush_stream_buffer_ptr reset_write_buffer; //!< Optional handler for flushing the output buffer. Any transmit FIFO shall be flushed as well. Required for Modbus support. set_baud_rate_ptr set_baud_rate; //!< Optional handler for setting the stream baud rate. Required for Modbus support, recommended for Bluetooth support. + on_linestate_changed_ptr on_linestate_changed; //!< Optional handler to be called when line state changes. Set by client. vfs_file_t *file; //!< File handle, non-null if streaming from a file. } io_stream_t;