Fix unit test: feed_to_finda

pull/109/head
3d-gussner 2021-08-22 19:44:36 +02:00 committed by DRracer
parent a7a55b4039
commit 382a2c8dc0
2 changed files with 4 additions and 5 deletions

View File

@ -55,8 +55,7 @@ TEST_CASE("feed_to_finda::feed_phase_unlimited", "[feed_to_finda]") {
REQUIRE(ml::leds.LedOn(mg::globals.ActiveSlot(), ml::Color::green));
// now let the filament be pushed into the FINDA - do 500 steps without triggering the condition
// and then let the simulated ADC channel 1 create a FINDA switch
ha::ReinitADC(config::findaADCIndex, ha::TADCData({ 600, 700, 800, 900 }), 1);
hal::gpio::WritePin(FINDA_PIN, hal::gpio::Level::high);
REQUIRE(WhileCondition(
ff,
@ -121,7 +120,7 @@ TEST_CASE("feed_to_finda::FINDA_failed", "[feed_to_finda]") {
REQUIRE(ml::leds.Mode(mg::globals.ActiveSlot(), ml::Color::green) == ml::blink0);
// now let the filament be pushed into the FINDA - but we make sure the FINDA doesn't trigger at all
ha::ReinitADC(config::findaADCIndex, ha::TADCData({ 0 }), 100);
hal::gpio::WritePin(FINDA_PIN, hal::gpio::Level::low);
REQUIRE(WhileCondition(
ff,

View File

@ -56,7 +56,7 @@ void ForceReinitAllAutomata() {
hal::adc::ReinitADC(config::buttonsADCIndex, hal::adc::TADCData({ 1023 }), 1);
// finda OFF
hal::adc::ReinitADC(config::findaADCIndex, hal::adc::TADCData({ 0 }), 1);
hal::gpio::WritePin(FINDA_PIN, hal::gpio::Level::low);
// reinit timing
mt::ReinitTimebase();
@ -79,7 +79,7 @@ void EnsureActiveSlotIndex(uint8_t slot) {
}
void SetFINDAStateAndDebounce(bool press) {
hal::adc::SetADC(config::findaADCIndex, press ? config::findaADCDecisionLevel + 1 : config::findaADCDecisionLevel - 1);
hal::gpio::WritePin(FINDA_PIN, hal::gpio::Level::high);
for (size_t i = 0; i < config::findaDebounceMs + 1; ++i)
main_loop();
}