diff --git a/README.md b/README.md index 8d6c59d..d036eaa 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 20230227, see the [changelog](changelog.md) for details. +Latest build date is 20230228, 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 8bd2eef..bb651a7 100644 --- a/changelog.md +++ b/changelog.md @@ -1,5 +1,21 @@ ## grblHAL changelog +20230228 + +Core: + +* Fix for Arduino compiler issue with build 20230227. Added new core event and removed redundant code. + +Drivers: + +* STM32F4xx: Fixed missing pullup enable for EStop input. __NOTE:__ this may trigger EStop alarm for those who have not wired a switch to this input. + +Plugins: + +* Keypad: I2C display protocol plugin updated to allow multiple message extensions, simplified code. + +--- + 20230227 Core: diff --git a/core_handlers.h b/core_handlers.h index 9efee9e..68ff194 100644 --- a/core_handlers.h +++ b/core_handlers.h @@ -81,6 +81,7 @@ typedef bool (*protocol_enqueue_realtime_command_ptr)(char c); typedef void (*on_state_change_ptr)(sys_state_t state); typedef void (*on_override_changed_ptr)(override_changed_t override); typedef void (*on_spindle_programmed_ptr)(spindle_ptrs_t *spindle, spindle_state_t state, float rpm, spindle_rpm_mode_t mode); +typedef void (*on_wco_changed_ptr)(void); typedef void (*on_program_completed_ptr)(program_flow_t program_flow, bool check_mode); typedef void (*on_execute_realtime_ptr)(sys_state_t state); typedef void (*on_unknown_accessory_override_ptr)(uint8_t cmd); @@ -117,6 +118,7 @@ typedef struct { on_override_changed_ptr on_override_changed; on_report_handlers_init_ptr on_report_handlers_init; on_spindle_programmed_ptr on_spindle_programmed; + on_wco_changed_ptr on_wco_changed; on_program_completed_ptr on_program_completed; on_execute_realtime_ptr on_execute_realtime; on_execute_realtime_ptr on_execute_delay; diff --git a/gcode.c b/gcode.c index d00e970..5366909 100644 --- a/gcode.c +++ b/gcode.c @@ -319,6 +319,11 @@ void gc_init (void) if (sys.cold_start && !settings.flags.g92_is_volatile && !settings_read_coord_data(CoordinateSystem_G92, &gc_state.g92_coord_offset)) grbl.report.status_message(Status_SettingReadFail); + if(grbl.on_wco_changed && (!sys.cold_start || + !is0_position_vector(gc_state.modal.coord_system.xyz) || + !is0_position_vector(gc_state.g92_coord_offset))) + grbl.on_wco_changed(); + // if(settings.flags.lathe_mode) // gc_state.modal.plane_select = PlaneSelect_ZX; } @@ -1065,14 +1070,14 @@ status_code_t gc_execute_block (char *block) if(hal.port.digital_out == NULL || hal.port.num_digital_out == 0) FAIL(Status_GcodeUnsupportedCommand); // [Unsupported M command] word_bit.modal_group.M10 = On; - port_command = int_value; + port_command = (io_mcode_t)int_value; break; case 66: if(hal.port.wait_on_input == NULL || (hal.port.num_digital_in == 0 && hal.port.num_analog_in == 0)) FAIL(Status_GcodeUnsupportedCommand); // [Unsupported M command] word_bit.modal_group.M10 = On; - port_command = int_value; + port_command = (io_mcode_t)int_value; break; case 67: @@ -1080,7 +1085,7 @@ status_code_t gc_execute_block (char *block) if(hal.port.analog_out == NULL || hal.port.num_analog_out == 0) FAIL(Status_GcodeUnsupportedCommand); // [Unsupported M command] word_bit.modal_group.M10 = On; - port_command = int_value; + port_command = (io_mcode_t)int_value; break; /* case 70: diff --git a/gcode.h b/gcode.h index 64f3753..59ff9ec 100644 --- a/gcode.h +++ b/gcode.h @@ -136,9 +136,7 @@ typedef enum { Do not alter values! */ -typedef uint8_t coord_system_id_t; - -enum coord_system_id_t { +typedef enum { CoordinateSystem_G54 = 0, //!< 0 - G54 (G12) CoordinateSystem_G55, //!< 1 - G55 (G12) CoordinateSystem_G56, //!< 2 - G56 (G12) @@ -155,7 +153,8 @@ enum coord_system_id_t { CoordinateSystem_G30, //!< 10 - G30 (G0) when #COMPATIBILITY_LEVEL <= 1, 7 otherwise CoordinateSystem_G92, //!< 11 - G92 (G0) when #COMPATIBILITY_LEVEL <= 1, 8 otherwise N_CoordinateSystems //!< 12 when #COMPATIBILITY_LEVEL <= 1, 9 otherwise -}; +} __attribute__ ((__packed__)) coord_system_id_t; + /*! Modal Group G13: Control mode diff --git a/grbl.h b/grbl.h index 97a007f..c1c37b6 100644 --- a/grbl.h +++ b/grbl.h @@ -42,7 +42,7 @@ #else #define GRBL_VERSION "1.1f" #endif -#define GRBL_BUILD 20230227 +#define GRBL_BUILD 20230228 #define GRBL_URL "https://github.com/grblHAL" diff --git a/nuts_bolts.h b/nuts_bolts.h index 5d94746..d208d37 100644 --- a/nuts_bolts.h +++ b/nuts_bolts.h @@ -180,6 +180,7 @@ typedef enum { #endif #define clear_vector(a) memset(a, 0, sizeof(a)) #define isequal_position_vector(a, b) !memcmp(a, b, sizeof(coord_data_t)) +#define is0_position_vector(a) !memcmp(a, &((coord_data_t){0}), sizeof(coord_data_t)) // Bit field and masking macros #ifndef bit diff --git a/report.c b/report.c index b230dfa..e5a1d33 100644 --- a/report.c +++ b/report.c @@ -1067,15 +1067,13 @@ void report_realtime_status (void) { static bool probing = false; - int32_t current_position[N_AXIS]; // Copy current state of the system position variable float print_position[N_AXIS]; probe_state_t probe_state = { .connected = On, .triggered = Off }; - memcpy(current_position, sys.position, sizeof(sys.position)); - system_convert_array_steps_to_mpos(print_position, current_position); + system_convert_array_steps_to_mpos(print_position, sys.position); if(hal.probe.get_state) probe_state = hal.probe.get_state(); diff --git a/spindle_control.c b/spindle_control.c index 86bf5d3..dfd6fa3 100644 --- a/spindle_control.c +++ b/spindle_control.c @@ -295,7 +295,7 @@ static spindle_num_t spindle_get_num (spindle_id_t spindle_id) do { idx--; - if((setting = setting_get_details(idx == 0 ? Setting_SpindleType : Setting_SpindleEnable0 + idx, NULL))) { + if((setting = setting_get_details(idx == 0 ? Setting_SpindleType : (setting_id_t)(Setting_SpindleEnable0 + idx), NULL))) { if(setting_get_int_value(setting, 0) == spindle_id) spindle_num = idx; } diff --git a/system.c b/system.c index cdbd488..13e3872 100644 --- a/system.c +++ b/system.c @@ -965,6 +965,9 @@ void system_flag_wco_change (void) if(!settings.status_report.sync_on_wco_change) protocol_buffer_synchronize(); + if(grbl.on_wco_changed) + grbl.on_wco_changed(); + sys.report.wco = On; }