diff --git a/src/logic/unload_to_finda.cpp b/src/logic/unload_to_finda.cpp index 725e065..3b058e0 100644 --- a/src/logic/unload_to_finda.cpp +++ b/src/logic/unload_to_finda.cpp @@ -23,11 +23,6 @@ void UnloadToFinda::Reset(uint8_t maxTries) { } } -// @@TODO this may end up somewhere else as more code may need to check the distance traveled by the filament -int32_t CurrentPositionPulley_mm() { - return mm::axisUnitToTruncatedUnit(mm::motion.CurPosition()); -} - bool UnloadToFinda::Step() { switch (state) { case EngagingIdler: @@ -48,7 +43,7 @@ bool UnloadToFinda::Step() { } return false; case WaitingForFINDA: { - int32_t currentPulley_mm = CurrentPositionPulley_mm(); + int32_t currentPulley_mm = mpu::pulley.CurrentPosition_mm(); if ((abs(unloadStart_mm - currentPulley_mm) > mm::truncatedUnit(config::fsensorUnloadCheckDistance)) && mfs::fsensor.Pressed()) { // fsensor didn't trigger within the first fsensorUnloadCheckDistance mm -> stop pulling, something failed, report an error // This scenario should not be tried again - repeating it may cause more damage to filament + potentially more collateral damage diff --git a/src/modules/idler.cpp b/src/modules/idler.cpp index 8eb1feb..6ca0d77 100644 --- a/src/modules/idler.cpp +++ b/src/modules/idler.cpp @@ -25,14 +25,14 @@ void Idler::PlanHomingMoveForward() { void Idler::PlanHomingMoveBack() { // we expect that we are at the front end of the axis, set the expected axis' position mm::motion.SetPosition(mm::Idler, mm::unitToSteps(config::idlerLimits.lenght)); - axisStart = mm::stepsToUnit(mm::I_pos_t({ mm::motion.CurPosition(mm::Idler) })); + axisStart = mm::axisUnitToTruncatedUnit(mm::motion.CurPosition()); mm::motion.PlanMove(mm::unitToAxisUnit(-config::idlerLimits.lenght * 2), mm::unitToAxisUnit(config::idlerFeedrate)); dbg_logic_P(PSTR("Plan Homing Idler Back")); } bool Idler::FinishHomingAndPlanMoveToParkPos() { // check the axis' length - int32_t axisEnd = mm::stepsToUnit(mm::I_pos_t({ mm::motion.CurPosition(mm::Idler) })); + int32_t axisEnd = mm::axisUnitToTruncatedUnit(mm::motion.CurPosition()); if (abs(axisEnd - axisStart) < (config::idlerLimits.lenght.v - 10)) { //@@TODO is 10 degrees ok? return false; // we couldn't home correctly, we cannot set the Idler's position } diff --git a/src/modules/pulley.cpp b/src/modules/pulley.cpp index 8e4e1c5..cfe68cb 100644 --- a/src/modules/pulley.cpp +++ b/src/modules/pulley.cpp @@ -40,7 +40,7 @@ void Pulley::PlanMove(unit::U_mm delta, unit::U_mm_s feed_rate, unit::U_mm_s end } int32_t Pulley::CurrentPosition_mm() { - return mm::stepsToUnit(mm::P_pos_t({ mm::motion.CurPosition(mm::Pulley) })); + return mm::axisUnitToTruncatedUnit(mm::motion.CurPosition()); } void Pulley::InitAxis() { diff --git a/src/modules/selector.cpp b/src/modules/selector.cpp index 0c1cc70..1bf2546 100644 --- a/src/modules/selector.cpp +++ b/src/modules/selector.cpp @@ -26,14 +26,14 @@ void Selector::PlanHomingMoveForward() { void Selector::PlanHomingMoveBack() { // we expect that we are at the front end of the axis, set the expected axis' position mm::motion.SetPosition(mm::Selector, 0); - axisStart = mm::stepsToUnit(mm::S_pos_t({ mm::motion.CurPosition(mm::Selector) })); + axisStart = mm::axisUnitToTruncatedUnit(mm::motion.CurPosition()); mm::motion.PlanMove(mm::unitToAxisUnit(config::selectorLimits.lenght * 2), mm::unitToAxisUnit(config::selectorFeedrate)); dbg_logic_P(PSTR("Plan Homing Selector Back")); } bool Selector::FinishHomingAndPlanMoveToParkPos() { // check the axis' length - int32_t axisEnd = mm::stepsToUnit(mm::S_pos_t({ mm::motion.CurPosition(mm::Selector) })); + int32_t axisEnd = mm::axisUnitToTruncatedUnit(mm::motion.CurPosition()); if (abs(axisEnd - axisStart) < (config::selectorLimits.lenght.v - 3)) { //@@TODO is 3mm ok? return false; // we couldn't home correctly, we cannot set the Selector's position }