From 7ae9c9019c598aed9a02f1fd17a2a13f4d4a7969 Mon Sep 17 00:00:00 2001 From: "D.R.racer" Date: Wed, 8 Jun 2022 11:09:35 +0200 Subject: [PATCH] Clear EEPROM filament state upon start when FINDA is off Complement to PR#176 --- src/main.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/main.cpp b/src/main.cpp index 769441f..b83c8bb 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -95,6 +95,14 @@ void setup() { logic::noCommand.SetInitError(ErrorCode::FINDA_VS_EEPROM_DISREPANCY); } + if (!mf::finda.Pressed() && mg::globals.FilamentLoaded() >= mg::InSelector) { + // Opposite situation - not so dangerous, but definitely confusing to users. + // FINDA is not pressed but we have a record in the EEPROM. + // It has been decided, that we shall clear such a record from EEPROM automagically + // and presume there is no filament at all (requires working FINDA) + mg::globals.SetFilamentLoaded(config::toolCount, mg::AtPulley); + } + /// Turn off all leds for (uint8_t i = 0; i < config::toolCount; i++) { ml::leds.SetMode(i, ml::green, ml::off);