From 49275b2cb2a7ef245d0011c47ca8fbe4db27fee3 Mon Sep 17 00:00:00 2001 From: Yuri D'Elia Date: Sun, 25 Jul 2021 17:24:49 +0200 Subject: [PATCH] Update eject_steps with the new unit API for demonstration --- src/logic/eject_filament.cpp | 2 +- src/logic/eject_filament.h | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/logic/eject_filament.cpp b/src/logic/eject_filament.cpp index 82e7dbd..4417320 100644 --- a/src/logic/eject_filament.cpp +++ b/src/logic/eject_filament.cpp @@ -50,7 +50,7 @@ bool EjectFilament::Step() { if (mm::motion.QueueEmpty()) { // selector parked aside state = ProgressCode::EjectingFilament; mm::motion.InitAxis(mm::Pulley); - mm::motion.PlanMove(mm::Pulley, ejectSteps, 1500); + mm::motion.PlanMove(ejectLenght, ejectSpeed); } break; case ProgressCode::EjectingFilament: diff --git a/src/logic/eject_filament.h b/src/logic/eject_filament.h index 9012ac9..96ba418 100644 --- a/src/logic/eject_filament.h +++ b/src/logic/eject_filament.h @@ -2,9 +2,14 @@ #include #include "command_base.h" #include "unload_filament.h" +#include "../modules/axisunit.h" namespace logic { +// These cannot be class memebers without definition until c++17 +static constexpr modules::motion::P_pos_t ejectLenght = 50.0_P_mm; //@@TODO +static constexpr modules::motion::P_speed_t ejectSpeed = 1000.0_P_mm_s; //@@TODO + /// @brief A high-level command state machine - handles the complex logic of ejecting filament /// /// The eject operation consists of: @@ -31,7 +36,6 @@ public: ErrorCode Error() const override; private: - constexpr static const uint16_t ejectSteps = 500; //@@TODO UnloadFilament unl; ///< a high-level command/operation may be used as a building block of other operations as well uint8_t slot; void MoveSelectorAside();