Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minor Updates for EasyThreeD K7 #26145

Closed
wants to merge 8 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions Marlin/src/feature/backlash.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,37 @@ void Backlash::add_correction_steps(const int32_t &da, const int32_t &db, const
// This correction reduces the residual error and adds block steps
if (error_correction) {
block->steps[axis] += ABS(error_correction);

// Recalculate block->millimeters so that acceleration is calculated correctly
// (Relocated from module/planner.cpp)
if (true NUM_AXIS_GANG(
&& block->steps.a < MIN_STEPS_PER_SEGMENT, && block->steps.b < MIN_STEPS_PER_SEGMENT, && block->steps.c < MIN_STEPS_PER_SEGMENT,
&& block->steps.i < MIN_STEPS_PER_SEGMENT, && block->steps.j < MIN_STEPS_PER_SEGMENT, && block->steps.k < MIN_STEPS_PER_SEGMENT,
&& block->steps.u < MIN_STEPS_PER_SEGMENT, && block->steps.v < MIN_STEPS_PER_SEGMENT, && block->steps.w < MIN_STEPS_PER_SEGMENT)
) {
block->millimeters = TERN0(HAS_EXTRUDERS, ABS(dist_mm.e));
}
else if (hints.millimeters) {
block->millimeters = hints.millimeters;
}
else {
const xyze_pos_t displacement = LOGICAL_AXIS_ARRAY(
dist_mm.e,
#if ANY(CORE_IS_XY, MARKFORGED_XY, MARKFORGED_YX)
dist_mm.head.x, dist_mm.head.y, dist_mm.z,
#elif CORE_IS_XZ
dist_mm.head.x, dist_mm.y, dist_mm.head.z,
#elif CORE_IS_YZ
dist_mm.x, dist_mm.head.y, dist_mm.head.z,
#else
dist_mm.x, dist_mm.y, dist_mm.z,
#endif
dist_mm.i, dist_mm.j, dist_mm.k,
dist_mm.u, dist_mm.v, dist_mm.w
);
block->millimeters = get_move_distance(displacement OPTARG(HAS_ROTATIONAL_AXES, cartesian_move));
}

Copy link
Member

@thinkyhead thinkyhead Aug 7, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well this obviously can't just be moved here, as most of the variables it references only exist in its original location. If the aim is to deal with block->steps[axis] having been affected by error_correction then it would be better to make a method that returns all the axis error_correction values or pre-update all the block->steps[] and then use the modified steps for the logic in Planner::_populate_block.

Copy link
Contributor Author

@schmttc schmttc Aug 7, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My apologies, rookie git use, this wasn't supposed to end up in the PR, I expected the PR to be frozen not updated with the source.
I'll cancel this PR until I've finished working on the backlash issue

#if ENABLED(CORE_BACKLASH)
switch (axis) {
case CORE_AXIS_1:
Expand Down
7 changes: 4 additions & 3 deletions Marlin/src/feature/easythreed_ui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ void EasythreedUI::loadButton() {
break;

case FS_PROCEED: {
// Feed or Retract just once. Hard abort all moves and return to idle on swicth release.
// Feed or Retract just once. Hard abort all moves and return to idle on switch release.
static bool flag = false;
if (READ(BTN_RETRACT) && READ(BTN_FEED)) { // Switch in center position (stop)
flag = false; // Restore flag to false
Expand All @@ -142,7 +142,7 @@ void EasythreedUI::loadButton() {
}
else if (!flag) {
flag = true;
queue.inject(!READ(BTN_RETRACT) ? F("G91\nG0 E10 F180\nG0 E-120 F180\nM104 S0") : F("G91\nG0 E100 F120\nM104 S0"));
queue.inject(!READ(BTN_RETRACT) ? F("G91\nG0 E10 F180\nG0 E-220 F180\nM104 S0") : F("G91\nG0 E200 F120\nM104 S0"));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it possible to use this UI with other machines besides those which prefer these lengths?

}
} break;
}
Expand Down Expand Up @@ -200,7 +200,7 @@ void EasythreedUI::printButton() {
card.selectFileByIndex(filecnt); // Select the last file according to current sort options
card.openAndPrintFile(card.filename); // Start printing it
} break;
case PF_PAUSE: { // Pause printing (not currently firing)
case PF_PAUSE: { // Pause printing
if (!printingIsActive()) break;
blink_interval_ms = LED_ON; // Set indicator to steady ON
queue.inject(F("M25")); // Queue Pause
Expand All @@ -226,6 +226,7 @@ void EasythreedUI::printButton() {
planner.synchronize(); // Wait for commands already in the planner to finish
TERN_(HAS_STEPPER_RESET, disableStepperDrivers()); // Disable all steppers - now!
print_key_flag = PF_START; // The "Print" button now starts a new print
blink_interval_ms = LED_ON; // Update Status LED
}
break;
}
Expand Down
4 changes: 2 additions & 2 deletions Marlin/src/module/planner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2139,8 +2139,9 @@ bool Planner::_populate_block(
block->millimeters = TERN0(HAS_EXTRUDERS, ABS(dist_mm.e));
}
else {
if (hints.millimeters)
if (hints.millimeters) {
block->millimeters = hints.millimeters;
}
else {
const xyze_pos_t displacement = LOGICAL_AXIS_ARRAY(
dist_mm.e,
Expand All @@ -2156,7 +2157,6 @@ bool Planner::_populate_block(
dist_mm.i, dist_mm.j, dist_mm.k,
dist_mm.u, dist_mm.v, dist_mm.w
);

block->millimeters = get_move_distance(displacement OPTARG(HAS_ROTATIONAL_AXES, cartesian_move));
}

Expand Down
Loading