mirror of
https://github.com/MarlinFirmware/Marlin.git
synced 2025-01-22 17:52:57 +00:00
🎨 FT Motion, axis cleanup
This commit is contained in:
parent
89b0143b09
commit
b062a3b226
7 changed files with 41 additions and 38 deletions
|
@ -297,7 +297,7 @@ enum AxisEnum : uint8_t {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Distinct axes, including all E and Core
|
// Distinct axes, including all E and Core
|
||||||
NUM_AXIS_ENUMS,
|
NUM_AXIS_HEADS,
|
||||||
|
|
||||||
// Most of the time we refer only to the single E_AXIS
|
// Most of the time we refer only to the single E_AXIS
|
||||||
#if HAS_EXTRUDERS
|
#if HAS_EXTRUDERS
|
||||||
|
@ -995,7 +995,7 @@ class AxisBits;
|
||||||
|
|
||||||
class AxisBits {
|
class AxisBits {
|
||||||
public:
|
public:
|
||||||
typedef bits_t(NUM_AXIS_ENUMS) el;
|
typedef bits_t(NUM_AXIS_HEADS) el;
|
||||||
union {
|
union {
|
||||||
el bits;
|
el bits;
|
||||||
// Axes x, y, z ... e0, e1, e2 ... hx, hy, hz
|
// Axes x, y, z ... e0, e1, e2 ... hx, hy, hz
|
||||||
|
@ -1056,7 +1056,7 @@ public:
|
||||||
FI AxisBits& operator=(const el p) { set(p); return *this; }
|
FI AxisBits& operator=(const el p) { set(p); return *this; }
|
||||||
|
|
||||||
FI void reset() { set(0); }
|
FI void reset() { set(0); }
|
||||||
FI void fill() { set(_BV(NUM_AXIS_ENUMS) - 1); }
|
FI void fill() { set(_BV(NUM_AXIS_HEADS) - 1); }
|
||||||
|
|
||||||
#define MSET(pE,pX,pY,pZ,pI,pJ,pK,pU,pV,pW) LOGICAL_AXIS_CODE(e=pE, x=pX, y=pY, z=pZ, i=pI, j=pJ, k=pK, u=pU, v=pV, w=pW)
|
#define MSET(pE,pX,pY,pZ,pI,pJ,pK,pU,pV,pW) LOGICAL_AXIS_CODE(e=pE, x=pX, y=pY, z=pZ, i=pI, j=pJ, k=pK, u=pU, v=pV, w=pW)
|
||||||
|
|
||||||
|
|
|
@ -61,13 +61,13 @@ void say_shaping() {
|
||||||
|
|
||||||
// FT Shaping
|
// FT Shaping
|
||||||
#if HAS_X_AXIS
|
#if HAS_X_AXIS
|
||||||
if (CMPNSTR_HAS_SHAPER(X_AXIS)) {
|
if (AXIS_HAS_SHAPER(X)) {
|
||||||
SERIAL_ECHOPGM(" with " AXIS_0_NAME);
|
SERIAL_ECHOPGM(" with " AXIS_0_NAME);
|
||||||
say_shaper_type(X_AXIS);
|
say_shaper_type(X_AXIS);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#if HAS_Y_AXIS
|
#if HAS_Y_AXIS
|
||||||
if (CMPNSTR_HAS_SHAPER(Y_AXIS)) {
|
if (AXIS_HAS_SHAPER(Y)) {
|
||||||
SERIAL_ECHOPGM(" and with " AXIS_1_NAME);
|
SERIAL_ECHOPGM(" and with " AXIS_1_NAME);
|
||||||
say_shaper_type(Y_AXIS);
|
say_shaper_type(Y_AXIS);
|
||||||
}
|
}
|
||||||
|
@ -80,7 +80,7 @@ void say_shaping() {
|
||||||
dynamic = z_based || g_based;
|
dynamic = z_based || g_based;
|
||||||
|
|
||||||
// FT Dynamic Frequency Mode
|
// FT Dynamic Frequency Mode
|
||||||
if (CMPNSTR_HAS_SHAPER(X_AXIS) || CMPNSTR_HAS_SHAPER(Y_AXIS)) {
|
if (AXIS_HAS_SHAPER(X) || AXIS_HAS_SHAPER(Y)) {
|
||||||
#if HAS_DYNAMIC_FREQ
|
#if HAS_DYNAMIC_FREQ
|
||||||
SERIAL_ECHOPGM("Dynamic Frequency Mode ");
|
SERIAL_ECHOPGM("Dynamic Frequency Mode ");
|
||||||
switch (ftMotion.cfg.dynFreqMode) {
|
switch (ftMotion.cfg.dynFreqMode) {
|
||||||
|
@ -201,8 +201,11 @@ void GcodeSuite::M493() {
|
||||||
|
|
||||||
if (active != ftMotion.cfg.active) {
|
if (active != ftMotion.cfg.active) {
|
||||||
switch (active) {
|
switch (active) {
|
||||||
case false: flag.reset_ft = true;
|
case false:
|
||||||
case true: flag.report_h = true;
|
flag.reset_ft = true;
|
||||||
|
// fall-thru
|
||||||
|
case true:
|
||||||
|
flag.report_h = true;
|
||||||
ftMotion.cfg.active = active;
|
ftMotion.cfg.active = active;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -267,7 +270,7 @@ void GcodeSuite::M493() {
|
||||||
|
|
||||||
// Dynamic frequency mode parameter.
|
// Dynamic frequency mode parameter.
|
||||||
if (parser.seenval('D')) {
|
if (parser.seenval('D')) {
|
||||||
if (CMPNSTR_HAS_SHAPER(X_AXIS) || CMPNSTR_HAS_SHAPER(Y_AXIS)) {
|
if (AXIS_HAS_SHAPER(X) || AXIS_HAS_SHAPER(Y)) {
|
||||||
const dynFreqMode_t val = dynFreqMode_t(parser.value_byte());
|
const dynFreqMode_t val = dynFreqMode_t(parser.value_byte());
|
||||||
switch (val) {
|
switch (val) {
|
||||||
#if HAS_DYNAMIC_FREQ_MM
|
#if HAS_DYNAMIC_FREQ_MM
|
||||||
|
@ -301,7 +304,7 @@ void GcodeSuite::M493() {
|
||||||
|
|
||||||
// Parse frequency parameter (X axis).
|
// Parse frequency parameter (X axis).
|
||||||
if (parser.seenval('A')) {
|
if (parser.seenval('A')) {
|
||||||
if (CMPNSTR_HAS_SHAPER(X_AXIS)) {
|
if (AXIS_HAS_SHAPER(X)) {
|
||||||
const float val = parser.value_float();
|
const float val = parser.value_float();
|
||||||
// TODO: Frequency minimum is dependent on the shaper used; the above check isn't always correct.
|
// TODO: Frequency minimum is dependent on the shaper used; the above check isn't always correct.
|
||||||
if (WITHIN(val, FTM_MIN_SHAPE_FREQ, (FTM_FS) / 2)) {
|
if (WITHIN(val, FTM_MIN_SHAPE_FREQ, (FTM_FS) / 2)) {
|
||||||
|
@ -330,7 +333,7 @@ void GcodeSuite::M493() {
|
||||||
// Parse zeta parameter (X axis).
|
// Parse zeta parameter (X axis).
|
||||||
if (parser.seenval('I')) {
|
if (parser.seenval('I')) {
|
||||||
const float val = parser.value_float();
|
const float val = parser.value_float();
|
||||||
if (CMPNSTR_HAS_SHAPER(X_AXIS)) {
|
if (AXIS_HAS_SHAPER(X)) {
|
||||||
if (WITHIN(val, 0.01f, 1.0f)) {
|
if (WITHIN(val, 0.01f, 1.0f)) {
|
||||||
ftMotion.cfg.zeta[0] = val;
|
ftMotion.cfg.zeta[0] = val;
|
||||||
flag.update = true;
|
flag.update = true;
|
||||||
|
@ -345,7 +348,7 @@ void GcodeSuite::M493() {
|
||||||
// Parse vtol parameter (X axis).
|
// Parse vtol parameter (X axis).
|
||||||
if (parser.seenval('Q')) {
|
if (parser.seenval('Q')) {
|
||||||
const float val = parser.value_float();
|
const float val = parser.value_float();
|
||||||
if (CMPNSTR_IS_EISHAPER(X_AXIS)) {
|
if (AXIS_HAS_EISHAPER(X)) {
|
||||||
if (WITHIN(val, 0.00f, 1.0f)) {
|
if (WITHIN(val, 0.00f, 1.0f)) {
|
||||||
ftMotion.cfg.vtol[0] = val;
|
ftMotion.cfg.vtol[0] = val;
|
||||||
flag.update = true;
|
flag.update = true;
|
||||||
|
@ -363,7 +366,7 @@ void GcodeSuite::M493() {
|
||||||
|
|
||||||
// Parse frequency parameter (Y axis).
|
// Parse frequency parameter (Y axis).
|
||||||
if (parser.seenval('B')) {
|
if (parser.seenval('B')) {
|
||||||
if (CMPNSTR_HAS_SHAPER(Y_AXIS)) {
|
if (AXIS_HAS_SHAPER(Y)) {
|
||||||
const float val = parser.value_float();
|
const float val = parser.value_float();
|
||||||
if (WITHIN(val, FTM_MIN_SHAPE_FREQ, (FTM_FS) / 2)) {
|
if (WITHIN(val, FTM_MIN_SHAPE_FREQ, (FTM_FS) / 2)) {
|
||||||
ftMotion.cfg.baseFreq[Y_AXIS] = val;
|
ftMotion.cfg.baseFreq[Y_AXIS] = val;
|
||||||
|
@ -391,7 +394,7 @@ void GcodeSuite::M493() {
|
||||||
// Parse zeta parameter (Y axis).
|
// Parse zeta parameter (Y axis).
|
||||||
if (parser.seenval('J')) {
|
if (parser.seenval('J')) {
|
||||||
const float val = parser.value_float();
|
const float val = parser.value_float();
|
||||||
if (CMPNSTR_HAS_SHAPER(Y_AXIS)) {
|
if (AXIS_HAS_SHAPER(Y)) {
|
||||||
if (WITHIN(val, 0.01f, 1.0f)) {
|
if (WITHIN(val, 0.01f, 1.0f)) {
|
||||||
ftMotion.cfg.zeta[1] = val;
|
ftMotion.cfg.zeta[1] = val;
|
||||||
flag.update = true;
|
flag.update = true;
|
||||||
|
@ -406,7 +409,7 @@ void GcodeSuite::M493() {
|
||||||
// Parse vtol parameter (Y axis).
|
// Parse vtol parameter (Y axis).
|
||||||
if (parser.seenval('R')) {
|
if (parser.seenval('R')) {
|
||||||
const float val = parser.value_float();
|
const float val = parser.value_float();
|
||||||
if (CMPNSTR_IS_EISHAPER(Y_AXIS)) {
|
if (AXIS_HAS_EISHAPER(Y)) {
|
||||||
if (WITHIN(val, 0.00f, 1.0f)) {
|
if (WITHIN(val, 0.00f, 1.0f)) {
|
||||||
ftMotion.cfg.vtol[1] = val;
|
ftMotion.cfg.vtol[1] = val;
|
||||||
flag.update = true;
|
flag.update = true;
|
||||||
|
|
|
@ -416,9 +416,9 @@ void menu_move() {
|
||||||
|
|
||||||
void menu_ft_motion() {
|
void menu_ft_motion() {
|
||||||
// Define stuff ahead of the menu loop
|
// Define stuff ahead of the menu loop
|
||||||
MString<20> shaper_name[1 + ENABLED(HAS_Y_AXIS)] {};
|
MString<20> shaper_name[NUM_AXES_SHAPED] {};
|
||||||
#if HAS_X_AXIS
|
#if HAS_X_AXIS
|
||||||
for (uint_fast8_t a = X_AXIS; a <= TERN(HAS_Y_AXIS, Y_AXIS, X_AXIS); ++a)
|
for (uint_fast8_t a = X_AXIS; a < NUM_AXES_SHAPED; ++a)
|
||||||
shaper_name[a] = get_shaper_name(AxisEnum(a));
|
shaper_name[a] = get_shaper_name(AxisEnum(a));
|
||||||
#endif
|
#endif
|
||||||
#if HAS_DYNAMIC_FREQ
|
#if HAS_DYNAMIC_FREQ
|
||||||
|
@ -441,10 +441,10 @@ void menu_move() {
|
||||||
SUBMENU_N(X_AXIS, MSG_FTM_CMPN_MODE, menu_ftm_cmpn_x);
|
SUBMENU_N(X_AXIS, MSG_FTM_CMPN_MODE, menu_ftm_cmpn_x);
|
||||||
MENU_ITEM_ADDON_START_RJ(5); lcd_put_u8str(shaper_name[X_AXIS]); MENU_ITEM_ADDON_END();
|
MENU_ITEM_ADDON_START_RJ(5); lcd_put_u8str(shaper_name[X_AXIS]); MENU_ITEM_ADDON_END();
|
||||||
|
|
||||||
if (CMPNSTR_HAS_SHAPER(X_AXIS)) {
|
if (AXIS_HAS_SHAPER(X)) {
|
||||||
EDIT_ITEM_FAST_N(float42_52, X_AXIS, MSG_FTM_BASE_FREQ_N, &c.baseFreq[X_AXIS], FTM_MIN_SHAPE_FREQ, (FTM_FS) / 2, ftMotion.update_shaping_params);
|
EDIT_ITEM_FAST_N(float42_52, X_AXIS, MSG_FTM_BASE_FREQ_N, &c.baseFreq[X_AXIS], FTM_MIN_SHAPE_FREQ, (FTM_FS) / 2, ftMotion.update_shaping_params);
|
||||||
EDIT_ITEM_FAST_N(float42_52, X_AXIS, MSG_FTM_ZETA_N, &c.zeta[0], 0.0f, 1.0f, ftMotion.update_shaping_params);
|
EDIT_ITEM_FAST_N(float42_52, X_AXIS, MSG_FTM_ZETA_N, &c.zeta[0], 0.0f, 1.0f, ftMotion.update_shaping_params);
|
||||||
if (CMPNSTR_IS_EISHAPER(X_AXIS))
|
if (AXIS_HAS_EISHAPER(X))
|
||||||
EDIT_ITEM_FAST_N(float42_52, X_AXIS, MSG_FTM_VTOL_N, &c.vtol[0], 0.0f, 1.0f, ftMotion.update_shaping_params);
|
EDIT_ITEM_FAST_N(float42_52, X_AXIS, MSG_FTM_VTOL_N, &c.vtol[0], 0.0f, 1.0f, ftMotion.update_shaping_params);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -452,10 +452,10 @@ void menu_move() {
|
||||||
SUBMENU_N(Y_AXIS, MSG_FTM_CMPN_MODE, menu_ftm_cmpn_y);
|
SUBMENU_N(Y_AXIS, MSG_FTM_CMPN_MODE, menu_ftm_cmpn_y);
|
||||||
MENU_ITEM_ADDON_START_RJ(5); lcd_put_u8str(shaper_name[Y_AXIS]); MENU_ITEM_ADDON_END();
|
MENU_ITEM_ADDON_START_RJ(5); lcd_put_u8str(shaper_name[Y_AXIS]); MENU_ITEM_ADDON_END();
|
||||||
|
|
||||||
if (CMPNSTR_HAS_SHAPER(Y_AXIS)) {
|
if (AXIS_HAS_SHAPER(Y)) {
|
||||||
EDIT_ITEM_FAST_N(float42_52, Y_AXIS, MSG_FTM_BASE_FREQ_N, &c.baseFreq[Y_AXIS], FTM_MIN_SHAPE_FREQ, (FTM_FS) / 2, ftMotion.update_shaping_params);
|
EDIT_ITEM_FAST_N(float42_52, Y_AXIS, MSG_FTM_BASE_FREQ_N, &c.baseFreq[Y_AXIS], FTM_MIN_SHAPE_FREQ, (FTM_FS) / 2, ftMotion.update_shaping_params);
|
||||||
EDIT_ITEM_FAST_N(float42_52, Y_AXIS, MSG_FTM_ZETA_N, &c.zeta[1], 0.0f, 1.0f, ftMotion.update_shaping_params);
|
EDIT_ITEM_FAST_N(float42_52, Y_AXIS, MSG_FTM_ZETA_N, &c.zeta[1], 0.0f, 1.0f, ftMotion.update_shaping_params);
|
||||||
if (CMPNSTR_IS_EISHAPER(Y_AXIS))
|
if (AXIS_HAS_EISHAPER(Y))
|
||||||
EDIT_ITEM_FAST_N(float42_52, Y_AXIS, MSG_FTM_VTOL_N, &c.vtol[1], 0.0f, 1.0f, ftMotion.update_shaping_params);
|
EDIT_ITEM_FAST_N(float42_52, Y_AXIS, MSG_FTM_VTOL_N, &c.vtol[1], 0.0f, 1.0f, ftMotion.update_shaping_params);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -483,9 +483,9 @@ void menu_move() {
|
||||||
|
|
||||||
void menu_tune_ft_motion() {
|
void menu_tune_ft_motion() {
|
||||||
// Define stuff ahead of the menu loop
|
// Define stuff ahead of the menu loop
|
||||||
MString<20> shaper_name[1 + ENABLED(HAS_Y_AXIS)] {};
|
MString<20> shaper_name[NUM_AXES_SHAPED] {};
|
||||||
#if HAS_X_AXIS
|
#if HAS_X_AXIS
|
||||||
for (uint_fast8_t a = X_AXIS; a <= TERN(HAS_Y_AXIS, Y_AXIS, X_AXIS); ++a)
|
for (uint_fast8_t a = X_AXIS; a < NUM_AXES_SHAPED; ++a)
|
||||||
shaper_name[a] = get_shaper_name(AxisEnum(a));
|
shaper_name[a] = get_shaper_name(AxisEnum(a));
|
||||||
#endif
|
#endif
|
||||||
#if HAS_DYNAMIC_FREQ
|
#if HAS_DYNAMIC_FREQ
|
||||||
|
|
|
@ -247,21 +247,21 @@ void MarlinUI::draw_status_screen() {
|
||||||
tft.set_background(COLOR_BACKGROUND);
|
tft.set_background(COLOR_BACKGROUND);
|
||||||
tft.add_rectangle(0, 0, COORDINATES_W, COORDINATES_H, COLOR_AXIS_HOMED);
|
tft.add_rectangle(0, 0, COORDINATES_W, COORDINATES_H, COLOR_AXIS_HOMED);
|
||||||
|
|
||||||
#if ENABLED(HAS_X_AXIS) && defined(X_MARK_X) && defined(X_MARK_Y) && defined(X_VALUE_X) && defined(X_VALUE_Y)
|
#if HAS_X_AXIS && defined(X_MARK_X) && defined(X_MARK_Y) && defined(X_VALUE_X) && defined(X_VALUE_Y)
|
||||||
tft.add_text(X_MARK_X, X_MARK_Y, COLOR_AXIS_HOMED , "X");
|
tft.add_text(X_MARK_X, X_MARK_Y, COLOR_AXIS_HOMED , "X");
|
||||||
const bool nhx = axis_should_home(X_AXIS);
|
const bool nhx = axis_should_home(X_AXIS);
|
||||||
tft_string.set(blink && nhx ? "?" : ftostr4sign(LOGICAL_X_POSITION(current_position.x)));
|
tft_string.set(blink && nhx ? "?" : ftostr4sign(LOGICAL_X_POSITION(current_position.x)));
|
||||||
tft.add_text(X_VALUE_X, X_VALUE_Y, nhx ? COLOR_AXIS_NOT_HOMED : COLOR_AXIS_HOMED, tft_string);
|
tft.add_text(X_VALUE_X, X_VALUE_Y, nhx ? COLOR_AXIS_NOT_HOMED : COLOR_AXIS_HOMED, tft_string);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if ENABLED(HAS_Y_AXIS) && defined(Y_MARK_X) && defined(Y_MARK_Y) && defined(Y_VALUE_X) && defined(Y_VALUE_Y)
|
#if HAS_Y_AXIS && defined(Y_MARK_X) && defined(Y_MARK_Y) && defined(Y_VALUE_X) && defined(Y_VALUE_Y)
|
||||||
tft.add_text(Y_MARK_X, Y_MARK_Y, COLOR_AXIS_HOMED , "Y");
|
tft.add_text(Y_MARK_X, Y_MARK_Y, COLOR_AXIS_HOMED , "Y");
|
||||||
const bool nhy = axis_should_home(Y_AXIS);
|
const bool nhy = axis_should_home(Y_AXIS);
|
||||||
tft_string.set(blink && nhy ? "?" : ftostr4sign(LOGICAL_Y_POSITION(current_position.y)));
|
tft_string.set(blink && nhy ? "?" : ftostr4sign(LOGICAL_Y_POSITION(current_position.y)));
|
||||||
tft.add_text(Y_VALUE_X, Y_VALUE_Y, nhy ? COLOR_AXIS_NOT_HOMED : COLOR_AXIS_HOMED, tft_string);
|
tft.add_text(Y_VALUE_X, Y_VALUE_Y, nhy ? COLOR_AXIS_NOT_HOMED : COLOR_AXIS_HOMED, tft_string);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if ENABLED(HAS_Z_AXIS) && defined(Z_MARK_X) && defined(Z_MARK_Y) && defined(Z_VALUE_X) && defined(Z_VALUE_Y) && defined(Z_VALUE_OFFSET)
|
#if HAS_Z_AXIS && defined(Z_MARK_X) && defined(Z_MARK_Y) && defined(Z_VALUE_X) && defined(Z_VALUE_Y) && defined(Z_VALUE_OFFSET)
|
||||||
tft.add_text(Z_MARK_X, Z_MARK_Y, COLOR_AXIS_HOMED , "Z");
|
tft.add_text(Z_MARK_X, Z_MARK_Y, COLOR_AXIS_HOMED , "Z");
|
||||||
uint16_t offset = Z_VALUE_OFFSET;
|
uint16_t offset = Z_VALUE_OFFSET;
|
||||||
const bool nhz = axis_should_home(Z_AXIS);
|
const bool nhz = axis_should_home(Z_AXIS);
|
||||||
|
|
|
@ -349,15 +349,13 @@ void FTMotion::loop() {
|
||||||
|
|
||||||
void FTMotion::update_shaping_params() {
|
void FTMotion::update_shaping_params() {
|
||||||
#if HAS_X_AXIS
|
#if HAS_X_AXIS
|
||||||
shaping.x.ena = CMPNSTR_HAS_SHAPER(X_AXIS);
|
if ((shaping.x.ena = AXIS_HAS_SHAPER(X))) {
|
||||||
if (shaping.x.ena) {
|
|
||||||
shaping.x.set_axis_shaping_A(cfg.shaper[X_AXIS], cfg.zeta[X_AXIS], cfg.vtol[X_AXIS]);
|
shaping.x.set_axis_shaping_A(cfg.shaper[X_AXIS], cfg.zeta[X_AXIS], cfg.vtol[X_AXIS]);
|
||||||
shaping.x.set_axis_shaping_N(cfg.shaper[X_AXIS], cfg.baseFreq[X_AXIS], cfg.zeta[X_AXIS]);
|
shaping.x.set_axis_shaping_N(cfg.shaper[X_AXIS], cfg.baseFreq[X_AXIS], cfg.zeta[X_AXIS]);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#if HAS_Y_AXIS
|
#if HAS_Y_AXIS
|
||||||
shaping.y.ena = CMPNSTR_HAS_SHAPER(Y_AXIS);
|
if ((shaping.y.ena = AXIS_HAS_SHAPER(Y))) {
|
||||||
if (shaping.y.ena) {
|
|
||||||
shaping.y.set_axis_shaping_A(cfg.shaper[Y_AXIS], cfg.zeta[Y_AXIS], cfg.vtol[Y_AXIS]);
|
shaping.y.set_axis_shaping_A(cfg.shaper[Y_AXIS], cfg.zeta[Y_AXIS], cfg.vtol[Y_AXIS]);
|
||||||
shaping.y.set_axis_shaping_N(cfg.shaper[Y_AXIS], cfg.baseFreq[Y_AXIS], cfg.zeta[Y_AXIS]);
|
shaping.y.set_axis_shaping_N(cfg.shaper[Y_AXIS], cfg.baseFreq[Y_AXIS], cfg.zeta[Y_AXIS]);
|
||||||
}
|
}
|
||||||
|
@ -664,7 +662,7 @@ void FTMotion::makeVector() {
|
||||||
* - Tests for delta are moved outside the loop.
|
* - Tests for delta are moved outside the loop.
|
||||||
* - Two functions are used for command computation with an array of function pointers.
|
* - Two functions are used for command computation with an array of function pointers.
|
||||||
*/
|
*/
|
||||||
static void (*command_set[SUM_TERN(HAS_EXTRUDERS, NUM_AXES, 1)])(int32_t&, int32_t&, ft_command_t&, int32_t, int32_t);
|
static void (*command_set[LOGICAL_AXES])(int32_t&, int32_t&, ft_command_t&, int32_t, int32_t);
|
||||||
|
|
||||||
static void command_set_pos(int32_t &e, int32_t &s, ft_command_t &b, int32_t bd, int32_t bs) {
|
static void command_set_pos(int32_t &e, int32_t &s, ft_command_t &b, int32_t bd, int32_t bs) {
|
||||||
if (e < FTM_CTS_COMPARE_VAL) return;
|
if (e < FTM_CTS_COMPARE_VAL) return;
|
||||||
|
|
|
@ -36,23 +36,25 @@
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#define NUM_AXES_SHAPED TERN(HAS_Y_AXIS, 2, 1)
|
||||||
|
|
||||||
typedef struct FTConfig {
|
typedef struct FTConfig {
|
||||||
bool active = ENABLED(FTM_IS_DEFAULT_MOTION); // Active (else standard motion)
|
bool active = ENABLED(FTM_IS_DEFAULT_MOTION); // Active (else standard motion)
|
||||||
|
|
||||||
#if HAS_X_AXIS
|
#if HAS_X_AXIS
|
||||||
ftMotionShaper_t shaper[1 + ENABLED(HAS_Y_AXIS)] = // Shaper type
|
ftMotionShaper_t shaper[NUM_AXES_SHAPED] = // Shaper type
|
||||||
{ FTM_DEFAULT_SHAPER_X OPTARG(HAS_Y_AXIS, FTM_DEFAULT_SHAPER_Y) };
|
{ FTM_DEFAULT_SHAPER_X OPTARG(HAS_Y_AXIS, FTM_DEFAULT_SHAPER_Y) };
|
||||||
float baseFreq[1 + ENABLED(HAS_Y_AXIS)] = // Base frequency. [Hz]
|
float baseFreq[NUM_AXES_SHAPED] = // Base frequency. [Hz]
|
||||||
{ FTM_SHAPING_DEFAULT_X_FREQ OPTARG(HAS_Y_AXIS, FTM_SHAPING_DEFAULT_Y_FREQ) };
|
{ FTM_SHAPING_DEFAULT_X_FREQ OPTARG(HAS_Y_AXIS, FTM_SHAPING_DEFAULT_Y_FREQ) };
|
||||||
float zeta[1 + ENABLED(HAS_Y_AXIS)] = // Damping factor
|
float zeta[NUM_AXES_SHAPED] = // Damping factor
|
||||||
{ FTM_SHAPING_ZETA_X OPTARG(HAS_Y_AXIS, FTM_SHAPING_ZETA_Y) };
|
{ FTM_SHAPING_ZETA_X OPTARG(HAS_Y_AXIS, FTM_SHAPING_ZETA_Y) };
|
||||||
float vtol[1 + ENABLED(HAS_Y_AXIS)] = // Vibration Level
|
float vtol[NUM_AXES_SHAPED] = // Vibration Level
|
||||||
{ FTM_SHAPING_V_TOL_X OPTARG(HAS_Y_AXIS, FTM_SHAPING_V_TOL_Y) };
|
{ FTM_SHAPING_V_TOL_X OPTARG(HAS_Y_AXIS, FTM_SHAPING_V_TOL_Y) };
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if HAS_DYNAMIC_FREQ
|
#if HAS_DYNAMIC_FREQ
|
||||||
dynFreqMode_t dynFreqMode = FTM_DEFAULT_DYNFREQ_MODE; // Dynamic frequency mode configuration.
|
dynFreqMode_t dynFreqMode = FTM_DEFAULT_DYNFREQ_MODE; // Dynamic frequency mode configuration.
|
||||||
float dynFreqK[1 + ENABLED(HAS_Y_AXIS)] = { 0.0f }; // Scaling / gain for dynamic frequency. [Hz/mm] or [Hz/g]
|
float dynFreqK[NUM_AXES_SHAPED] = { 0.0f }; // Scaling / gain for dynamic frequency. [Hz/mm] or [Hz/g]
|
||||||
#else
|
#else
|
||||||
static constexpr dynFreqMode_t dynFreqMode = dynFreqMode_DISABLED;
|
static constexpr dynFreqMode_t dynFreqMode = dynFreqMode_DISABLED;
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -41,8 +41,8 @@ enum dynFreqMode_t : uint8_t {
|
||||||
dynFreqMode_MASS_BASED = 2
|
dynFreqMode_MASS_BASED = 2
|
||||||
};
|
};
|
||||||
|
|
||||||
#define CMPNSTR_HAS_SHAPER(A) (ftMotion.cfg.shaper[A] != ftMotionShaper_NONE)
|
#define AXIS_HAS_SHAPER(A) (ftMotion.cfg.shaper[_AXIS(A)] != ftMotionShaper_NONE)
|
||||||
#define CMPNSTR_IS_EISHAPER(A) WITHIN(ftMotion.cfg.shaper[A], ftMotionShaper_EI, ftMotionShaper_3HEI)
|
#define AXIS_HAS_EISHAPER(A) WITHIN(ftMotion.cfg.shaper[_AXIS(A)], ftMotionShaper_EI, ftMotionShaper_3HEI)
|
||||||
|
|
||||||
typedef struct XYZEarray<float, FTM_WINDOW_SIZE> xyze_trajectory_t;
|
typedef struct XYZEarray<float, FTM_WINDOW_SIZE> xyze_trajectory_t;
|
||||||
typedef struct XYZEarray<float, FTM_BATCH_SIZE> xyze_trajectoryMod_t;
|
typedef struct XYZEarray<float, FTM_BATCH_SIZE> xyze_trajectoryMod_t;
|
||||||
|
|
Loading…
Reference in a new issue