Fixup unit tests due to new homing behavior

pull/195/head
D.R.racer 2022-08-01 08:38:46 +02:00 committed by DRracer
parent 989b6e6191
commit 4964e9a781
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);
// 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();
REQUIRE(ms::selector.State() == ms::Selector::HomeForward);
return true;

View File

@ -9,6 +9,7 @@
#include "../stubs/stub_motion.h"
void SimulateIdlerAndSelectorHoming(logic::CommandBase &cb) {
#if 0
// do 5 steps until we trigger the simulated stallguard
for (uint8_t i = 0; i < 5; ++i) {
main_loop();
@ -48,6 +49,11 @@ void SimulateIdlerAndSelectorHoming(logic::CommandBase &cb) {
main_loop();
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) {

View File

@ -80,10 +80,11 @@ void ForceReinitAllAutomata() {
}
void HomeIdlerAndSelector() {
ms::selector.InvalidateHoming();
mi::idler.InvalidateHoming();
ms::selector.InvalidateHoming();
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) {