CurrentPositionPulley_mm->CurrentPosition_mm and use it in debug prints

pull/154/head
D.R.racer 2022-01-17 10:17:54 +01:00 committed by DRracer
parent ee3c43b12c
commit a408651e62
6 changed files with 9 additions and 9 deletions

View File

@ -33,7 +33,7 @@ bool FeedToBondtech::Step() {
case EngagingIdler: case EngagingIdler:
if (mi::idler.Engaged()) { if (mi::idler.Engaged()) {
dbg_logic_P(PSTR("Feed to Bondtech --> Idler engaged")); dbg_logic_P(PSTR("Feed to Bondtech --> Idler engaged"));
dbg_logic_fP(PSTR("Pulley start steps %u"), mm::motion.CurPosition(mm::Pulley)); dbg_logic_fP(PSTR("Pulley start steps %u"), mpu::pulley.CurrentPositionPulley_mm());
state = PushingFilamentToFSensor; state = PushingFilamentToFSensor;
mpu::pulley.InitAxis(); mpu::pulley.InitAxis();
mpu::pulley.PlanMove(config::defaultBowdenLength, config::pulleyLoadFeedrate, config::pulleySlowFeedrate); mpu::pulley.PlanMove(config::defaultBowdenLength, config::pulleyLoadFeedrate, config::pulleySlowFeedrate);
@ -63,7 +63,7 @@ bool FeedToBondtech::Step() {
case DisengagingIdler: case DisengagingIdler:
if (!mi::idler.Engaged()) { if (!mi::idler.Engaged()) {
dbg_logic_P(PSTR("Feed to Bondtech --> Idler disengaged")); dbg_logic_P(PSTR("Feed to Bondtech --> Idler disengaged"));
dbg_logic_fP(PSTR("Pulley end steps %u"), mm::motion.CurPosition(mm::Pulley)); dbg_logic_fP(PSTR("Pulley end steps %u"), mpu::pulley.CurrentPositionPulley_mm());
state = OK; state = OK;
mpu::pulley.Disable(); mpu::pulley.Disable();
ml::leds.SetMode(mg::globals.ActiveSlot(), ml::green, ml::on); ml::leds.SetMode(mg::globals.ActiveSlot(), ml::green, ml::on);

View File

@ -28,7 +28,7 @@ bool FeedToFinda::Step() {
case EngagingIdler: case EngagingIdler:
if (mi::idler.Engaged() && ms::selector.Slot() == mg::globals.ActiveSlot()) { if (mi::idler.Engaged() && ms::selector.Slot() == mg::globals.ActiveSlot()) {
dbg_logic_P(PSTR("Feed to Finda --> Idler engaged")); dbg_logic_P(PSTR("Feed to Finda --> Idler engaged"));
dbg_logic_fP(PSTR("Pulley start steps %u"), mm::motion.CurPosition(mm::Pulley)); dbg_logic_fP(PSTR("Pulley start steps %u"), mpu::pulley.CurrentPositionPulley_mm());
state = PushingFilament; state = PushingFilament;
mpu::pulley.InitAxis(); mpu::pulley.InitAxis();
// @@TODO this may never happen as load filament always assumes the filament is at least at the pulley // @@TODO this may never happen as load filament always assumes the filament is at least at the pulley
@ -46,7 +46,7 @@ bool FeedToFinda::Step() {
// FINDA triggered - that means it works and detected the filament tip // FINDA triggered - that means it works and detected the filament tip
mg::globals.SetFilamentLoaded(mg::globals.ActiveSlot(), mg::FilamentLoadState::InSelector); mg::globals.SetFilamentLoaded(mg::globals.ActiveSlot(), mg::FilamentLoadState::InSelector);
dbg_logic_P(PSTR("Feed to Finda --> Idler disengaged")); dbg_logic_P(PSTR("Feed to Finda --> Idler disengaged"));
dbg_logic_fP(PSTR("Pulley end steps %u"), mm::motion.CurPosition(mm::Pulley)); dbg_logic_fP(PSTR("Pulley end steps %u"), mpu::pulley.CurrentPositionPulley_mm());
state = OK; state = OK;
return true; // return immediately to allow for a seamless planning of another move (like feeding to bondtech) return true; // return immediately to allow for a seamless planning of another move (like feeding to bondtech)
} else if (mm::motion.QueueEmpty()) { // all moves have been finished and FINDA didn't switch on } else if (mm::motion.QueueEmpty()) { // all moves have been finished and FINDA didn't switch on

View File

@ -21,7 +21,7 @@ bool RetractFromFinda::Step() {
switch (state) { switch (state) {
case EngagingIdler: case EngagingIdler:
if (mi::idler.Engaged()) { if (mi::idler.Engaged()) {
dbg_logic_fP(PSTR("Pulley start steps %u"), mm::motion.CurPosition(mm::Pulley)); dbg_logic_fP(PSTR("Pulley start steps %u"), mpu::pulley.CurrentPositionPulley_mm());
state = UnloadBackToPTFE; state = UnloadBackToPTFE;
mpu::pulley.PlanMove(-(config::cuttingEdgeToFindaMidpoint + config::cuttingEdgeRetract), config::pulleyUnloadFeedrate); mpu::pulley.PlanMove(-(config::cuttingEdgeToFindaMidpoint + config::cuttingEdgeRetract), config::pulleyUnloadFeedrate);
} }
@ -32,7 +32,7 @@ bool RetractFromFinda::Step() {
if (!mf::finda.Pressed()) { // FINDA switched off correctly while the move was performed if (!mf::finda.Pressed()) { // FINDA switched off correctly while the move was performed
state = OK; state = OK;
mg::globals.SetFilamentLoaded(mg::globals.ActiveSlot(), mg::FilamentLoadState::AtPulley); mg::globals.SetFilamentLoaded(mg::globals.ActiveSlot(), mg::FilamentLoadState::AtPulley);
dbg_logic_fP(PSTR("Pulley end steps %u"), mm::motion.CurPosition(mm::Pulley)); dbg_logic_fP(PSTR("Pulley end steps %u"), mpu::pulley.CurrentPositionPulley_mm());
ml::leds.SetMode(mg::globals.ActiveSlot(), ml::green, ml::off); ml::leds.SetMode(mg::globals.ActiveSlot(), ml::green, ml::off);
} else { // FINDA didn't switch off } else { // FINDA didn't switch off
state = Failed; state = Failed;

View File

@ -43,7 +43,7 @@ bool UnloadToFinda::Step() {
if (mi::idler.Engaged()) { if (mi::idler.Engaged()) {
state = WaitingForFINDA; state = WaitingForFINDA;
mg::globals.SetFilamentLoaded(mg::globals.ActiveSlot(), mg::FilamentLoadState::InSelector); mg::globals.SetFilamentLoaded(mg::globals.ActiveSlot(), mg::FilamentLoadState::InSelector);
unloadStart_mm = mpu::pulley.CurrentPositionPulley_mm(); unloadStart_mm = mpu::pulley.CurrentPosition_mm();
mpu::pulley.PlanMove(-config::defaultBowdenLength - config::feedToFinda - config::filamentMinLoadedToMMU, config::pulleyUnloadFeedrate); mpu::pulley.PlanMove(-config::defaultBowdenLength - config::feedToFinda - config::filamentMinLoadedToMMU, config::pulleyUnloadFeedrate);
} }
return false; return false;

View File

@ -38,7 +38,7 @@ void Pulley::PlanMove(unit::U_mm delta, unit::U_mm_s feed_rate, unit::U_mm_s end
state = Moving; state = Moving;
} }
int32_t Pulley::CurrentPositionPulley_mm() { int32_t Pulley::CurrentPosition_mm() {
return mm::stepsToUnit<mm::P_pos_t>(mm::P_pos_t({ mm::motion.CurPosition(mm::Pulley) })); return mm::stepsToUnit<mm::P_pos_t>(mm::P_pos_t({ mm::motion.CurPosition(mm::Pulley) }));
} }

View File

@ -29,7 +29,7 @@ public:
/// @returns rounded current position (rotation) of the Pulley /// @returns rounded current position (rotation) of the Pulley
/// This exists purely to avoid expensive float (long double) computations of distance traveled by the filament /// This exists purely to avoid expensive float (long double) computations of distance traveled by the filament
int32_t CurrentPositionPulley_mm(); int32_t CurrentPosition_mm();
void InitAxis(); void InitAxis();
void Disable(); void Disable();