diff --git a/changelog.md b/changelog.md index 22998db..4d4c981 100644 --- a/changelog.md +++ b/changelog.md @@ -1,5 +1,43 @@ ## grblHAL changelog +Build 20241128 + +Core: + +* Added (or rather repurposed) field for build date to settings structure in preparation for coming changes. + +* Added code guards in order to free some memory for STM32F103 variants with 128K flash. Ref. [STM32F1xx driver issue #59](https://github.com/grblHAL/STM32F1xx/issues/59). + +* Changed Stop (`0x19`) real-time command behaviour, active tool offset and coordinate system will now be kept. Ref. [issue #610](https://github.com/grblHAL/core/issues/610). + +Drivers: + +* All: updated for core change (settings structure). + +* SAM3X8E: fixed missing probe input for Protoneer v3 board. Ref. [issue #31](https://github.com/grblHAL/SAM3X8E/issues/31) + +* RP2040: switched to SDK v2.0.0 and added initial support for RP2350 (Pico 2). The Web Builder will be updated a little later for this change. + +Plugins: + +* Trinamic: removed superfluous semicolon.Ref. [issue #15](https://github.com/grblHAL/Plugins_motor/issues/15). + +* Networking: added some files to _CMakeLists.txt_, used by RP2350 driver. + +--- + +Build 20241121 + +Core: + +* downgrading settings reset backup + +Plugins: + +* Trinamic: removed superfluous semicolon. https://github.com/grblHAL/Plugins_motor/issues/15 + +--- + 20241121 Core: diff --git a/crossbar.h b/crossbar.h index 6627bac..0c13722 100644 --- a/crossbar.h +++ b/crossbar.h @@ -263,6 +263,7 @@ PROGMEM static const pin_name_t pin_names[] = { { .function = Input_LimitZ_Max, .name = "Z limit max" }, { .function = Input_HomeZ, .name = "Z home" }, { .function = Input_HomeZ_2, .name = "Z home 2" }, +#ifndef NO_SETTINGS_DESCRIPTIONS { .function = Input_SpindleIndex, .name = "Spindle index" }, { .function = Input_SpindlePulse, .name = "Spindle pulse" }, { .function = Input_Aux0, .name = "Aux in 0" }, @@ -285,6 +286,7 @@ PROGMEM static const pin_name_t pin_names[] = { { .function = Input_Analog_Aux5, .name = "Aux analog in 5" }, { .function = Input_Analog_Aux6, .name = "Aux analog in 6" }, { .function = Input_Analog_Aux7, .name = "Aux analog in 7" }, +#endif { .function = Output_StepX, .name = "X step" }, { .function = Output_StepX_2, .name = "X2 step" }, { .function = Output_StepY, .name = "Y step" }, @@ -344,6 +346,7 @@ PROGMEM static const pin_name_t pin_names[] = { { .function = Input_LimitV_Max, .name = "V limit max" }, { .function = Input_HomeV, .name = "V home" }, #endif +#ifndef NO_SETTINGS_DESCRIPTIONS { .function = Output_MotorChipSelect, .name = "Motor CS" }, { .function = Output_MotorChipSelectX, .name = "Motor CSX" }, { .function = Output_MotorChipSelectY, .name = "Motor CSY" }, @@ -418,6 +421,7 @@ PROGMEM static const pin_name_t pin_names[] = { { .function = Bidirectional_MotorUARTM5, .name = "UART M5" }, { .function = Bidirectional_MotorUARTM6, .name = "UART M6" }, { .function = Bidirectional_MotorUARTM7, .name = "UART M7" } +#endif }; typedef enum { diff --git a/gcode.c b/gcode.c index e557b00..b99d140 100644 --- a/gcode.c +++ b/gcode.c @@ -288,7 +288,7 @@ plane_t *gc_get_plane_data (plane_t *plane, plane_select_t select) return plane; } -void gc_init (void) +void gc_init (bool stop) { #if COMPATIBILITY_LEVEL > 1 memset(&gc_state, 0, sizeof(parser_state_t)); @@ -302,11 +302,20 @@ void gc_init (void) if(grbl.tool_table.n_tools == 0) memset(grbl.tool_table.tool, 0, sizeof(tool_data_t)); } else { + + coord_system_id_t coord_system_id = gc_state.modal.coord_system.id; + tool_offset_mode_t tool_offset_mode = gc_state.modal.tool_offset_mode; + memset(&gc_state, 0, offsetof(parser_state_t, g92_coord_offset)); gc_state.tool_pending = gc_state.tool->tool_id; if(hal.tool.select) hal.tool.select(gc_state.tool, false); - // TODO: restore offsets, tool offset mode? + + if(stop) { + // Restore offsets, tool offset mode + gc_state.modal.coord_system.id = coord_system_id; + gc_state.modal.tool_offset_mode = tool_offset_mode; + } } #endif diff --git a/gcode.h b/gcode.h index 5a6ef53..fc4af71 100644 --- a/gcode.h +++ b/gcode.h @@ -654,7 +654,7 @@ typedef struct { } parser_block_t; // Initialize the parser -void gc_init (void); +void gc_init (bool stop); char *gc_normalize_block (char *block, status_code_t *status, char **message); diff --git a/grbl.h b/grbl.h index c846921..1905ae6 100644 --- a/grbl.h +++ b/grbl.h @@ -42,7 +42,7 @@ #else #define GRBL_VERSION "1.1f" #endif -#define GRBL_BUILD 20241120 +#define GRBL_BUILD 20241128 #define GRBL_URL "https://github.com/grblHAL" diff --git a/grbllib.c b/grbllib.c index 4ac139b..a7317fd 100644 --- a/grbllib.c +++ b/grbllib.c @@ -368,7 +368,7 @@ int grbl_enter (void) // Reset primary systems. hal.stream.reset_read_buffer(); // Clear input stream buffer - gc_init(); // Set g-code parser to default state + gc_init(false); // Set g-code parser to default state hal.limits.enable(settings.limits.flags.hard_enabled, (axes_signals_t){0}); plan_reset(); // Clear block buffer and planner variables st_reset(); // Clear stepper subsystem variables. diff --git a/protocol.c b/protocol.c index 4e85ef1..3d197a3 100644 --- a/protocol.c +++ b/protocol.c @@ -579,7 +579,7 @@ bool protocol_exec_rt_system (void) sys.flags.keep_input = Off; - gc_init(); + gc_init(true); plan_reset(); if(sys.alarm_pending == Alarm_ProbeProtect) { st_go_idle(); diff --git a/settings.c b/settings.c index 122fa00..c0a1f7c 100644 --- a/settings.c +++ b/settings.c @@ -54,7 +54,8 @@ const settings_restore_t settings_all = { PROGMEM const settings_t defaults = { - .version = SETTINGS_VERSION, + .version.id = SETTINGS_VERSION, +// .version.build = (GRBL_BUILD - 20000000UL), #if DEFAULT_LASER_MODE .mode = Mode_Laser, @@ -2367,7 +2368,7 @@ bool read_global_settings () settings.control_invert.mask |= limits_override.mask; settings.control_disable_pullup.mask &= ~limits_override.mask; - return ok && settings.version == SETTINGS_VERSION; + return ok && settings.version.id == SETTINGS_VERSION; } @@ -3176,5 +3177,11 @@ void settings_init (void) details->on_changed(&settings, changed); } while((details = details->next)); +/* + if(!settings.fs_options.downgrading && settings.version.build != (GRBL_BUILD - 20000000UL)) { + settings.version.build = (GRBL_BUILD - 20000000UL); + settings_write_global(); + } +*/ setting_details.on_changed = hal.settings_changed; } diff --git a/settings.h b/settings.h index b4c0418..f6cb847 100644 --- a/settings.h +++ b/settings.h @@ -573,7 +573,7 @@ typedef union { no_restore_position_after_M6 :1, no_unlock_after_estop :1; }; -} settingflags_t; +} settingflags_t; // TODO: -> 16 bit typedef union { uint8_t value; @@ -750,7 +750,8 @@ typedef union { struct { uint8_t sd_mount_on_boot :1, lfs_hidden :1, - unused :6; + unused :5, + downgrading :1; // TODO: move to system flags }; } fs_options_t; @@ -803,11 +804,18 @@ typedef struct { toolchange_mode_t mode; } tool_change_settings_t; +typedef union { + uint32_t value; + struct { + uint32_t id :8; // = SETTINGS_VERSION, incremented on structure changes. + uint32_t build :24; // Build date, format YYMMDD. + }; +} settings_version_t; + // Global persistent settings (Stored from byte NVS_ADDR_GLOBAL onwards) typedef struct { // Settings struct version - uint32_t version; -// uint32_t build_date; // TODO: add in next settings version?, set to GRBL_BUILD + settings_version_t version; float junction_deviation; float arc_tolerance; float g73_retract; diff --git a/stepper2.c b/stepper2.c index 57bfa5d..00f251e 100644 --- a/stepper2.c +++ b/stepper2.c @@ -218,7 +218,7 @@ Binds motor 0 as a spindle. */ bool st2_motor_bind_spindle (uint_fast8_t axis_idx) { - if(motors && axis_idx > Z_AXIS) { + if(motors && N_AXIS > 3 && axis_idx > Z_AXIS) { motors->idx = axis_idx; motors->axis.mask = 1 << axis_idx; diff --git a/stream_file.c b/stream_file.c index 4406fd5..e1eb9bd 100644 --- a/stream_file.c +++ b/stream_file.c @@ -171,7 +171,7 @@ vfs_file_t *stream_redirect_read (char *filename, status_message_ptr status_hand void stream_redirect_close (vfs_file_t *file) { - rd_stream_t *stream = rd_streams, *prev_stream; + rd_stream_t *stream = rd_streams, *prev_stream = NULL; if(stream) do { if(stream->file_new == file) {