clang-format
parent
5f28dbf056
commit
0bead533df
|
|
@ -58,7 +58,7 @@ static constexpr U_mm PulleyToCuttingEdge = 33.0_mm; /// 33.0_mm /// Pulley to c
|
|||
/// 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 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.
|
||||
|
|
@ -67,8 +67,8 @@ static constexpr U_mm FINDAtoCoupler = 12.0_mm; /// 12.0_mm /// FINDA Coupler si
|
|||
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 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
|
||||
|
|
@ -117,15 +117,15 @@ static constexpr U_mm SelectorOffsetFromMax = 1.0_mm; /// Selector offset from h
|
|||
/// selector.dirOn = true = Home at max: selector hits left side of the MMU2S body
|
||||
/// selector.dirOn = false = Home at min: selector POM nut hit the selector motor
|
||||
static constexpr U_mm selectorSlotPositions[toolCount + 1] = {
|
||||
|
||||
///selctor max positions
|
||||
|
||||
///selctor max positions
|
||||
SelectorOffsetFromMax + 0 * SelectorSlotDistance, ///1.0_mm + 0 * 14.0_mm = 1.0_mm
|
||||
SelectorOffsetFromMax + 1 * SelectorSlotDistance, ///1.0_mm + 1 * 14.0_mm = 15.0_mm
|
||||
SelectorOffsetFromMax + 2 * SelectorSlotDistance, ///1.0_mm + 2 * 14.0_mm = 29.0_mm
|
||||
SelectorOffsetFromMax + 3 * SelectorSlotDistance, ///1.0_mm + 3 * 14.0_mm = 43.0_mm
|
||||
SelectorOffsetFromMax + 4 * SelectorSlotDistance, ///1.0_mm + 4 * 14.0_mm = 57.0_mm
|
||||
SelectorOffsetFromMax + 5 * SelectorSlotDistance ///1.0_mm + 5 * 14.0_mm = 71.0_mm
|
||||
/*
|
||||
/*
|
||||
///selector min positions
|
||||
SelectorOffsetFromMin - 1.0_mm - 0 * SelectorSlotDistance, ///75.5_mm - 1.0_mm - 0 * 14.0_mm = 74.5_mm
|
||||
SelectorOffsetFromMin - 1.0_mm - 1 * SelectorSlotDistance, ///75.5_mm - 1.0_mm - 1 * 14.0_mm = 60.5_mm
|
||||
|
|
|
|||
|
|
@ -7,17 +7,17 @@
|
|||
#include "../modules/motion.h"
|
||||
#include "../modules/permanent_storage.h"
|
||||
#ifdef DEBUG_LOGIC
|
||||
#include "../hal/usart.h"
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include "../hal/usart.h"
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#endif //DEBUG_LOGIC
|
||||
|
||||
namespace logic {
|
||||
|
||||
void FeedToBondtech::Reset(uint8_t maxRetries) {
|
||||
#ifdef DEBUG_LOGIC
|
||||
hu::usart1.puts("\nFeed to Bondtech\n\n");
|
||||
#endif //DEBUG_LOGIC
|
||||
#ifdef DEBUG_LOGIC
|
||||
hu::usart1.puts("\nFeed to Bondtech\n\n");
|
||||
#endif //DEBUG_LOGIC
|
||||
state = EngagingIdler;
|
||||
this->maxRetries = maxRetries;
|
||||
ml::leds.SetMode(mg::globals.ActiveSlot(), ml::Color::green, ml::Mode::blink0);
|
||||
|
|
@ -30,21 +30,21 @@ bool FeedToBondtech::Step() {
|
|||
switch (state) {
|
||||
case EngagingIdler:
|
||||
if (mi::idler.Engaged()) {
|
||||
#ifdef DEBUG_LOGIC
|
||||
#ifdef DEBUG_LOGIC
|
||||
uint16_t startSteps = mm::motion.CurPosition(mm::Pulley);
|
||||
char str[30];
|
||||
sprintf_P(str, PSTR("\nPulley start steps %u\n\n"), startSteps);
|
||||
hu::usart1.puts(str);
|
||||
#endif //DEBUG_LOGIC
|
||||
#endif //DEBUG_LOGIC
|
||||
state = PushingFilament;
|
||||
mm::motion.PlanMove<mm::Pulley>(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;
|
||||
case PushingFilament:
|
||||
#ifdef DEBUG_LOGIC
|
||||
hu::usart1.puts("\nFeed to Bondtech --> Pushing\n\n");
|
||||
#endif //DEBUG_LOGIC
|
||||
#ifdef DEBUG_LOGIC
|
||||
hu::usart1.puts("\nFeed to Bondtech --> Pushing\n\n");
|
||||
#endif //DEBUG_LOGIC
|
||||
if (mfs::fsensor.Pressed()) {
|
||||
mm::motion.AbortPlannedMoves(); // stop pushing filament
|
||||
mi::idler.Disengage();
|
||||
|
|
@ -57,22 +57,22 @@ bool FeedToBondtech::Step() {
|
|||
}
|
||||
return false;
|
||||
case DisengagingIdler:
|
||||
#ifdef DEBUG_LOGIC
|
||||
hu::usart1.puts("\nFeed to Bondtech --> DisengagingIdler\n\n");
|
||||
#endif //DEBUG_LOGIC
|
||||
#ifdef DEBUG_LOGIC
|
||||
hu::usart1.puts("\nFeed to Bondtech --> DisengagingIdler\n\n");
|
||||
#endif //DEBUG_LOGIC
|
||||
if (!mi::idler.Engaged()) {
|
||||
state = OK;
|
||||
ml::leds.SetMode(mg::globals.ActiveSlot(), ml::green, ml::on);
|
||||
}
|
||||
return false;
|
||||
case OK:
|
||||
#ifdef DEBUG_LOGIC
|
||||
#ifdef DEBUG_LOGIC
|
||||
hu::usart1.puts("\nFeed to Bondtech\n\n");
|
||||
#endif //DEBUG_LOGIC
|
||||
#endif //DEBUG_LOGIC
|
||||
case Failed:
|
||||
#ifdef DEBUG_LOGIC
|
||||
#ifdef DEBUG_LOGIC
|
||||
hu::usart1.puts("\nFeed to Bondtech FAILED\n\n");
|
||||
#endif //DEBUG_LOGIC
|
||||
#endif //DEBUG_LOGIC
|
||||
default:
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ bool FeedToFinda::Step() {
|
|||
if (mm::motion.QueueEmpty()) { // all moves have been finished
|
||||
state = DisengagingIdler;
|
||||
mi::idler.Disengage();
|
||||
}
|
||||
}
|
||||
return false;
|
||||
case DisengagingIdler:
|
||||
if (!mi::idler.Engaged()) {
|
||||
|
|
|
|||
|
|
@ -8,9 +8,9 @@
|
|||
#include "../modules/selector.h"
|
||||
#include "../modules/user_input.h"
|
||||
#ifdef DEBUG_LOGIC
|
||||
#include "../hal/usart.h"
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include "../hal/usart.h"
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#endif //DEBUG_LOGIC
|
||||
|
||||
namespace logic {
|
||||
|
|
@ -21,9 +21,9 @@ void LoadFilament::Reset(uint8_t param) {
|
|||
if (!CheckToolIndex(param)) {
|
||||
return;
|
||||
}
|
||||
#ifdef DEBUG_LOGIC
|
||||
hu::usart1.puts("Load Filament\n\n");
|
||||
#endif //DEBUG_LOGIC
|
||||
#ifdef DEBUG_LOGIC
|
||||
hu::usart1.puts("Load Filament\n\n");
|
||||
#endif //DEBUG_LOGIC
|
||||
state = ProgressCode::EngagingIdler;
|
||||
error = ErrorCode::RUNNING;
|
||||
mg::globals.SetActiveSlot(param);
|
||||
|
|
|
|||
|
|
@ -8,9 +8,9 @@
|
|||
#include "../modules/permanent_storage.h"
|
||||
#include "../modules/selector.h"
|
||||
#ifdef DEBUG_LOGIC
|
||||
#include "../hal/usart.h"
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include "../hal/usart.h"
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#endif //DEBUG_LOGIC
|
||||
|
||||
namespace logic {
|
||||
|
|
@ -23,10 +23,10 @@ void ToolChange::Reset(uint8_t param) {
|
|||
}
|
||||
|
||||
if (param == mg::globals.ActiveSlot() && mg::globals.FilamentLoaded()) {
|
||||
// we are already at the correct slot and the filament is loaded - nothing to do
|
||||
#ifdef DEBUG_LOGIC
|
||||
hu::usart1.puts("we are already at the correct slot and the filament is loaded - nothing to do\n");
|
||||
#endif //DEBUG_LOGIC
|
||||
// we are already at the correct slot and the filament is loaded - nothing to do
|
||||
#ifdef DEBUG_LOGIC
|
||||
hu::usart1.puts("we are already at the correct slot and the filament is loaded - nothing to do\n");
|
||||
#endif //DEBUG_LOGIC
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -35,16 +35,16 @@ void ToolChange::Reset(uint8_t param) {
|
|||
plannedSlot = param;
|
||||
|
||||
if (mg::globals.FilamentLoaded()) {
|
||||
#ifdef DEBUG_LOGIC
|
||||
hu::usart1.puts("Filament is loaded --> unload\n");
|
||||
#endif //DEBUG_LOGIC
|
||||
#ifdef DEBUG_LOGIC
|
||||
hu::usart1.puts("Filament is loaded --> unload\n");
|
||||
#endif //DEBUG_LOGIC
|
||||
state = ProgressCode::UnloadingFilament;
|
||||
unl.Reset(mg::globals.ActiveSlot());
|
||||
} else {
|
||||
state = ProgressCode::LoadingFilament;
|
||||
#ifdef DEBUG_LOGIC
|
||||
hu::usart1.puts("Filament is not loaded --> load\n");
|
||||
#endif //DEBUG_LOGIC
|
||||
#ifdef DEBUG_LOGIC
|
||||
hu::usart1.puts("Filament is not loaded --> load\n");
|
||||
#endif //DEBUG_LOGIC
|
||||
load.Reset(plannedSlot);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,9 +7,9 @@
|
|||
#include "../modules/permanent_storage.h"
|
||||
#include "../modules/user_input.h"
|
||||
#ifdef DEBUG_LOGIC
|
||||
#include "../hal/usart.h"
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include "../hal/usart.h"
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#endif //DEBUG_LOGIC
|
||||
|
||||
namespace logic {
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ bool UnloadToFinda::Step() {
|
|||
state = WaitingForFINDA;
|
||||
int unloadSteps = mps::BowdenLength::get() + 1100;
|
||||
const int second_point = unloadSteps - 1300;
|
||||
mm::motion.PlanMove<mm::Pulley>(-config::DefaultBowdenLength -config::FeedToFINDA -config::FilamentMinLoadedToMMU, config::pulleyFeedrate); // @@TODO constants
|
||||
mm::motion.PlanMove<mm::Pulley>(-config::DefaultBowdenLength - config::FeedToFINDA - config::FilamentMinLoadedToMMU, config::pulleyFeedrate); // @@TODO constants
|
||||
}
|
||||
return false;
|
||||
case WaitingForFINDA:
|
||||
|
|
|
|||
|
|
@ -4,9 +4,9 @@
|
|||
#include "motion.h"
|
||||
#include "permanent_storage.h"
|
||||
#ifdef DEBUG_LOGIC
|
||||
#include "../hal/usart.h"
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include "../hal/usart.h"
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#endif //DEBUG_LOGIC
|
||||
|
||||
namespace modules {
|
||||
|
|
@ -16,44 +16,44 @@ Idler idler;
|
|||
|
||||
void Idler::PrepareMoveToPlannedSlot() {
|
||||
mm::motion.PlanMoveTo<mm::Idler>(SlotPosition(plannedSlot), mm::unitToAxisUnit<mm::I_speed_t>(config::idlerFeedrate));
|
||||
#ifdef DEBUG_LOGIC
|
||||
char str[30];
|
||||
sprintf_P(str, PSTR("Prepare Move Idler slot %d\n"), plannedSlot);
|
||||
hu::usart1.puts(str);
|
||||
#endif //DEBUG_LOGIC
|
||||
#ifdef DEBUG_LOGIC
|
||||
char str[30];
|
||||
sprintf_P(str, PSTR("Prepare Move Idler slot %d\n"), plannedSlot);
|
||||
hu::usart1.puts(str);
|
||||
#endif //DEBUG_LOGIC
|
||||
}
|
||||
|
||||
void Idler::PlanHomingMove() {
|
||||
mm::motion.PlanMove<mm::Idler>(mm::unitToAxisUnit<mm::I_pos_t>(-config::idlerLimits.lenght * 2), mm::unitToAxisUnit<mm::I_speed_t>(config::idlerFeedrate));
|
||||
#ifdef DEBUG_LOGIC
|
||||
hu::usart1.puts("Plan Homing Idler\n");
|
||||
#endif //DEBUG_LOGIC
|
||||
#ifdef DEBUG_LOGIC
|
||||
hu::usart1.puts("Plan Homing Idler\n");
|
||||
#endif //DEBUG_LOGIC
|
||||
}
|
||||
|
||||
Idler::OperationResult Idler::Disengage() {
|
||||
if (state == Moving) {
|
||||
#ifdef DEBUG_LOGIC
|
||||
hu::usart1.puts("Moving --> Disengage refused\n");
|
||||
#endif //DEBUG_LOGIC
|
||||
#ifdef DEBUG_LOGIC
|
||||
hu::usart1.puts("Moving --> Disengage refused\n");
|
||||
#endif //DEBUG_LOGIC
|
||||
return OperationResult::Refused;
|
||||
}
|
||||
plannedSlot = IdleSlotIndex();
|
||||
plannedEngage = false;
|
||||
|
||||
if (!Engaged()) {
|
||||
#ifdef DEBUG_LOGIC
|
||||
hu::usart1.puts("Disengage Idler\n");
|
||||
#endif //DEBUG_LOGIC
|
||||
#ifdef DEBUG_LOGIC
|
||||
hu::usart1.puts("Disengage Idler\n");
|
||||
#endif //DEBUG_LOGIC
|
||||
return OperationResult::Accepted;
|
||||
}
|
||||
return InitMovement(mm::Idler);
|
||||
}
|
||||
|
||||
Idler::OperationResult Idler::Engage(uint8_t slot) {
|
||||
if (state == Moving){
|
||||
#ifdef DEBUG_LOGIC
|
||||
hu::usart1.puts("Moving --> Engage refused\n");
|
||||
#endif //DEBUG_LOGIC
|
||||
if (state == Moving) {
|
||||
#ifdef DEBUG_LOGIC
|
||||
hu::usart1.puts("Moving --> Engage refused\n");
|
||||
#endif //DEBUG_LOGIC
|
||||
return OperationResult::Refused;
|
||||
}
|
||||
|
||||
|
|
@ -61,9 +61,9 @@ Idler::OperationResult Idler::Engage(uint8_t slot) {
|
|||
plannedEngage = true;
|
||||
|
||||
if (Engaged()) {
|
||||
#ifdef DEBUG_LOGIC
|
||||
hu::usart1.puts("Engage Idler\n");
|
||||
#endif //DEBUG_LOGIC
|
||||
#ifdef DEBUG_LOGIC
|
||||
hu::usart1.puts("Engage Idler\n");
|
||||
#endif //DEBUG_LOGIC
|
||||
return OperationResult::Accepted;
|
||||
}
|
||||
|
||||
|
|
@ -81,21 +81,21 @@ bool Idler::Home() {
|
|||
bool Idler::Step() {
|
||||
switch (state) {
|
||||
case Moving:
|
||||
#ifdef DEBUG_LOGIC
|
||||
//hu::usart1.puts("Moving Idler\n");
|
||||
#endif //DEBUG_LOGIC
|
||||
#ifdef DEBUG_LOGIC
|
||||
//hu::usart1.puts("Moving Idler\n");
|
||||
#endif //DEBUG_LOGIC
|
||||
PerformMove(mm::Idler);
|
||||
return false;
|
||||
case Homing:
|
||||
#ifdef DEBUG_LOGIC
|
||||
hu::usart1.puts("Homing Idler\n");
|
||||
#endif //DEBUG_LOGIC
|
||||
#ifdef DEBUG_LOGIC
|
||||
hu::usart1.puts("Homing Idler\n");
|
||||
#endif //DEBUG_LOGIC
|
||||
PerformHome(mm::Idler);
|
||||
return false;
|
||||
case Ready:
|
||||
#ifdef DEBUG_LOGIC
|
||||
//hu::usart1.puts("Idler Ready\n");
|
||||
#endif //DEBUG_LOGIC
|
||||
#ifdef DEBUG_LOGIC
|
||||
//hu::usart1.puts("Idler Ready\n");
|
||||
#endif //DEBUG_LOGIC
|
||||
currentlyEngaged = plannedEngage;
|
||||
currentSlot = plannedSlot;
|
||||
|
||||
|
|
@ -104,9 +104,9 @@ bool Idler::Step() {
|
|||
|
||||
return true;
|
||||
case Failed:
|
||||
#ifdef DEBUG_LOGIC
|
||||
hu::usart1.puts("Idler Failed\n");
|
||||
#endif //DEBUG_LOGIC
|
||||
#ifdef DEBUG_LOGIC
|
||||
hu::usart1.puts("Idler Failed\n");
|
||||
#endif //DEBUG_LOGIC
|
||||
default:
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
#include "motion.h"
|
||||
#include "../panic.h"
|
||||
#ifdef DEBUG_LOGIC
|
||||
#include "../hal/usart.h"
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include "../hal/usart.h"
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#endif //DEBUG_LOGIC
|
||||
|
||||
// TODO: use proper timer abstraction
|
||||
|
|
@ -50,11 +50,11 @@ void Motion::StallGuardReset(Axis axis) {
|
|||
}
|
||||
|
||||
void Motion::PlanMoveTo(Axis axis, pos_t pos, steps_t feed_rate, steps_t end_rate) {
|
||||
#ifdef DEBUG_LOGIC
|
||||
char str[30];
|
||||
sprintf_P(str, PSTR("Move axis %d to %u\n"), axis, pos);
|
||||
hu::usart1.puts(str);
|
||||
#endif //DEBUG_LOGIC
|
||||
#ifdef DEBUG_LOGIC
|
||||
char str[30];
|
||||
sprintf_P(str, PSTR("Move axis %d to %u\n"), axis, pos);
|
||||
hu::usart1.puts(str);
|
||||
#endif //DEBUG_LOGIC
|
||||
|
||||
if (axisData[axis].ctrl.PlanMoveTo(pos, feed_rate, end_rate)) {
|
||||
// move was queued, prepare the axis
|
||||
|
|
|
|||
|
|
@ -4,9 +4,9 @@
|
|||
#include "motion.h"
|
||||
#include "permanent_storage.h"
|
||||
#ifdef DEBUG_LOGIC
|
||||
#include "../hal/usart.h"
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include "../hal/usart.h"
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#endif //DEBUG_LOGIC
|
||||
|
||||
namespace modules {
|
||||
|
|
@ -16,33 +16,33 @@ Selector selector;
|
|||
|
||||
void Selector::PrepareMoveToPlannedSlot() {
|
||||
mm::motion.PlanMoveTo<mm::Selector>(SlotPosition(plannedSlot), mm::unitToAxisUnit<mm::S_speed_t>(config::selectorFeedrate));
|
||||
#ifdef DEBUG_LOGIC
|
||||
char str[30];
|
||||
sprintf_P(str, PSTR("Prepare Move Selector slot %d\n"), plannedSlot);
|
||||
hu::usart1.puts(str);
|
||||
#endif //DEBUG_LOGIC
|
||||
#ifdef DEBUG_LOGIC
|
||||
char str[30];
|
||||
sprintf_P(str, PSTR("Prepare Move Selector slot %d\n"), plannedSlot);
|
||||
hu::usart1.puts(str);
|
||||
#endif //DEBUG_LOGIC
|
||||
}
|
||||
|
||||
void Selector::PlanHomingMove() {
|
||||
mm::motion.PlanMove<mm::Selector>(mm::unitToAxisUnit<mm::S_pos_t>(config::selectorLimits.lenght * 2), mm::unitToAxisUnit<mm::S_speed_t>(config::selectorFeedrate));
|
||||
#ifdef DEBUG_LOGIC
|
||||
hu::usart1.puts("Plan Homing Selector\n");
|
||||
#endif //DEBUG_LOGIC
|
||||
#ifdef DEBUG_LOGIC
|
||||
hu::usart1.puts("Plan Homing Selector\n");
|
||||
#endif //DEBUG_LOGIC
|
||||
}
|
||||
|
||||
Selector::OperationResult Selector::MoveToSlot(uint8_t slot) {
|
||||
if (state == Moving) {
|
||||
#ifdef DEBUG_LOGIC
|
||||
hu::usart1.puts("Moving --> Selector refused\n");
|
||||
#endif //DEBUG_LOGIC
|
||||
#ifdef DEBUG_LOGIC
|
||||
hu::usart1.puts("Moving --> Selector refused\n");
|
||||
#endif //DEBUG_LOGIC
|
||||
return OperationResult::Refused;
|
||||
}
|
||||
plannedSlot = slot;
|
||||
|
||||
if (currentSlot == slot) {
|
||||
#ifdef DEBUG_LOGIC
|
||||
hu::usart1.puts("Moving Selector\n");
|
||||
#endif //DEBUG_LOGIC
|
||||
#ifdef DEBUG_LOGIC
|
||||
hu::usart1.puts("Moving Selector\n");
|
||||
#endif //DEBUG_LOGIC
|
||||
return OperationResult::Accepted;
|
||||
}
|
||||
return InitMovement(mm::Selector);
|
||||
|
|
@ -59,27 +59,27 @@ bool Selector::Step() {
|
|||
switch (state) {
|
||||
case Moving:
|
||||
PerformMove(mm::Selector);
|
||||
#ifdef DEBUG_LOGIC
|
||||
//hu::usart1.puts("Moving Selector\n");
|
||||
#endif //DEBUG_LOGIC
|
||||
#ifdef DEBUG_LOGIC
|
||||
//hu::usart1.puts("Moving Selector\n");
|
||||
#endif //DEBUG_LOGIC
|
||||
return false;
|
||||
case Homing:
|
||||
#ifdef DEBUG_LOGIC
|
||||
hu::usart1.puts("Homing Selector\n");
|
||||
#endif //DEBUG_LOGIC
|
||||
#ifdef DEBUG_LOGIC
|
||||
hu::usart1.puts("Homing Selector\n");
|
||||
#endif //DEBUG_LOGIC
|
||||
PerformHome(mm::Selector);
|
||||
return false;
|
||||
case Ready:
|
||||
#ifdef DEBUG_LOGIC
|
||||
//hu::usart1.puts("Selector Ready\n");
|
||||
#endif //DEBUG_LOGIC
|
||||
#ifdef DEBUG_LOGIC
|
||||
//hu::usart1.puts("Selector Ready\n");
|
||||
#endif //DEBUG_LOGIC
|
||||
currentSlot = plannedSlot;
|
||||
mm::motion.Disable(mm::Selector); // turn off selector motor's power every time
|
||||
return true;
|
||||
case Failed:
|
||||
#ifdef DEBUG_LOGIC
|
||||
hu::usart1.puts("Selector Failed\n");
|
||||
#endif //DEBUG_LOGIC
|
||||
#ifdef DEBUG_LOGIC
|
||||
hu::usart1.puts("Selector Failed\n");
|
||||
#endif //DEBUG_LOGIC
|
||||
default:
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -71,11 +71,11 @@ TEST_CASE("feed_to_finda::feed_phase_unlimited", "[feed_to_finda]") {
|
|||
5000));
|
||||
|
||||
// disengaging idler
|
||||
REQUIRE(ff.State() == FeedToFinda::DisengagingIdler);
|
||||
REQUIRE(WhileCondition(
|
||||
ff,
|
||||
[&](int) { return mi::idler.Engaged(); },
|
||||
5000));
|
||||
REQUIRE(ff.State() == FeedToFinda::DisengagingIdler);
|
||||
REQUIRE(WhileCondition(
|
||||
ff,
|
||||
[&](int) { return mi::idler.Engaged(); },
|
||||
5000));
|
||||
|
||||
CHECK(mm::axes[mm::Idler].pos == mi::Idler::SlotPosition(5).v); // @@TODO constants
|
||||
CHECK(mm::axes[mm::Selector].pos == ms::Selector::SlotPosition(0).v);
|
||||
|
|
|
|||
Loading…
Reference in New Issue