Upgrade old code

pull/141/head
D.R.racer 2022-05-24 08:27:10 +02:00
parent 3ffe188143
commit aaa7701867
2 changed files with 4 additions and 18 deletions

View File

@ -63,7 +63,10 @@ bool FeedToBondtech::Step() {
state = PushingFilamentFast; state = PushingFilamentFast;
mpu::pulley.InitAxis(); mpu::pulley.InitAxis();
// plan a fast move while in the safe minimal length // plan a fast move while in the safe minimal length
mpu::pulley.PlanMove(config::minimumBowdenLength, feedStart_mm = mm::stepsToUnit<mm::P_pos_t>(mm::P_pos_t({ mm::motion.CurPosition(mm::Pulley) }));
// fast feed in millimeters - if the EEPROM value is incorrect, we'll get the default length
unit::U_mm fastFeedDistance = { (long double)mps::BowdenLength::Get(mg::globals.ActiveSlot()) };
mpu::pulley.PlanMove(config::minimumBowdenLength,
mg::globals.PulleyLoadFeedrate_mm_s(), mg::globals.PulleyLoadFeedrate_mm_s(),
mg::globals.PulleySlowFeedrate_mm_s()); mg::globals.PulleySlowFeedrate_mm_s());
// plan additional slow move while waiting for fsensor to trigger // plan additional slow move while waiting for fsensor to trigger

View File

@ -138,16 +138,6 @@ static constexpr T truncatedUnit(U v, long double mul = 1.) {
return (T)(v.v * mul); return (T)(v.v * mul);
} }
/// Convert an AxisUnit to unit::Unit.
/// The scaling factor is stored with the pair config::AxisConfig::uSteps and
/// config::AxisConfig::stepsPerUnit (one per-axis).
template <typename U, typename AU>
static constexpr typename U::type_t axisUnitToUnit(AU v) {
static_assert(AU::unit == U::unit, "incorrect unit type conversion");
//static_assert(U::base == axisScale[AU::axis].base, "incorrect unit base conversion");
return { (typename U::type_t)(v.v / axisScale[AU::axis].stepsPerUnit) };
}
/// Convert a unit::Unit to a steps type (pos_t or steps_t). /// Convert a unit::Unit to a steps type (pos_t or steps_t).
/// Extract the raw step count from an AxisUnit with type checking. /// Extract the raw step count from an AxisUnit with type checking.
template <typename AU, typename U> template <typename AU, typename U>
@ -155,13 +145,6 @@ static constexpr typename AU::type_t unitToSteps(U v) {
return unitToAxisUnit<AU>(v).v; return unitToAxisUnit<AU>(v).v;
} }
/// Convert a steps type (pos_t or steps_t) to a unit::Unit.
/// Extract the raw step count from an AxisUnit with type checking.
template <typename U, typename AU>
static constexpr typename U::type_t stepsToUnit(AU pos) {
return axisUnitToUnit<U, AU>(pos);
}
// Pulley // Pulley
typedef AxisUnit<pos_t, Pulley, Lenght> P_pos_t; ///< Pulley position type (steps) typedef AxisUnit<pos_t, Pulley, Lenght> P_pos_t; ///< Pulley position type (steps)
typedef AxisUnit<steps_t, Pulley, Speed> P_speed_t; ///< Pulley speed type (steps/s) typedef AxisUnit<steps_t, Pulley, Speed> P_speed_t; ///< Pulley speed type (steps/s)