Another ~50B down
parent
678fc096f0
commit
dc79314b8f
|
|
@ -21,7 +21,7 @@ void Idler::PrepareMoveToPlannedSlot() {
|
||||||
|
|
||||||
void Idler::PlanHomingMoveForward() {
|
void Idler::PlanHomingMoveForward() {
|
||||||
mm::motion.SetPosition(mm::Idler, mm::unitToSteps<mm::I_pos_t>(config::IdlerOffsetFromHome));
|
mm::motion.SetPosition(mm::Idler, mm::unitToSteps<mm::I_pos_t>(config::IdlerOffsetFromHome));
|
||||||
axisStart = mm::axisUnitToTruncatedUnit<config::U_deg>(mm::motion.CurPosition<mm::Idler>());
|
axisStart = mm::axisUnitToTruncatedUnit<config::U_deg>(mm::unitToAxisUnit<mm::I_pos_t>(config::IdlerOffsetFromHome));
|
||||||
mm::motion.PlanMove<mm::Idler>(mm::unitToAxisUnit<mm::I_pos_t>(config::idlerLimits.lenght * 2),
|
mm::motion.PlanMove<mm::Idler>(mm::unitToAxisUnit<mm::I_pos_t>(config::idlerLimits.lenght * 2),
|
||||||
mm::unitToAxisUnit<mm::I_speed_t>(mg::globals.IdlerHomingFeedrate_deg_s()));
|
mm::unitToAxisUnit<mm::I_speed_t>(mg::globals.IdlerHomingFeedrate_deg_s()));
|
||||||
dbg_logic_P(PSTR("Plan Homing Idler Forward"));
|
dbg_logic_P(PSTR("Plan Homing Idler Forward"));
|
||||||
|
|
@ -30,7 +30,7 @@ void Idler::PlanHomingMoveForward() {
|
||||||
void Idler::PlanHomingMoveBack() {
|
void Idler::PlanHomingMoveBack() {
|
||||||
// we expect that we are at the front end of the axis, set the expected axis' position
|
// 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));
|
mm::motion.SetPosition(mm::Idler, mm::unitToSteps<mm::I_pos_t>(config::idlerLimits.lenght));
|
||||||
axisStart = mm::axisUnitToTruncatedUnit<config::U_deg>(mm::motion.CurPosition<mm::Idler>());
|
axisStart = mm::axisUnitToTruncatedUnit<config::U_deg>(mm::unitToAxisUnit<mm::I_pos_t>(config::idlerLimits.lenght));
|
||||||
mm::motion.PlanMove<mm::Idler>(mm::unitToAxisUnit<mm::I_pos_t>(-config::idlerLimits.lenght * 2),
|
mm::motion.PlanMove<mm::Idler>(mm::unitToAxisUnit<mm::I_pos_t>(-config::idlerLimits.lenght * 2),
|
||||||
mm::unitToAxisUnit<mm::I_speed_t>(mg::globals.IdlerHomingFeedrate_deg_s()));
|
mm::unitToAxisUnit<mm::I_speed_t>(mg::globals.IdlerHomingFeedrate_deg_s()));
|
||||||
dbg_logic_P(PSTR("Plan Homing Idler Back"));
|
dbg_logic_P(PSTR("Plan Homing Idler Back"));
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,7 @@ void Selector::PlanHomingMoveForward() {
|
||||||
void Selector::PlanHomingMoveBack() {
|
void Selector::PlanHomingMoveBack() {
|
||||||
// we expect that we are at the front end of the axis, set the expected axis' position
|
// we expect that we are at the front end of the axis, set the expected axis' position
|
||||||
mm::motion.SetPosition(mm::Selector, 0);
|
mm::motion.SetPosition(mm::Selector, 0);
|
||||||
axisStart = mm::axisUnitToTruncatedUnit<config::U_mm>(mm::motion.CurPosition<mm::Selector>());
|
axisStart = 0;
|
||||||
mm::motion.PlanMove<mm::Selector>(mm::unitToAxisUnit<mm::S_pos_t>(config::selectorLimits.lenght * 2),
|
mm::motion.PlanMove<mm::Selector>(mm::unitToAxisUnit<mm::S_pos_t>(config::selectorLimits.lenght * 2),
|
||||||
mm::unitToAxisUnit<mm::S_speed_t>(mg::globals.SelectorHomingFeedrate_mm_s()));
|
mm::unitToAxisUnit<mm::S_speed_t>(mg::globals.SelectorHomingFeedrate_mm_s()));
|
||||||
dbg_logic_P(PSTR("Plan Homing Selector Back"));
|
dbg_logic_P(PSTR("Plan Homing Selector Back"));
|
||||||
|
|
@ -35,7 +35,7 @@ void Selector::PlanHomingMoveBack() {
|
||||||
|
|
||||||
bool Selector::FinishHomingAndPlanMoveToParkPos() {
|
bool Selector::FinishHomingAndPlanMoveToParkPos() {
|
||||||
// check the axis' length
|
// check the axis' length
|
||||||
if (AxisDistance(mm::axisUnitToTruncatedUnit<config::U_mm>(mm::motion.CurPosition<mm::Selector>())) < (config::selectorLimits.lenght.v - 3)) { //@@TODO is 3mm ok?
|
if (AxisDistance(CurrentPosition_mm()) < (config::selectorLimits.lenght.v - 3)) { //@@TODO is 3mm ok?
|
||||||
return false; // we couldn't home correctly, we cannot set the Selector's position
|
return false; // we couldn't home correctly, we cannot set the Selector's position
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -54,6 +54,11 @@ void Selector::FinishMove() {
|
||||||
mm::motion.Disable(mm::Selector); // turn off selector motor's power every time
|
mm::motion.Disable(mm::Selector); // turn off selector motor's power every time
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// for some reason, the same principle doesn't save code size in the Idler
|
||||||
|
int32_t __attribute__((noinline)) Selector::CurrentPosition_mm() const {
|
||||||
|
return mm::axisUnitToTruncatedUnit<config::U_mm>(mm::motion.CurPosition<mm::Selector>());
|
||||||
|
}
|
||||||
|
|
||||||
Selector::OperationResult Selector::MoveToSlot(uint8_t slot) {
|
Selector::OperationResult Selector::MoveToSlot(uint8_t slot) {
|
||||||
if (state == Moving) {
|
if (state == Moving) {
|
||||||
dbg_logic_P(PSTR("Moving --> Selector refused"));
|
dbg_logic_P(PSTR("Moving --> Selector refused"));
|
||||||
|
|
|
||||||
|
|
@ -49,6 +49,7 @@ protected:
|
||||||
virtual void FinishMove() override;
|
virtual void FinishMove() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
int32_t CurrentPosition_mm() const;
|
||||||
};
|
};
|
||||||
|
|
||||||
/// The one and only instance of Selector in the FW
|
/// The one and only instance of Selector in the FW
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue