Fixup unit tests due to new homing behavior

pull/194/head
D.R.racer 2022-08-01 08:38:46 +02:00
parent ddc80286a7
commit 2ff85e75cb
3 changed files with 11 additions and 2 deletions

View File

@ -134,6 +134,8 @@ bool RefusedHome(uint8_t slot) {
mg::globals.SetFilamentLoaded(slot, mg::FilamentLoadState::AtPulley); mg::globals.SetFilamentLoaded(slot, mg::FilamentLoadState::AtPulley);
// selector should start the homing sequence // selector should start the homing sequence
main_loop(); // plans the homing move
// since the Idler is ok, the Selector should start homing immediately
main_loop(); main_loop();
REQUIRE(ms::selector.State() == ms::Selector::HomeForward); REQUIRE(ms::selector.State() == ms::Selector::HomeForward);
return true; return true;

View File

@ -9,6 +9,7 @@
#include "../stubs/stub_motion.h" #include "../stubs/stub_motion.h"
void SimulateIdlerAndSelectorHoming(logic::CommandBase &cb) { void SimulateIdlerAndSelectorHoming(logic::CommandBase &cb) {
#if 0
// do 5 steps until we trigger the simulated stallguard // do 5 steps until we trigger the simulated stallguard
for (uint8_t i = 0; i < 5; ++i) { for (uint8_t i = 0; i < 5; ++i) {
main_loop(); main_loop();
@ -48,6 +49,11 @@ void SimulateIdlerAndSelectorHoming(logic::CommandBase &cb) {
main_loop(); main_loop();
cb.Step(); cb.Step();
} }
#else
// sadly, it looks like we need to separate homing of idler and selector due to electrical reasons
SimulateIdlerHoming(cb);
SimulateSelectorHoming(cb);
#endif
} }
void SimulateIdlerHoming(logic::CommandBase &cb) { void SimulateIdlerHoming(logic::CommandBase &cb) {

View File

@ -80,10 +80,11 @@ void ForceReinitAllAutomata() {
} }
void HomeIdlerAndSelector() { void HomeIdlerAndSelector() {
ms::selector.InvalidateHoming();
mi::idler.InvalidateHoming(); mi::idler.InvalidateHoming();
ms::selector.InvalidateHoming();
logic::NoCommand nc; // just a dummy instance which has an empty Step() logic::NoCommand nc; // just a dummy instance which has an empty Step()
SimulateIdlerAndSelectorHoming(nc); SimulateIdlerHoming(nc);
SimulateSelectorHoming(nc);
} }
bool EnsureActiveSlotIndex(uint8_t slot, mg::FilamentLoadState loadState) { bool EnsureActiveSlotIndex(uint8_t slot, mg::FilamentLoadState loadState) {