mirror of
https://github.com/grblHAL/core.git
synced 2026-02-05 08:34:01 +08:00
Fixed ioports enumeration issue affecting remapped ports used by the ESP-AT plugin and stream passthru mode.
Changed stream passtrhu mode to not enter coprocessor MCU bootloader mode when turned on.
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
## grblHAL ##
|
||||
|
||||
Latest build date is 20250228, see the [changelog](changelog.md) for details.
|
||||
Latest build date is 20250305, see the [changelog](changelog.md) for details.
|
||||
|
||||
> [!NOTE]
|
||||
> A settings reset will be performed on an update of builds prior to 20241208. Backup and restore of settings is recommended.
|
||||
@@ -89,4 +89,4 @@ G/M-codes not supported by [legacy Grbl](https://github.com/gnea/grbl/wiki) are
|
||||
Some [plugins](https://github.com/grblHAL/plugins) implements additional M-codes.
|
||||
|
||||
---
|
||||
20250228
|
||||
20250305
|
||||
|
||||
24
changelog.md
24
changelog.md
@@ -1,6 +1,28 @@
|
||||
## grblHAL changelog
|
||||
|
||||
<a name="20250229">20250229
|
||||
<a name="20250305">20250305
|
||||
|
||||
Core:
|
||||
|
||||
* Fixed ioports enumeration issue affecting remapped ports used by the ESP-AT plugin and stream passthru mode.
|
||||
|
||||
* Changed stream passtrhu mode to not enter coprocessor MCU bootloader mode when turned on.
|
||||
|
||||
Drivers:
|
||||
|
||||
* Networking capable: updated for networking library changes. Some updated for incorrect sequencing of network events causing static IP mode to fail.
|
||||
|
||||
Plugins:
|
||||
|
||||
* Networking: next step in making library capable of supporting multiple interfaces.
|
||||
|
||||
* WebUI: updated for networking library changes.
|
||||
|
||||
* Misc, ESP-AT: updated to allow it to be used with controllers with ethernet enabled.
|
||||
|
||||
---
|
||||
|
||||
<a name="20250301">20250301
|
||||
|
||||
Drivers:
|
||||
|
||||
|
||||
2
grbl.h
2
grbl.h
@@ -42,7 +42,7 @@
|
||||
#else
|
||||
#define GRBL_VERSION "1.1f"
|
||||
#endif
|
||||
#define GRBL_BUILD 20250228
|
||||
#define GRBL_BUILD 20250305
|
||||
|
||||
#define GRBL_URL "https://github.com/grblHAL"
|
||||
|
||||
|
||||
45
ioports.c
45
ioports.c
@@ -38,6 +38,8 @@ typedef struct {
|
||||
io_ports_detail_t *ports;
|
||||
char port_names[8 * 6 + (MAX_PORTS - 8) * 7];
|
||||
ioport_bus_t enabled;
|
||||
pin_function_t min_fn;
|
||||
pin_function_t max_fn;
|
||||
} io_ports_private_t;
|
||||
|
||||
typedef struct {
|
||||
@@ -49,9 +51,27 @@ typedef struct {
|
||||
|
||||
static driver_settings_load_ptr on_settings_loaded = NULL;
|
||||
static setting_changed_ptr on_setting_changed = NULL;
|
||||
static io_ports_cfg_t analog, digital;
|
||||
static io_ports_cfg_t digital = {
|
||||
.in.min_fn = Input_Aux0, .in.max_fn = Input_AuxMax,
|
||||
.out.min_fn = Output_Aux0, .out.max_fn = Output_AuxMax
|
||||
},
|
||||
analog = {
|
||||
.in.min_fn = Input_Analog_Aux0, .in.max_fn = Input_Analog_AuxMax,
|
||||
.out.min_fn = Output_Analog_Aux0, .out.max_fn = Output_Analog_AuxMax
|
||||
};
|
||||
static int16_t digital_in = -1, digital_out = -1, analog_in = -1, analog_out = -1;
|
||||
|
||||
static inline io_ports_private_t *get_port_data (io_port_type_t type, io_port_direction_t dir)
|
||||
{
|
||||
return type == Port_Digital ? (dir == Port_Input ? &digital.in : &digital.out) : (dir == Port_Input ? &analog.in : &analog.out);
|
||||
}
|
||||
|
||||
// TODO: change to always use ioports_map_reverse()? add range check?
|
||||
static inline uint8_t resolve_portnum (io_ports_private_t *p_data, xbar_t *port)
|
||||
{
|
||||
return port->function >= p_data->min_fn && port->function <= p_data->max_fn ? (port->function - p_data->min_fn) : ioports_map_reverse(p_data->ports, port->id);
|
||||
}
|
||||
|
||||
static uint8_t ioports_count (io_port_type_t type, io_port_direction_t dir)
|
||||
{
|
||||
xbar_t *port;
|
||||
@@ -161,13 +181,11 @@ xbar_t *ioport_get_info (io_port_type_t type, io_port_direction_t dir, uint8_t p
|
||||
{
|
||||
bool ok = false;
|
||||
uint8_t n_ports = ioports_available(type, dir);
|
||||
uint8_t base = type == Port_Digital
|
||||
? (dir == Port_Input ? Input_Aux0 : Output_Aux0)
|
||||
: (dir == Port_Input ? Input_Analog_Aux0 : Output_Analog_Aux0);
|
||||
io_ports_private_t *p_data = get_port_data(type, dir);
|
||||
xbar_t *portinfo = NULL;
|
||||
|
||||
if(hal.port.get_pin_info && n_ports) do {
|
||||
ok = (portinfo = hal.port.get_pin_info(type, dir, --n_ports)) && (portinfo->function - base) == port;
|
||||
ok = (portinfo = hal.port.get_pin_info(type, dir, --n_ports)) && resolve_portnum(p_data, portinfo) == port;
|
||||
} while(n_ports && !ok);
|
||||
|
||||
return ok ? portinfo : NULL;
|
||||
@@ -259,16 +277,17 @@ bool ioport_can_claim_explicit (void)
|
||||
bool ioports_enumerate (io_port_type_t type, io_port_direction_t dir, pin_cap_t filter, ioports_enumerate_callback_ptr callback, void *data)
|
||||
{
|
||||
bool ok = false;
|
||||
uint8_t n_ports = ioports_available(type, dir),
|
||||
base = type == Port_Digital
|
||||
? (dir == Port_Input ? Input_Aux0 : Output_Aux0)
|
||||
: (dir == Port_Input ? Input_Analog_Aux0 : Output_Analog_Aux0);
|
||||
xbar_t *portinfo;
|
||||
uint_fast16_t n_ports = ioports_available(type, dir);
|
||||
io_ports_private_t *p_data = get_port_data(type, dir);
|
||||
|
||||
if(n_ports && ioport_can_claim_explicit()) do {
|
||||
portinfo = hal.port.get_pin_info(type, dir, --n_ports);
|
||||
if((portinfo->cap.mask & filter.mask) == filter.mask && (ok = callback(portinfo, portinfo->function - base, data)))
|
||||
break;
|
||||
|
||||
xbar_t *portinfo;
|
||||
|
||||
if((portinfo = hal.port.get_pin_info(type, dir, --n_ports)) && (portinfo->cap.mask & filter.mask) == filter.mask) {
|
||||
if((ok = callback(portinfo, resolve_portnum(p_data, portinfo), data)))
|
||||
break;
|
||||
}
|
||||
} while(n_ports);
|
||||
|
||||
return ok;
|
||||
|
||||
@@ -23,12 +23,10 @@
|
||||
#include "task.h"
|
||||
#include "protocol.h"
|
||||
|
||||
//static xbar_t *dtr, *rts;
|
||||
static uint8_t boot0_port = 0xFF, reset_port = 0xFF;
|
||||
static io_stream_t dest;
|
||||
static bool conn_ok = false;
|
||||
static on_linestate_changed_ptr on_linestate_changed;
|
||||
//static on_execute_realtime_ptr on_execute_realtime = NULL;
|
||||
|
||||
// Weak implementation of low level function to be provided by the driver
|
||||
|
||||
@@ -39,25 +37,6 @@ __attribute__((weak)) void stream_passthru_enter (void)
|
||||
|
||||
// ****
|
||||
|
||||
|
||||
/*
|
||||
static void onExecuteRealtime (uint_fast16_t state)
|
||||
{
|
||||
static bool lock = false;
|
||||
|
||||
int16_t c;
|
||||
|
||||
if(!lock) {
|
||||
lock = true;
|
||||
if((c = hal.stream.read()) != SERIAL_NO_DATA)
|
||||
dest.write_char(c);
|
||||
lock = false;
|
||||
}
|
||||
|
||||
on_execute_realtime(state);
|
||||
}
|
||||
*/
|
||||
|
||||
ISR_CODE static bool ISR_FUNC(forward_usb_rx)(char c)
|
||||
{
|
||||
dest.write_char(c);
|
||||
@@ -123,16 +102,13 @@ static void passthru_start2 (void *data)
|
||||
|
||||
task_add_delayed(forward_uart_rx, NULL, 8);
|
||||
|
||||
// on_execute_realtime = grbl.on_execute_realtime;
|
||||
// grbl.on_execute_realtime = onExecuteRealtime;
|
||||
|
||||
dest.set_enqueue_rt_handler(stream_buffer_all);
|
||||
dest.cancel_read_buffer();
|
||||
}
|
||||
|
||||
static void passthru_start1 (void *data)
|
||||
{
|
||||
hal.port.digital_out(boot0_port, 0);
|
||||
hal.port.digital_out(boot0_port, 1);
|
||||
hal.port.digital_out(reset_port, 0);
|
||||
|
||||
on_linestate_changed = hal.stream.on_linestate_changed;
|
||||
|
||||
Reference in New Issue
Block a user