From f2f82c620a6168960dc5e99f8976501fcf226cb6 Mon Sep 17 00:00:00 2001 From: "D.R.racer" Date: Tue, 23 Nov 2021 08:06:37 +0100 Subject: [PATCH] Set green LED at start when filament loaded + set Idler as idle at start --- src/main.cpp | 5 +++++ src/modules/idler.cpp | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index 3c8fb5d..0a826ce 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -117,6 +117,11 @@ void setup() { // Idler and Selector decide whether homing is possible/safe mi::idler.Init(); ms::selector.Init(); + + // activate the correct LED if filament is present + if (mg::globals.FilamentLoaded() > mg::FilamentLoadState::AtPulley) { + ml::leds.SetMode(mg::globals.ActiveSlot(), ml::green, ml::on); + } } static constexpr const uint8_t maxMsgLen = 10; diff --git a/src/modules/idler.cpp b/src/modules/idler.cpp index bc6b923..c3c41e7 100644 --- a/src/modules/idler.cpp +++ b/src/modules/idler.cpp @@ -123,8 +123,8 @@ void Idler::Init() { // home the Idler only in case we don't have filament loaded in the printer (or at least we think we don't) PlanHome(mm::Idler); } else { - // otherwise set selector's position according to know slot positions (and pretend it is correct) - mm::motion.SetPosition(mm::Idler, SlotPosition(mg::globals.ActiveSlot()).v); + // otherwise assume the Idler is at its idle position (that's where it usually is) + mm::motion.SetPosition(mm::Idler, SlotPosition(IdleSlotIndex()).v); InvalidateHoming(); // and plan homing sequence ASAP } }