diff --git a/src/config/config.h b/src/config/config.h index 551197b..efd7934 100644 --- a/src/config/config.h +++ b/src/config/config.h @@ -54,22 +54,22 @@ static constexpr uint16_t stepTimerQuantum = 256; // 256 = 128us static constexpr uint8_t feedToBondtechMaxRetries = 2; /// Distances -static constexpr U_mm PulleyToCuttingEdge = 33.0_mm; /// 33.0_mm /// Pulley to cutting edge. +static constexpr U_mm pulleyToCuttingEdge = 33.0_mm; /// 33.0_mm /// Pulley to cutting edge. /// Case 1: FINDA working: This should be the max retraction after FINDA un-triggers. /// Case 2: FINDA not working: calculate retraction from printer to this point. -static constexpr U_mm FilamentMinLoadedToMMU = 20.0_mm; /// 20.0_mm ??? /// Limit of retraction. @TODO find correct distance. -static constexpr U_mm EjectFromCuttingEdge = 40.0_mm; /// Eject should ignore FilamentMinLoadedToMMU and retract -static constexpr U_mm CuttingEdgeRetract = 3.0_mm; /// 3.0_mm /// Cutting retraction distance (filament should be flush with outlet) @TODO find correct distance. -static constexpr U_mm CuttingEdgeToFINDA = 18.5_mm; /// 18.5_mm -1.0_mm /// Cutting edge to FINDA MMU2 side -1mm tolerance should be ~18.5. FINDA shouldn't trigger here. -static constexpr U_mm FINDAtriggerDistance = 4.5_mm; /// 9.0_mm /// FINDA trigger distance +1.0_mm tolerance. -static constexpr U_mm CuttingEdgeToFINDAmidpoint = 22.85_mm; /// Cutting edge to Midpoint of FINDA should be 22.85_mm. -static constexpr U_mm FINDAtoCoupler = 12.0_mm; /// 12.0_mm /// FINDA Coupler side to coupler screw. -static constexpr U_mm CouplerToBowden = 3.5_mm; /// 3.5_mm /// FINDA Coupler screw to bowden mmu2s side (in coupling). -static constexpr U_mm DefaultBowdenLength = 427.0_mm; /// ~427.0_mm /// Default Bowden length. @TODO Should be stored in EEPROM. -static constexpr U_mm MinimumBowdenLength = 341.0_mm; /// ~341.0_mm /// Minimum bowden length. @TODO Should be stored in EEPROM. -static constexpr U_mm MaximumBowdenLength = 792.0_mm; /// ~792.0_mm /// Maximum bowden length. @TODO Should be stored in EEPROM. -static constexpr U_mm FeedToFINDA = CuttingEdgeToFINDAmidpoint + FilamentMinLoadedToMMU; -static constexpr U_mm CutLength = 8.0_mm; +static constexpr U_mm filamentMinLoadedToMMU = 20.0_mm; /// 20.0_mm ??? /// Limit of retraction. @TODO find correct distance. +static constexpr U_mm ejectFromCuttingEdge = 40.0_mm; /// Eject should ignore FilamentMinLoadedToMMU and retract +static constexpr U_mm cuttingEdgeRetract = 3.0_mm; /// 3.0_mm /// Cutting retraction distance (filament should be flush with outlet) @TODO find correct distance. +static constexpr U_mm cuttingEdgeToFinda = 18.5_mm; /// 18.5_mm -1.0_mm /// Cutting edge to FINDA MMU2 side -1mm tolerance should be ~18.5. FINDA shouldn't trigger here. +static constexpr U_mm findaTriggerDistance = 4.5_mm; /// 9.0_mm /// FINDA trigger distance +1.0_mm tolerance. +static constexpr U_mm cuttingEdgeToFindaMidpoint = 22.85_mm; /// Cutting edge to Midpoint of FINDA should be 22.85_mm. +static constexpr U_mm findaToCoupler = 12.0_mm; /// 12.0_mm /// FINDA Coupler side to coupler screw. +static constexpr U_mm couplerToBowden = 3.5_mm; /// 3.5_mm /// FINDA Coupler screw to bowden mmu2s side (in coupling). +static constexpr U_mm defaultBowdenLength = 427.0_mm; /// ~427.0_mm /// Default Bowden length. @TODO Should be stored in EEPROM. +static constexpr U_mm minimumBowdenLength = 341.0_mm; /// ~341.0_mm /// Minimum bowden length. @TODO Should be stored in EEPROM. +static constexpr U_mm maximumBowdenLength = 792.0_mm; /// ~792.0_mm /// Maximum bowden length. @TODO Should be stored in EEPROM. +static constexpr U_mm feedToFinda = cuttingEdgeToFindaMidpoint + filamentMinLoadedToMMU; +static constexpr U_mm cutLength = 8.0_mm; /// Begin: Pulley axis configuration static constexpr AxisConfig pulley = { diff --git a/src/logic/cut_filament.cpp b/src/logic/cut_filament.cpp index dbaee7e..be65710 100644 --- a/src/logic/cut_filament.cpp +++ b/src/logic/cut_filament.cpp @@ -59,7 +59,7 @@ bool CutFilament::StepInner() { } else { // unload back to the pulley state = ProgressCode::UnloadingToPulley; - mm::motion.PlanMove(-config::CutLength, config::pulleyFeedrate); + mm::motion.PlanMove(-config::cutLength, config::pulleyFeedrate); } } break; @@ -72,7 +72,7 @@ bool CutFilament::StepInner() { case ProgressCode::PreparingBlade: if (ms::selector.Slot() == cutSlot + 1) { state = ProgressCode::PushingFilament; - mm::motion.PlanMove(config::CutLength, config::pulleyFeedrate); // + mm::motion.PlanMove(config::cutLength, config::pulleyFeedrate); // } break; case ProgressCode::PushingFilament: diff --git a/src/logic/eject_filament.cpp b/src/logic/eject_filament.cpp index 4e43119..82afca5 100644 --- a/src/logic/eject_filament.cpp +++ b/src/logic/eject_filament.cpp @@ -49,7 +49,7 @@ bool EjectFilament::StepInner() { if (mm::motion.QueueEmpty()) { // selector parked aside state = ProgressCode::EjectingFilament; mm::motion.InitAxis(mm::Pulley); - mm::motion.PlanMove(-config::FilamentMinLoadedToMMU, config::pulleyFeedrate); + mm::motion.PlanMove(-config::filamentMinLoadedToMMU, config::pulleyFeedrate); } break; case ProgressCode::EjectingFilament: diff --git a/src/logic/feed_to_bondtech.cpp b/src/logic/feed_to_bondtech.cpp index d220cad..7c3dab6 100644 --- a/src/logic/feed_to_bondtech.cpp +++ b/src/logic/feed_to_bondtech.cpp @@ -25,8 +25,6 @@ void FeedToBondtech::Reset(uint8_t maxRetries) { } bool FeedToBondtech::Step() { - const uint16_t steps = mps::BowdenLength::get(); - switch (state) { case EngagingIdler: if (mi::idler.Engaged()) { @@ -37,7 +35,7 @@ bool FeedToBondtech::Step() { hu::usart1.puts(str); #endif //DEBUG_LOGIC state = PushingFilament; - mm::motion.PlanMove(config::DefaultBowdenLength, config::pulleyFeedrate); //@@TODO constants - there was some strange acceleration sequence in the original FW, + mm::motion.PlanMove(config::defaultBowdenLength, config::pulleyFeedrate); //@@TODO constants - there was some strange acceleration sequence in the original FW, // we can probably hand over some array of constants for hand-tuned acceleration + leverage some smoothing in the stepper as well } return false; diff --git a/src/logic/feed_to_finda.cpp b/src/logic/feed_to_finda.cpp index dbe35ef..2dd52de 100644 --- a/src/logic/feed_to_finda.cpp +++ b/src/logic/feed_to_finda.cpp @@ -24,7 +24,7 @@ bool FeedToFinda::Step() { case EngagingIdler: if (mi::idler.Engaged() && ms::selector.Slot() == mg::globals.ActiveSlot()) { state = PushingFilament; - mm::motion.PlanMove(config::FeedToFINDA, config::pulleyFeedrate); + mm::motion.PlanMove(config::feedToFinda, config::pulleyFeedrate); mui::userInput.Clear(); // remove all buffered events if any just before we wait for some input } return false; @@ -33,7 +33,7 @@ bool FeedToFinda::Step() { mm::motion.AbortPlannedMoves(); // stop pushing filament // FINDA triggered - that means it works and detected the filament tip state = UnloadBackToPTFE; - mm::motion.PlanMove(-config::CuttingEdgeToFINDAmidpoint, config::pulleyFeedrate); + mm::motion.PlanMove(-config::cuttingEdgeToFindaMidpoint, config::pulleyFeedrate); } else if (mm::motion.QueueEmpty()) { // all moves have been finished and FINDA didn't switch on state = Failed; // @@TODO - shall we disengage the idler? diff --git a/src/logic/unload_to_finda.cpp b/src/logic/unload_to_finda.cpp index e3e0d54..74a2c84 100644 --- a/src/logic/unload_to_finda.cpp +++ b/src/logic/unload_to_finda.cpp @@ -33,9 +33,7 @@ bool UnloadToFinda::Step() { case UnloadingToFinda: if (mi::idler.Engaged()) { state = WaitingForFINDA; - int unloadSteps = mps::BowdenLength::get() + 1100; - const int second_point = unloadSteps - 1300; - mm::motion.PlanMove(-config::DefaultBowdenLength - config::FeedToFINDA - config::FilamentMinLoadedToMMU, config::pulleyFeedrate); // @@TODO constants + mm::motion.PlanMove(-config::defaultBowdenLength - config::feedToFinda - config::filamentMinLoadedToMMU, config::pulleyFeedrate); // @@TODO constants } return false; case WaitingForFINDA: