Avoid homing Idler and Selector at the same time

This PR is an experimental code to delay homing of the Selector after the Idler homes properly.

Unit tests are expected to fail at this moment...
pull/194/head
D.R.racer 2022-07-29 17:54:17 +02:00
parent 857b028baf
commit e77e84a036
3 changed files with 15 additions and 3 deletions

View File

@ -15,9 +15,9 @@ void MovableBase::PlanHome() {
mm::motion.StallGuardReset(axis);
// plan move at least as long as the axis can go from one side to the other
PlanHomingMoveForward();
state = HomeForward;
state = HomeForward; // beware - the derived class may change the state if necessary
currentSlot = -1; // important - other state machines may be waiting for a valid Slot() which is not yet correct while homing in progress
PlanHomingMoveForward();
}
MovableBase::OperationResult MovableBase::InitMovement() {

View File

@ -14,6 +14,7 @@ public:
enum {
Ready = 0, // intentionally set as zero in order to allow zeroing the Idler structure upon startup -> avoid explicit initialization code
Moving,
PlannedHome,
HomeForward,
HomeBack,
TMCFailed,

View File

@ -7,6 +7,7 @@
#include "permanent_storage.h"
#include "../debug.h"
#include "globals.h"
#include "idler.h" // @@TODO this is not nice - introduces dependency between the idler and selector - presumably electrical reasons :(
namespace modules {
namespace selector {
@ -19,7 +20,7 @@ void Selector::PrepareMoveToPlannedSlot() {
}
void Selector::PlanHomingMoveForward() {
mm::motion.PlanMove<mm::Selector>(mm::unitToAxisUnit<mm::S_pos_t>(-config::selectorLimits.lenght * 2), mm::unitToAxisUnit<mm::S_speed_t>(config::selectorFeedrate));
state = PlannedHome;
dbg_logic_P(PSTR("Plan Homing Selector Forward"));
}
@ -93,6 +94,16 @@ bool Selector::Step() {
PerformMove();
//dbg_logic_P(PSTR("Moving Selector"));
return false;
case PlannedHome:
// A testing workaround for presumed electrical reasons why the Idler and Selector cannot perform reliable homing together.
// Let's wait for the Idler to finish homing before homing the selector.
// This will surely break the unit tests, but that's not the point at this stage.
if (mi::idler.HomingValid()) {
// idler is ok, we can start homing the selector
state = HomeForward;
mm::motion.PlanMove<mm::Selector>(mm::unitToAxisUnit<mm::S_pos_t>(-config::selectorLimits.lenght * 2), mm::unitToAxisUnit<mm::S_speed_t>(config::selectorFeedrate));
}
return false;
case HomeForward:
dbg_logic_P(PSTR("Homing Selector Forward"));
PerformHomeForward();