Make SG work on Selector
surprisingly - it needed somewhat lower sensitivity, because the selector was triggering stall guard signal even when decelerating (which is subject to separate investigation)pull/168/head
parent
d998171155
commit
62d2e68bc8
|
|
@ -131,7 +131,7 @@ static constexpr AxisConfig selector = {
|
||||||
.iHold = 5, /// 99mA
|
.iHold = 5, /// 99mA
|
||||||
.stealth = false,
|
.stealth = false,
|
||||||
.stepsPerUnit = (200 * 8 / 8.),
|
.stepsPerUnit = (200 * 8 / 8.),
|
||||||
.sg_thrs = 3,
|
.sg_thrs = 5, // 6 looks like too much on my MMU
|
||||||
};
|
};
|
||||||
|
|
||||||
/// Selector motion limits
|
/// Selector motion limits
|
||||||
|
|
|
||||||
|
|
@ -85,12 +85,14 @@ bool CommandBase::WaitForOneModuleErrorRecovery(ErrorCode ec, modules::motion::M
|
||||||
stateBeforeModuleFailed = state;
|
stateBeforeModuleFailed = state;
|
||||||
errorBeforeModuleFailed = error;
|
errorBeforeModuleFailed = error;
|
||||||
error = ec;
|
error = ec;
|
||||||
|
// mui::userInput.Clear(); // @@TODO
|
||||||
state = ProgressCode::ERRWaitingForUser; // such a situation always requires user's attention -> let the printer display an error screen
|
state = ProgressCode::ERRWaitingForUser; // such a situation always requires user's attention -> let the printer display an error screen
|
||||||
}
|
}
|
||||||
|
|
||||||
// are we already recovering an error - that would mean we got another one
|
// are we already recovering an error - that would mean we got another one
|
||||||
if (recoveringMovableErrorAxisMask) {
|
if (recoveringMovableErrorAxisMask) {
|
||||||
error = ec;
|
error = ec;
|
||||||
|
// mui::userInput.Clear(); // @@TODO
|
||||||
state = ProgressCode::ERRWaitingForUser; // such a situation always requires user's attention -> let the printer display an error screen
|
state = ProgressCode::ERRWaitingForUser; // such a situation always requires user's attention -> let the printer display an error screen
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@
|
||||||
#include "movable_base.h"
|
#include "movable_base.h"
|
||||||
#include "globals.h"
|
#include "globals.h"
|
||||||
#include "motion.h"
|
#include "motion.h"
|
||||||
|
#include "leds.h"
|
||||||
|
|
||||||
namespace modules {
|
namespace modules {
|
||||||
namespace motion {
|
namespace motion {
|
||||||
|
|
@ -37,18 +38,23 @@ void MovableBase::PerformMove() {
|
||||||
// TMC2130 entered some error state, the planned move couldn't have been finished - result of operation is Failed
|
// TMC2130 entered some error state, the planned move couldn't have been finished - result of operation is Failed
|
||||||
tmcErrorFlags = mm::motion.DriverForAxis(axis).GetErrorFlags(); // save the failed state
|
tmcErrorFlags = mm::motion.DriverForAxis(axis).GetErrorFlags(); // save the failed state
|
||||||
state = TMCFailed;
|
state = TMCFailed;
|
||||||
|
} else if (mm::motion.QueueEmpty(axis)) {
|
||||||
|
// move finished
|
||||||
|
// ml::leds.SetMode(4, ml::red, ml::off); // @@TODO - temporary signal of the finished move
|
||||||
|
currentSlot = plannedSlot;
|
||||||
|
FinishMove();
|
||||||
|
state = Ready;
|
||||||
} else if (SupportsHoming() && (!mg::globals.MotorsStealth()) && mm::motion.StallGuard(axis)) {
|
} else if (SupportsHoming() && (!mg::globals.MotorsStealth()) && mm::motion.StallGuard(axis)) {
|
||||||
|
// Beware - the ordering of these if statements is important.
|
||||||
|
// We shall only check stallguard when motion queue is not empty for this axis - i.e. ! mm::motion.QueueEmpty(axis)
|
||||||
|
// Such a check has already been done in the previous else-if branch.
|
||||||
|
// ml::leds.SetMode(4, ml::red, ml::on); // @@TODO - temporary signal of the stall guard
|
||||||
// Axis stalled while moving - dangerous especially with the Selector
|
// Axis stalled while moving - dangerous especially with the Selector
|
||||||
// Checked only for axes which support homing (because we plan a homing move after the error is resolved to regain precise position)
|
// Checked only for axes which support homing (because we plan a homing move after the error is resolved to regain precise position)
|
||||||
mm::motion.StallGuardReset(axis);
|
mm::motion.StallGuardReset(axis);
|
||||||
mm::motion.AbortPlannedMoves(axis, true);
|
mm::motion.AbortPlannedMoves(axis, true);
|
||||||
// @@TODO move a bit back from where it came from to enable easier removal of whatever is blocking the axis
|
// @@TODO move a bit back from where it came from to enable easier removal of whatever is blocking the axis
|
||||||
state = MoveFailed;
|
state = MoveFailed;
|
||||||
} else if (mm::motion.QueueEmpty(axis)) {
|
|
||||||
// move finished
|
|
||||||
currentSlot = plannedSlot;
|
|
||||||
FinishMove();
|
|
||||||
state = Ready;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue