Skip to content

Commit

Permalink
Added definition for new plasma THC setting and signals for toolsetter.
Browse files Browse the repository at this point in the history
Added named parameters _probe_state and _toolsetter_state. Both return -1 if state is not available.
These may return incorrect values initially so use with care.
  • Loading branch information
terjeio committed Jan 17, 2025
1 parent 234c560 commit 5f135ed
Show file tree
Hide file tree
Showing 12 changed files with 77 additions and 37 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
## grblHAL ##

Latest build date is 20250114, see the [changelog](changelog.md) for details.
Latest build date is 20250116, 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.
Expand Down Expand Up @@ -93,4 +93,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.

---
20250115
20250116
23 changes: 23 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,28 @@
## grblHAL changelog

<a name="20250116">Build 20250116

Core:

* Added definition for new plasma THC setting and signals for toolsetter.

* Added named parameters `_probe_state` and `_toolsetter_state`. Both return `-1` if state is not available.
These may return incorrect values initially so use with care.

Drivers:

* STM32F4xx: fixed random freezes when WizNet plugin is enabled for ethernet. Ref. issue [#208](https://github.com/grblHAL/STM32F4xx/issues/208).
Added tentative board map for Sienci SuperLongBoard with external drivers \(SLB EXT\) and added support for toolsetter state for both SLB and SLB EXT.

Plugins:

* Plasma: added new setting `$674` for option flags, virtual ports and Z position sync. Ref. issue [#15](https://github.com/grblHAL/Plugin_plasma/issues/15].

* Motors: added optional support for standstill current reduction on motion end for Trinamic TMC2660 drivers.
Settings `$1` and `$37` controls which drivers are kept on.

---

<a name="20250115">20250115

Plugins:
Expand Down
2 changes: 1 addition & 1 deletion grbl.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
#else
#define GRBL_VERSION "1.1f"
#endif
#define GRBL_BUILD 20250114
#define GRBL_BUILD 20250116

#define GRBL_URL "https://github.com/grblHAL"

Expand Down
5 changes: 4 additions & 1 deletion ioports.c
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,10 @@ bool ioport_claim (io_port_type_t type, io_port_direction_t dir, uint8_t *port,

xbar_t *portinfo;

ok = (portinfo = ioport_get_info(type, dir, *port)) && !portinfo->mode.claimed && hal.port.claim(type, dir, port, description);
ok = (portinfo = ioport_get_info(type, dir, *port)) &&
// portinfo->cap.claimable && TODO: add?
!portinfo->mode.claimed &&
hal.port.claim(type, dir, port, description);

} else {

Expand Down
16 changes: 14 additions & 2 deletions ngc_params.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
Part of grblHAL
Copyright (c) 2021-2024 Terje Io
Copyright (c) 2021-2025 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
Expand Down Expand Up @@ -151,6 +151,7 @@ static float probe_result (ngc_param_id_t id)
{
return sys.flags.probe_succeeded ? 1.0f : 0.0f;
}

/*
static float home_pos (ngc_param_id_t id)
{
Expand Down Expand Up @@ -407,9 +408,10 @@ PROGMEM static const ngc_named_ro_param_t ngc_named_ro_param[] = {
{ .name = "_selected_tool", .id = NGCParam_selected_tool },
{ .name = "_selected_pocket", .id = NGCParam_selected_pocket },
{ .name = "_call_level", .id = NGCParam_call_level },
{ .name = "_probe_state", .id = NGCParam_probe_state },
{ .name = "_toolsetter_state", .id = NGCParam_toolsetter_state }
};


// Named parameters

float ngc_named_param_get_by_id (ncg_name_param_id_t id)
Expand Down Expand Up @@ -613,6 +615,16 @@ float ngc_named_param_get_by_id (ncg_name_param_id_t id)
value = (float)ngc_call_level();
break;

// grblHAL extensions

case NGCParam_probe_state:
value = hal.probe.get_state ? (float)hal.probe.get_state().triggered : -1.0f;
break;

case NGCParam_toolsetter_state:
value = hal.probe.get_state && hal.driver_cap.toolsetter ? (float)hal.probe.get_state().tls_triggered : -1.0f;
break;

default:
value = NAN;
}
Expand Down
4 changes: 3 additions & 1 deletion ngc_params.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
Part of grblHAL
Copyright (c) 2021-2024 Terje Io
Copyright (c) 2021-2025 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
Expand Down Expand Up @@ -100,6 +100,8 @@ typedef enum {
NGCParam_selected_tool,
NGCParam_selected_pocket,
NGCParam_call_level,
NGCParam_probe_state,
NGCParam_toolsetter_state,
NGCParam_Last
} ncg_name_param_id_t;

Expand Down
15 changes: 8 additions & 7 deletions probe.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
Part of grblHAL
Copyright (c) 2020-2024 Terje Io
Copyright (c) 2020-2025 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
Expand Down Expand Up @@ -32,12 +32,13 @@ typedef enum {
typedef union {
uint8_t value;
struct {
uint8_t triggered :1, //<! Set to true when probe is triggered.
connected :1, //<! Set to true when probe is connected. Always set to true if the driver does not have a probe connected input.
inverted :1, //<! For driver use
is_probing :1, //<! For driver use
irq_enabled :1, //<! For driver use
unassigned :3;
uint8_t triggered :1, //<! Set to true when probe or toolsetter is triggered.
connected :1, //<! Set to true when probe is connected. Always set to true if the driver does not have a probe connected input.
inverted :1, //<! For driver use
is_probing :1, //<! For driver use
irq_enabled :1, //<! For driver use
tls_triggered :1, //<! Set to true when toolsetter is triggered.
unassigned :2;
};
} probe_state_t;

Expand Down
4 changes: 1 addition & 3 deletions settings.c
Original file line number Diff line number Diff line change
Expand Up @@ -2316,9 +2316,7 @@ void settings_write_build_info (char *line)
bool settings_read_build_info(char *line)
{
if (!(hal.nvs.type != NVS_None && hal.nvs.memcpy_from_nvs((uint8_t *)line, NVS_ADDR_BUILD_INFO, sizeof(stored_line_t), true) == NVS_TransferResult_OK)) {
// Reset line with default value
line[0] = 0; // Empty line
settings_write_build_info(line);
settings_restore((settings_restore_t){ .build_info = On });
return false;
}
return true;
Expand Down
1 change: 1 addition & 0 deletions settings.h
Original file line number Diff line number Diff line change
Expand Up @@ -452,6 +452,7 @@ typedef enum {
Setting_HomePinsInvertMask = 671,
Setting_Reserved672 = 672,
Setting_CoolantOnDelay = 673,
Setting_THC_Options = 674,

Setting_SpindleInvertMask1 = 716,

Expand Down
6 changes: 3 additions & 3 deletions spindle_control.c
Original file line number Diff line number Diff line change
Expand Up @@ -948,17 +948,17 @@ static status_code_t set_pwm_port (setting_id_t id, uint_fast16_t int_value)
return ok ? Status_OK : Status_SettingValueOutOfRange;
}

static bool has_pwm (const setting_detail_t *setting)
static bool has_pwm (const setting_detail_t *setting, uint_fast16_t offset)
{
return spindle_cap.variable;
}

static bool has_freq (const setting_detail_t *setting)
static bool has_freq (const setting_detail_t *setting, uint_fast16_t offset)
{
return spindle_cap.variable && !spindle_cap.cloned;
}

static bool has_ports (const setting_detail_t *setting)
static bool has_ports (const setting_detail_t *setting, uint_fast16_t offset)
{
return ports_ok;
}
Expand Down
2 changes: 1 addition & 1 deletion stream_file.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
Part of grblHAL
Copyright (c) 2025 Terje Io
Copyright (c) 2024-2025 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
Expand Down
32 changes: 16 additions & 16 deletions system.h
Original file line number Diff line number Diff line change
Expand Up @@ -139,22 +139,22 @@ typedef union {
uint16_t mask;
uint16_t value;
struct {
uint16_t reset :1,
feed_hold :1,
cycle_start :1,
safety_door_ajar :1,
block_delete :1,
stop_disable :1, //! M1
e_stop :1,
probe_disconnected :1,
motor_fault :1,
motor_warning :1,
limits_override :1,
single_block :1,
unassigned :1,
probe_overtravel :1, //! used for probe protection
probe_triggered :1, //! used for probe protection
deasserted :1; //! this flag is set if signals are deasserted.
uint16_t reset :1,
feed_hold :1,
cycle_start :1,
safety_door_ajar :1,
block_delete :1,
stop_disable :1, //! M1
e_stop :1,
probe_disconnected :1,
motor_fault :1,
motor_warning :1,
limits_override :1,
single_block :1,
tls_overtravel :1, //! used for probe (toolsetter) protection
probe_overtravel :1, //! used for probe protection
probe_triggered :1, //! used for probe protection
deasserted :1; //! this flag is set if signals are deasserted.
};
} control_signals_t;

Expand Down

0 comments on commit 5f135ed

Please sign in to comment.