Fix chopping negative move values in PlanLongMove
+ use PlanLongMove in UnloadToFinda + fix comment in unit testpull/135/head
parent
c3aec0bf92
commit
fa4e687fdc
|
|
@ -36,7 +36,7 @@ bool UnloadToFinda::Step() {
|
||||||
if (mi::idler.Engaged()) {
|
if (mi::idler.Engaged()) {
|
||||||
state = WaitingForFINDA;
|
state = WaitingForFINDA;
|
||||||
mg::globals.SetFilamentLoaded(mg::globals.ActiveSlot(), mg::FilamentLoadState::InSelector);
|
mg::globals.SetFilamentLoaded(mg::globals.ActiveSlot(), mg::FilamentLoadState::InSelector);
|
||||||
mm::motion.PlanMove<mm::Pulley>(-config::defaultBowdenLength - config::feedToFinda - config::filamentMinLoadedToMMU, config::pulleyFeedrate); // @@TODO constants
|
mm::motion.PlanLongMove<mm::Pulley>(-config::defaultBowdenLength - config::feedToFinda - config::filamentMinLoadedToMMU, config::pulleyFeedrate);
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
case WaitingForFINDA:
|
case WaitingForFINDA:
|
||||||
|
|
|
||||||
|
|
@ -170,12 +170,22 @@ public:
|
||||||
constexpr void PlanLongMove(config::Unit<long double, B, Lenght> delta,
|
constexpr void PlanLongMove(config::Unit<long double, B, Lenght> delta,
|
||||||
config::Unit<long double, B, Speed> feed_rate, config::Unit<long double, B, Speed> end_rate = { 0 }) {
|
config::Unit<long double, B, Speed> feed_rate, config::Unit<long double, B, Speed> end_rate = { 0 }) {
|
||||||
auto steps = unitToAxisUnit<AxisUnit<pos_t, A, Lenght>>(delta);
|
auto steps = unitToAxisUnit<AxisUnit<pos_t, A, Lenght>>(delta);
|
||||||
while (steps.v > 32767) {
|
if (steps.v < 0) {
|
||||||
PlanMove<A>(
|
while (steps.v > 32767) {
|
||||||
{ 32767 },
|
PlanMove<A>(
|
||||||
unitToAxisUnit<AxisUnit<steps_t, A, Speed>>(feed_rate),
|
{ 32767 },
|
||||||
unitToAxisUnit<AxisUnit<steps_t, A, Speed>>(feed_rate)); // keep the end feedrate the same to continue with the next segment
|
unitToAxisUnit<AxisUnit<steps_t, A, Speed>>(feed_rate),
|
||||||
steps.v -= 32767;
|
unitToAxisUnit<AxisUnit<steps_t, A, Speed>>(feed_rate)); // keep the end feedrate the same to continue with the next segment
|
||||||
|
steps.v -= 32767;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
while (steps.v < -32767) {
|
||||||
|
PlanMove<A>(
|
||||||
|
{ -32767 },
|
||||||
|
unitToAxisUnit<AxisUnit<steps_t, A, Speed>>(feed_rate),
|
||||||
|
unitToAxisUnit<AxisUnit<steps_t, A, Speed>>(feed_rate)); // keep the end feedrate the same to continue with the next segment
|
||||||
|
steps.v += 32767;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
PlanMove<A>( // last segment
|
PlanMove<A>( // last segment
|
||||||
steps,
|
steps,
|
||||||
|
|
|
||||||
|
|
@ -39,7 +39,7 @@ void FeedingToBondtech(logic::ToolChange &tc, uint8_t toSlot) {
|
||||||
REQUIRE(WhileCondition(
|
REQUIRE(WhileCondition(
|
||||||
tc,
|
tc,
|
||||||
[&](int step) -> bool {
|
[&](int step) -> bool {
|
||||||
if(step == 2000){ // on 5000th step make filament sensor trigger
|
if(step == 2000){ // on 2000th step make filament sensor trigger
|
||||||
mfs::fsensor.ProcessMessage(true);
|
mfs::fsensor.ProcessMessage(true);
|
||||||
}
|
}
|
||||||
return tc.TopLevelState() == ProgressCode::FeedingToBondtech; },
|
return tc.TopLevelState() == ProgressCode::FeedingToBondtech; },
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue