diff --git a/README.md b/README.md
index e24a9be..2a017eb 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 20230729, see the [changelog](changelog.md) for details.
+Latest build date is 20230808, see the [changelog](changelog.md) for details.
__NOTE:__ A settings reset will be performed on an update of builds earlier than 20230125. Backup and restore of settings is recommended.
__IMPORTANT!__ A new setting has been introduced for ganged axes motors in build 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.
diff --git a/changelog.md b/changelog.md
index eea615c..9962877 100644
--- a/changelog.md
+++ b/changelog.md
@@ -1,5 +1,27 @@
## grblHAL changelog
+202300808
+
+Core:
+
+* More fixes for issue #332: setting tool table data cleared current coordinate system offset, incomplete handling of G10 L10 and L11.
+
+* Added free memory to $I output when available, example: `[FREE MEMORY:102K]`
+
+* Changed reported position for failed probe to target. Parameters #5061 - #5069 returns position in coordinate system used when probing.
+
+Drivers:
+
+* RP2040: Added fans plugin.
+
+* STM32F4xx: implemented free memory call.
+
+Plugins:
+
+* Fans: fixed some bugs and typos.
+
+---
+
202300805
Core:
diff --git a/gcode.c b/gcode.c
index 6ed6b0c..95eac8c 100644
--- a/gcode.c
+++ b/gcode.c
@@ -2140,18 +2140,23 @@ status_code_t gc_execute_block (char *block)
if(gc_block.values.l == 11 && !settings_read_coord_data(CoordinateSystem_G59_3, &g59_3_offset))
FAIL(Status_SettingReadFail);
+ if(gc_block.values.l == 1)
+ settings_read_tool_data(p_value, &tool_table[p_value]);
+
idx = N_AXIS;
do {
- if (bit_istrue(axis_words.mask, bit(--idx))) {
+ if(bit_istrue(axis_words.mask, bit(--idx))) {
if(gc_block.values.l == 1)
tool_table[p_value].offset[idx] = gc_block.values.xyz[idx];
else if(gc_block.values.l == 10)
- tool_table[p_value].offset[idx] = gc_state.position[idx] - gc_state.g92_coord_offset[idx] - gc_block.values.xyz[idx];
+ tool_table[p_value].offset[idx] = gc_state.position[idx] - gc_state.modal.coord_system.xyz[idx] - gc_state.g92_coord_offset[idx] - gc_block.values.xyz[idx];
else if(gc_block.values.l == 11)
tool_table[p_value].offset[idx] = g59_3_offset[idx] - gc_block.values.xyz[idx];
- if (gc_block.values.l != 1)
- tool_table[p_value].offset[idx] -= gc_state.tool_length_offset[idx];
- }
+// if(gc_block.values.l != 1)
+// tool_table[p_value].offset[idx] -= gc_state.tool_length_offset[idx];
+ } else if(gc_block.values.l == 10 || gc_block.values.l == 11)
+ tool_table[p_value].offset[idx] = gc_state.tool_length_offset[idx];
+
// else, keep current stored value.
} while(idx);
@@ -3216,12 +3221,18 @@ status_code_t gc_execute_block (char *block)
switch(gc_block.non_modal_command) {
case NonModal_SetCoordinateData:
- settings_write_coord_data(gc_block.values.coord_data.id, &gc_block.values.coord_data.xyz);
- // Update system coordinate system if currently active.
- if (gc_state.modal.coord_system.id == gc_block.values.coord_data.id) {
- memcpy(gc_state.modal.coord_system.xyz, gc_block.values.coord_data.xyz, sizeof(gc_state.modal.coord_system.xyz));
- system_flag_wco_change();
+#if N_TOOLS
+ if(gc_block.values.l == 2 || gc_block.values.l == 20) {
+#endif
+ settings_write_coord_data(gc_block.values.coord_data.id, &gc_block.values.coord_data.xyz);
+ // Update system coordinate system if currently active.
+ if (gc_state.modal.coord_system.id == gc_block.values.coord_data.id) {
+ memcpy(gc_state.modal.coord_system.xyz, gc_block.values.coord_data.xyz, sizeof(gc_state.modal.coord_system.xyz));
+ system_flag_wco_change();
+ }
+#if N_TOOLS
}
+#endif
break;
case NonModal_GoHome_0:
diff --git a/grbl.h b/grbl.h
index 72bcfea..45c0820 100644
--- a/grbl.h
+++ b/grbl.h
@@ -42,7 +42,7 @@
#else
#define GRBL_VERSION "1.1f"
#endif
-#define GRBL_BUILD 20230805
+#define GRBL_BUILD 20230808
#define GRBL_URL "https://github.com/grblHAL"
diff --git a/machine_limits.c b/machine_limits.c
index 287e205..0f09cff 100644
--- a/machine_limits.c
+++ b/machine_limits.c
@@ -158,7 +158,7 @@ void limits_set_machine_positions (axes_signals_t cycle, bool add_pulloff)
sys.home_position[idx] = bit_istrue(settings.homing.dir_mask.value, bit(idx))
? settings.axis[idx].max_travel + pulloff
: - pulloff;
- sys.position[idx] = sys.home_position[idx] * settings.axis[idx].steps_per_mm;
+ sys.position[idx] = lroundf(sys.home_position[idx] * settings.axis[idx].steps_per_mm);
}
} while(idx);
}
diff --git a/motion_control.c b/motion_control.c
index 4713eda..73159ca 100644
--- a/motion_control.c
+++ b/motion_control.c
@@ -944,10 +944,19 @@ status_code_t mc_homing_cycle (axes_signals_t cycle)
// NOTE: Upon probe failure, the program will be stopped and placed into ALARM state.
gc_probe_t mc_probe_cycle (float *target, plan_line_data_t *pl_data, gc_parser_flags_t parser_flags)
{
+ uint_fast8_t idx = N_AXIS;
+
// TODO: Need to update this cycle so it obeys a non-auto cycle start.
if (state_get() == STATE_CHECK_MODE)
return GCProbe_CheckMode;
+ do {
+ idx--;
+ sys.probe_position[idx] = lroundf(target[idx] * settings.axis[idx].steps_per_mm);
+ } while(idx);
+
+ sys.probe_coordsys_id = gc_state.modal.coord_system.id;
+
// Finish all queued commands and empty planner buffer before starting probe cycle.
if (!protocol_buffer_synchronize())
return GCProbe_Abort; // Return if system reset has been issued.
@@ -1007,16 +1016,12 @@ gc_probe_t mc_probe_cycle (float *target, plan_line_data_t *pl_data, gc_parser_f
// Probing cycle complete!
// Set state variables and error out, if the probe failed and cycle with error is enabled.
- if (sys.probing_state == Probing_Active) {
- if (parser_flags.probe_is_no_error)
- memcpy(sys.probe_position, sys.position, sizeof(sys.position));
- else
+ if(sys.probing_state == Probing_Active) {
+ memcpy(sys.probe_position, sys.position, sizeof(sys.position));
+ if(!parser_flags.probe_is_no_error)
system_set_exec_alarm(Alarm_ProbeFailContact);
- } else {
- // Indicate to system the probing cycle completed successfully.
- sys.probe_coordsys_id = gc_state.modal.coord_system.id;
- sys.flags.probe_succeeded = On;
- }
+ } else
+ sys.flags.probe_succeeded = On; // Indicate to system the probing cycle completed successfully.
sys.probing_state = Probing_Off; // Ensure probe state monitor is disabled.
hal.probe.configure(false, false); // Re-initialize invert mask.
diff --git a/report.c b/report.c
index c7f6610..7a06873 100644
--- a/report.c
+++ b/report.c
@@ -995,6 +995,12 @@ void report_build_info (char *line, bool extended)
hal.stream.write("]" ASCII_EOL);
}
+ if(hal.get_free_mem) {
+ hal.stream.write("[FREE MEMORY:");
+ hal.stream.write(uitoa(hal.get_free_mem() / 1024));
+ hal.stream.write("K]" ASCII_EOL);
+ }
+
if(hal.info) {
hal.stream.write("[DRIVER:");
hal.stream.write(hal.info);