Refactor after rebase onto main
parent
78af22e6c3
commit
d35bcd258a
|
|
@ -1,10 +1,9 @@
|
|||
#pragma once
|
||||
#include <stdint.h>
|
||||
#include "config/config.h"
|
||||
#include <avr/pgmspace.h>
|
||||
|
||||
/// Enable DEBUG_LOGIC to compile debugging and error messages (beware of code base size ;) ) for the logic layer
|
||||
//#define DEBUG_LOGIC
|
||||
#define DEBUG_LOGIC
|
||||
|
||||
/// Enable DEBUG_LOGIC to compile debugging and error messages (beware of code base size ;) ) for the logic layer
|
||||
//#define DEBUG_MODULES
|
||||
|
|
|
|||
|
|
@ -71,7 +71,7 @@ bool EjectFilament::StepInner() {
|
|||
}
|
||||
break;
|
||||
case ProgressCode::OK:
|
||||
dbg_logic_sprintf_P(PSTR("FilamentLoadState after Eject %d"), mg::globals.FilamentLoaded());
|
||||
dbg_logic_fP(PSTR("FilamentLoadState after Eject %d"), mg::globals.FilamentLoaded());
|
||||
return true;
|
||||
default: // we got into an unhandled state, better report it
|
||||
state = ProgressCode::ERRInternal;
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ bool FeedToBondtech::Step() {
|
|||
case EngagingIdler:
|
||||
if (mi::idler.Engaged()) {
|
||||
dbg_logic_P(PSTR("Feed to Bondtech --> Idler engaged"));
|
||||
dbg_logic_sprintf_P(PSTR("Pulley start steps %u"), mm::motion.CurPosition(mm::Pulley));
|
||||
dbg_logic_fP(PSTR("Pulley start steps %u"), mm::motion.CurPosition(mm::Pulley));
|
||||
state = PushingFilamentToFSensor;
|
||||
mm::motion.InitAxis(mm::Pulley);
|
||||
mm::motion.PlanMove<mm::Pulley>(config::defaultBowdenLength, config::pulleyFeedrate); //@@TODO constants - there was some strange acceleration sequence in the original FW,
|
||||
|
|
@ -56,7 +56,7 @@ bool FeedToBondtech::Step() {
|
|||
case DisengagingIdler:
|
||||
if (!mi::idler.Engaged()) {
|
||||
dbg_logic_P(PSTR("Feed to Bondtech --> Idler disengaged"));
|
||||
dbg_logic_sprintf_P(PSTR("Pulley end steps %u"), mm::motion.CurPosition(mm::Pulley));
|
||||
dbg_logic_fP(PSTR("Pulley end steps %u"), mm::motion.CurPosition(mm::Pulley));
|
||||
state = OK;
|
||||
mm::motion.Disable(mm::Pulley);
|
||||
ml::leds.SetMode(mg::globals.ActiveSlot(), ml::green, ml::on);
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ bool FeedToFinda::Step() {
|
|||
case EngagingIdler:
|
||||
if (mi::idler.Engaged() && ms::selector.Slot() == mg::globals.ActiveSlot()) {
|
||||
dbg_logic_P(PSTR("Feed to Finda --> Idler engaged"));
|
||||
dbg_logic_sprintf_P(PSTR("Pulley start steps %u"), mm::motion.CurPosition(mm::Pulley));
|
||||
dbg_logic_fP(PSTR("Pulley start steps %u"), mm::motion.CurPosition(mm::Pulley));
|
||||
state = PushingFilament;
|
||||
mm::motion.InitAxis(mm::Pulley);
|
||||
if (mg::globals.FilamentLoaded() == mg::FilamentLoadState::NotLoaded) { // feed slowly filament to PTFE
|
||||
|
|
@ -42,7 +42,7 @@ bool FeedToFinda::Step() {
|
|||
// FINDA triggered - that means it works and detected the filament tip
|
||||
mg::globals.SetFilamentLoaded(mg::FilamentLoadState::InSelector);
|
||||
dbg_logic_P(PSTR("Feed to Finda --> Idler disengaged"));
|
||||
dbg_logic_sprintf_P(PSTR("Pulley end steps %u"), mm::motion.CurPosition(mm::Pulley));
|
||||
dbg_logic_fP(PSTR("Pulley end steps %u"), mm::motion.CurPosition(mm::Pulley));
|
||||
state = OK;
|
||||
} else if (mm::motion.QueueEmpty()) { // all moves have been finished and FINDA didn't switch on
|
||||
state = Failed;
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ bool RetractFromFinda::Step() {
|
|||
switch (state) {
|
||||
case EngagingIdler:
|
||||
if (mi::idler.Engaged()) {
|
||||
dbg_logic_sprintf_P(PSTR("Pulley start steps %u"), mm::motion.CurPosition(mm::Pulley));
|
||||
dbg_logic_fP(PSTR("Pulley start steps %u"), mm::motion.CurPosition(mm::Pulley));
|
||||
state = UnloadBackToPTFE;
|
||||
mm::motion.PlanMove<mm::Pulley>(-(config::cuttingEdgeToFindaMidpoint + config::cuttingEdgeRetract), config::pulleyFeedrate);
|
||||
}
|
||||
|
|
@ -30,7 +30,7 @@ bool RetractFromFinda::Step() {
|
|||
if (!mf::finda.Pressed()) { // FINDA switched off correctly while the move was performed
|
||||
state = OK;
|
||||
mg::globals.SetFilamentLoaded(mg::FilamentLoadState::AtPulley);
|
||||
dbg_logic_sprintf_P(PSTR("Pulley end steps %u"), mm::motion.CurPosition(mm::Pulley));
|
||||
dbg_logic_fP(PSTR("Pulley end steps %u"), mm::motion.CurPosition(mm::Pulley));
|
||||
ml::leds.SetMode(mg::globals.ActiveSlot(), ml::green, ml::off);
|
||||
} else { // FINDA didn't switch off
|
||||
state = Failed;
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ Idler idler;
|
|||
|
||||
void Idler::PrepareMoveToPlannedSlot() {
|
||||
mm::motion.PlanMoveTo<mm::Idler>(SlotPosition(plannedSlot), mm::unitToAxisUnit<mm::I_speed_t>(config::idlerFeedrate));
|
||||
dbg_logic_sprintf_P(PSTR("Prepare Move Idler slot %d"), plannedSlot);
|
||||
dbg_logic_fP(PSTR("Prepare Move Idler slot %d"), plannedSlot);
|
||||
}
|
||||
|
||||
void Idler::PlanHomingMove() {
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ void Motion::StallGuardReset(Axis axis) {
|
|||
}
|
||||
|
||||
void Motion::PlanMoveTo(Axis axis, pos_t pos, steps_t feed_rate, steps_t end_rate) {
|
||||
dbg_logic_sprintf_P(PSTR("Move axis %d to %u"), axis, pos);
|
||||
dbg_logic_fP(PSTR("Move axis %d to %u"), axis, pos);
|
||||
|
||||
if (axisData[axis].ctrl.PlanMoveTo(pos, feed_rate, end_rate)) {
|
||||
// move was queued, prepare the axis
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ Selector selector;
|
|||
|
||||
void Selector::PrepareMoveToPlannedSlot() {
|
||||
mm::motion.PlanMoveTo<mm::Selector>(SlotPosition(plannedSlot), mm::unitToAxisUnit<mm::S_speed_t>(config::selectorFeedrate));
|
||||
dbg_logic_sprintf_P(PSTR("Prepare Move Selector slot %d"), plannedSlot);
|
||||
dbg_logic_fP(PSTR("Prepare Move Selector slot %d"), plannedSlot);
|
||||
}
|
||||
|
||||
void Selector::PlanHomingMove() {
|
||||
|
|
|
|||
Loading…
Reference in New Issue