Rebase onto main: use axisUnitToTruncatedUnit
parent
7fbd3c9c7e
commit
7e759fdb51
|
|
@ -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<config::U_mm>(mm::motion.CurPosition<mm::Pulley>());
|
||||
}
|
||||
|
||||
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
|
||||
|
|
|
|||
|
|
@ -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<mm::I_pos_t>(config::idlerLimits.lenght));
|
||||
axisStart = mm::stepsToUnit<mm::I_pos_t>(mm::I_pos_t({ mm::motion.CurPosition(mm::Idler) }));
|
||||
axisStart = mm::axisUnitToTruncatedUnit<config::U_deg>(mm::motion.CurPosition<mm::Idler>());
|
||||
mm::motion.PlanMove<mm::Idler>(mm::unitToAxisUnit<mm::I_pos_t>(-config::idlerLimits.lenght * 2), mm::unitToAxisUnit<mm::I_speed_t>(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::I_pos_t({ mm::motion.CurPosition(mm::Idler) }));
|
||||
int32_t axisEnd = mm::axisUnitToTruncatedUnit<config::U_deg>(mm::motion.CurPosition<mm::Idler>());
|
||||
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
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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::P_pos_t({ mm::motion.CurPosition(mm::Pulley) }));
|
||||
return mm::axisUnitToTruncatedUnit<config::U_mm>(mm::motion.CurPosition<mm::Pulley>());
|
||||
}
|
||||
|
||||
void Pulley::InitAxis() {
|
||||
|
|
|
|||
|
|
@ -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::S_pos_t({ mm::motion.CurPosition(mm::Selector) }));
|
||||
axisStart = mm::axisUnitToTruncatedUnit<config::U_mm>(mm::motion.CurPosition<mm::Selector>());
|
||||
mm::motion.PlanMove<mm::Selector>(mm::unitToAxisUnit<mm::S_pos_t>(config::selectorLimits.lenght * 2), mm::unitToAxisUnit<mm::S_speed_t>(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::S_pos_t({ mm::motion.CurPosition(mm::Selector) }));
|
||||
int32_t axisEnd = mm::axisUnitToTruncatedUnit<config::U_mm>(mm::motion.CurPosition<mm::Selector>());
|
||||
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
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue