mirror of
https://github.com/grblHAL/core.git
synced 2026-03-27 10:47:56 +08:00
Added API call for overriding jerk settings, symbol for M201.3 gcode.
This commit is contained in:
18
changelog.md
18
changelog.md
@@ -1,5 +1,23 @@
|
||||
## grblHAL changelog
|
||||
|
||||
<a name="20250129">Build 20250129
|
||||
|
||||
Core:
|
||||
|
||||
* Added API call for overriding jerk settings, symbol for `M201.3` gcode.
|
||||
|
||||
Drivers:
|
||||
|
||||
* ESP32, STM32F4xx and STM32F7xx: added workaround for FatFs corrupting allocated memory after a failed mount attempt.
|
||||
|
||||
Plugins:
|
||||
|
||||
* SD card: added workaround for FatFs corrupting allocated memory after a failed mount attempt. Ref. RP2040 issue [#112](https://github.com/grblHAL/RP2040/issues/112).
|
||||
|
||||
* OpenPNP: added tentative support for setting jerk with `M201.3`. Not tested!
|
||||
|
||||
---
|
||||
|
||||
<a name="20250128">Build 20250128
|
||||
|
||||
Core:
|
||||
|
||||
6
gcode.c
6
gcode.c
@@ -1279,7 +1279,7 @@ status_code_t gc_execute_block (char *block)
|
||||
continue;
|
||||
}
|
||||
|
||||
if(mantissa > 0)
|
||||
if(int_value <= 99 && mantissa > 0)
|
||||
FAIL(Status_GcodeCommandValueNotInteger); // [No Mxx.x commands]
|
||||
|
||||
user_mcode = UserMCode_Unsupported;
|
||||
@@ -1398,8 +1398,8 @@ status_code_t gc_execute_block (char *block)
|
||||
break;
|
||||
|
||||
default:
|
||||
if(grbl.user_mcode.check && (user_mcode = grbl.user_mcode.check((user_mcode_t)int_value))) {
|
||||
gc_block.user_mcode = (user_mcode_t)int_value;
|
||||
if(grbl.user_mcode.check && (user_mcode = grbl.user_mcode.check((user_mcode_t)(mantissa ? int_value * 100 + mantissa : int_value)))) {
|
||||
gc_block.user_mcode = (user_mcode_t)(mantissa ? int_value * 100 + mantissa : int_value);
|
||||
word_bit.modal_group.M10 = On;
|
||||
} else
|
||||
FAIL(Status_GcodeUnsupportedCommand); // [Unsupported M command]
|
||||
|
||||
1
gcode.h
1
gcode.h
@@ -254,6 +254,7 @@ typedef enum {
|
||||
LaserPPI_Rate = 127, //!< 127 - M127
|
||||
LaserPPI_PulseLength = 128, //!< 128 - M128
|
||||
RGB_WriteLEDs = 150, //!< 150 - M150, Marlin format
|
||||
OpenPNP_SetJerk = 20130, //!< 20130 - M201.3
|
||||
OpenPNP_SetAcceleration = 204, //!< 204 - M204
|
||||
SetFeedOverrides = 220, //!< 220 - M220, Marlin format
|
||||
PWMServo_SetPosition= 280, //!< 280 - M280, Marlin format
|
||||
|
||||
2
grbl.h
2
grbl.h
@@ -42,7 +42,7 @@
|
||||
#else
|
||||
#define GRBL_VERSION "1.1f"
|
||||
#endif
|
||||
#define GRBL_BUILD 20250128
|
||||
#define GRBL_BUILD 20250129
|
||||
|
||||
#define GRBL_URL "https://github.com/grblHAL"
|
||||
|
||||
|
||||
36
settings.c
36
settings.c
@@ -454,6 +454,9 @@ static char axis_steps[9] = "step/mm";
|
||||
static struct {
|
||||
bool valid;
|
||||
float acceleration[N_AXIS];
|
||||
#if ENABLE_JERK_ACCELERATION
|
||||
float jerk[N_AXIS];
|
||||
#endif
|
||||
} override_backup = { .valid = false };
|
||||
|
||||
static void save_override_backup (void)
|
||||
@@ -463,6 +466,9 @@ static void save_override_backup (void)
|
||||
do {
|
||||
idx--;
|
||||
override_backup.acceleration[idx] = settings.axis[idx].acceleration;
|
||||
#if ENABLE_JERK_ACCELERATION
|
||||
override_backup.jerk[idx] = settings.axis[idx].jerk;
|
||||
#endif
|
||||
} while(idx);
|
||||
|
||||
override_backup.valid = true;
|
||||
@@ -475,6 +481,9 @@ static void restore_override_backup (void)
|
||||
if(override_backup.valid) do {
|
||||
idx--;
|
||||
settings.axis[idx].acceleration = override_backup.acceleration[idx];
|
||||
#if ENABLE_JERK_ACCELERATION
|
||||
settings.axis[idx].jerk = override_backup.jerk[idx];
|
||||
#endif
|
||||
} while(idx);
|
||||
}
|
||||
|
||||
@@ -499,6 +508,31 @@ bool settings_override_acceleration (uint8_t axis, float acceleration)
|
||||
return true;
|
||||
}
|
||||
|
||||
#if ENABLE_JERK_ACCELERATION
|
||||
|
||||
// Temporarily override jerk, if 0 restore to setting value.
|
||||
// Note: only allowed when current state is idle.
|
||||
bool settings_override_jerk (uint8_t axis, float jerk)
|
||||
{
|
||||
sys_state_t state = state_get();
|
||||
|
||||
if(!(state == STATE_IDLE || (state & (STATE_HOMING|STATE_ALARM))))
|
||||
return false;
|
||||
|
||||
if(jerk <= 0.0f) {
|
||||
if(override_backup.valid)
|
||||
settings.axis[axis].jerk = override_backup.jerk[axis];
|
||||
} else {
|
||||
if(!override_backup.valid)
|
||||
save_override_backup();
|
||||
settings.axis[axis].jerk = jerk * 60.0f * 60.0f * 60.0f; // Limit max to setting value?
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
#endif // ENABLE_JERK_ACCELERATION
|
||||
|
||||
// ---
|
||||
|
||||
static void homing_pulloff_init (float pulloff)
|
||||
@@ -1205,7 +1239,7 @@ static status_code_t set_axis_setting (setting_id_t setting, float value)
|
||||
|
||||
#if ENABLE_JERK_ACCELERATION
|
||||
case Setting_AxisJerk:
|
||||
settings.axis[idx].jerk = value * 60.0f * 60.0f * 60.0f; // Convert to mm/min^3 for internal use.
|
||||
settings.axis[idx].jerk = override_backup.jerk[idx] = value * 60.0f * 60.0f * 60.0f; // Convert to mm/min^3 for internal use.
|
||||
break;
|
||||
#endif
|
||||
|
||||
|
||||
@@ -1104,6 +1104,11 @@ bool settings_read_coord_data(coord_system_id_t id, float (*coord_data)[N_AXIS])
|
||||
// Temporarily override acceleration, if 0 restore to configured setting value
|
||||
bool settings_override_acceleration (uint8_t axis, float acceleration);
|
||||
|
||||
#if ENABLE_JERK_ACCELERATION
|
||||
// Temporarily override jerk, if 0 restore to configured setting value.
|
||||
bool settings_override_jerk (uint8_t axis, float jerk);
|
||||
#endif
|
||||
|
||||
void settings_register (setting_details_t *details);
|
||||
setting_details_t *settings_get_details (void);
|
||||
bool settings_is_group_available (setting_group_t group);
|
||||
|
||||
Reference in New Issue
Block a user