Fixed incorrect implementation of EXISTS function. Ref. issue #527.

Added missing clear of parser tool change state when cycle start signal is asserted.
Affects tool change mode 'Normal' ($341=0).
This commit is contained in:
Terje Io
2024-06-04 12:57:17 +07:00
parent f8e0150c77
commit 0a86e57ddc
6 changed files with 44 additions and 20 deletions

View File

@@ -13,7 +13,7 @@ It has been written to complement grblHAL and has features such as proper keyboa
---
Latest build date is 20240602, see the [changelog](changelog.md) for details.
Latest build date is 20240604, 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.

View File

@@ -1,5 +1,15 @@
## grblHAL changelog
<a name="20240604"/>Build 20240604
Core:
* Fixed incorrect implementation of `EXISTS` function. Ref. [issue #527](https://github.com/grblHAL/core/issues/527).
* Added missing clear of parser tool change state when cycle start signal is asserted. Affects tool change mode 'Normal' ($341=0).
---
<a name="20240602"/>Build 20240602
Core:

2
grbl.h
View File

@@ -42,7 +42,7 @@
#else
#define GRBL_VERSION "1.1f"
#endif
#define GRBL_BUILD 20240602
#define GRBL_BUILD 20240604
#define GRBL_URL "https://github.com/grblHAL"

View File

@@ -53,7 +53,7 @@ typedef enum {
NGCBinaryOp_LE,
NGCBinaryOp_GE,
NGCBinaryOp_GT,
NGCBinaryOp_RelationalLast = NGCBinaryOp_GT,
NGCBinaryOp_RelationalLast = NGCBinaryOp_GT
} ngc_binary_op_t;
typedef enum {
@@ -70,7 +70,7 @@ typedef enum {
NGCUnaryOp_SIN,
NGCUnaryOp_SQRT,
NGCUnaryOp_TAN,
NGCUnaryOp_Exists, // Not implemented
NGCUnaryOp_Exists
} ngc_unary_op_t;
/*! \brief Executes the operations: /, MOD, ** (POW), *.
@@ -675,19 +675,22 @@ static status_code_t read_unary (char *line, uint_fast8_t *pos, float *value)
else {
if (operation == NGCUnaryOp_Exists) {
if(operation == NGCUnaryOp_Exists) {
char *arg = &line[++(*pos)], *s;
char *arg = &line[++(*pos)], *s = NULL;
s = arg;
while(*s && *s != ']')
s++;
if(*arg == '#' && *(arg + 1) == '<') {
arg += 2;
s = arg;
while(*s && *s != ']')
s++;
}
if(*s == ']') {
*s = '\0';
if(s && *s == ']' && *(s - 1) == '>') {
*(s - 1) = '\0';
*value = ngc_named_param_exists(arg) ? 1.0f : 0.0f;
*s = ']';
*pos = *pos + s - arg + 1;
*(s - 1) = '>';
*pos = *pos + s - arg + 3;
} else
status = Status_ExpressionSyntaxError;

View File

@@ -391,6 +391,17 @@ typedef enum {
Setting_Panel_Encoder3_Cpd = 559,
Setting_Panel_SettingsMax = 579,
Setting_ButtonAction0 = 590,
Setting_ButtonAction1 = 591,
Setting_ButtonAction2 = 592,
Setting_ButtonAction3 = 593,
Setting_ButtonAction4 = 594,
Setting_ButtonAction5 = 595,
Setting_ButtonAction6 = 596,
Setting_ButtonAction7 = 597,
Setting_ButtonAction8 = 598,
Setting_ButtonAction9 = 599,
Setting_ModbusTCPBase = 600, // Reserving settings values 600 to 639 for ModBus TCP (8 sets)
Setting_ModbusIpAddressBase = Setting_ModbusTCPBase + Setting_ModbusIpAddress,
Setting_ModbusPortBase = Setting_ModbusTCPBase + Setting_ModbusPort,

View File

@@ -74,11 +74,11 @@ ISR_CODE void ISR_FUNC(control_interrupt_handler)(control_signals_t signals)
sys.last_event.control.value = signals.value;
if ((signals.reset || signals.e_stop || signals.motor_fault) && state_get() != STATE_ESTOP)
if((signals.reset || signals.e_stop || signals.motor_fault) && state_get() != STATE_ESTOP)
mc_reset();
else {
#ifndef NO_SAFETY_DOOR_SUPPORT
if (signals.safety_door_ajar && hal.signals_cap.safety_door_ajar) {
if(signals.safety_door_ajar && hal.signals_cap.safety_door_ajar) {
if(settings.safety_door.flags.ignore_when_idle) {
// Only stop the spindle (laser off) when idle or jogging,
// this to allow positioning the controlled point (spindle) when door is open.
@@ -91,27 +91,27 @@ ISR_CODE void ISR_FUNC(control_interrupt_handler)(control_signals_t signals)
system_set_exec_state_flag(EXEC_SAFETY_DOOR);
}
#endif
if(signals.probe_overtravel) {
limit_signals_t overtravel = { .min.z = On};
hal.limits.interrupt_callback(overtravel);
// TODO: add message?
} else if (signals.probe_triggered) {
} else if(signals.probe_triggered) {
if(sys.probing_state == Probing_Off && (state_get() & (STATE_CYCLE|STATE_JOG))) {
system_set_exec_state_flag(EXEC_STOP);
sys.alarm_pending = Alarm_ProbeProtect;
} else
hal.probe.configure(false, false);
} else if (signals.probe_disconnected) {
} else if(signals.probe_disconnected) {
if(sys.probing_state == Probing_Active && state_get() == STATE_CYCLE) {
system_set_exec_state_flag(EXEC_FEED_HOLD);
sys.alarm_pending = Alarm_ProbeProtect;
}
} else if (signals.feed_hold)
} else if(signals.feed_hold)
system_set_exec_state_flag(EXEC_FEED_HOLD);
else if (signals.cycle_start) {
else if(signals.cycle_start) {
system_set_exec_state_flag(EXEC_CYCLE_START);
sys.report.cycle_start = settings.status_report.pin_state;
gc_state.tool_change = false;
}
if(signals.block_delete)