Fix chopping negative move values in PlanLongMove

+ use PlanLongMove in UnloadToFinda
+ fix comment in unit test
pull/135/head
D.R.racer 2021-11-03 07:40:04 +01:00 committed by DRracer
parent c3aec0bf92
commit fa4e687fdc
3 changed files with 18 additions and 8 deletions

View File

@ -36,7 +36,7 @@ bool UnloadToFinda::Step() {
if (mi::idler.Engaged()) {
state = WaitingForFINDA;
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;
case WaitingForFINDA:

View File

@ -170,12 +170,22 @@ public:
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 }) {
auto steps = unitToAxisUnit<AxisUnit<pos_t, A, Lenght>>(delta);
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;
if (steps.v < 0) {
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;
}
} 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
steps,

View File

@ -39,7 +39,7 @@ void FeedingToBondtech(logic::ToolChange &tc, uint8_t toSlot) {
REQUIRE(WhileCondition(
tc,
[&](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);
}
return tc.TopLevelState() == ProgressCode::FeedingToBondtech; },