Update debug

pull/126/head
3d-gussner 2021-09-30 18:18:34 +02:00 committed by DRracer
parent d9134b16fc
commit 62116b1283
2 changed files with 14 additions and 3 deletions

View File

@ -22,6 +22,7 @@ bool FeedToBondtech::Step() {
switch (state) { switch (state) {
case EngagingIdler: case EngagingIdler:
if (mi::idler.Engaged()) { 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_sprintf_P(PSTR("Pulley start steps %u"), mm::motion.CurPosition(mm::Pulley));
state = PushingFilament; state = PushingFilament;
mm::motion.InitAxis(mm::Pulley); mm::motion.InitAxis(mm::Pulley);
@ -30,7 +31,7 @@ bool FeedToBondtech::Step() {
} }
return false; return false;
case PushingFilament: case PushingFilament:
dbg_logic_P(PSTR("Feed to Bondtech --> Pushing")); //dbg_logic_P(PSTR("Feed to Bondtech --> Pushing"));
if (mfs::fsensor.Pressed()) { if (mfs::fsensor.Pressed()) {
mm::motion.AbortPlannedMoves(); // stop pushing filament mm::motion.AbortPlannedMoves(); // stop pushing filament
mi::idler.Disengage(); mi::idler.Disengage();
@ -44,8 +45,9 @@ bool FeedToBondtech::Step() {
} }
return false; return false;
case DisengagingIdler: case DisengagingIdler:
dbg_logic_P(PSTR("Feed to Bondtech --> DisengagingIdler"));
if (!mi::idler.Engaged()) { 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));
state = OK; state = OK;
mm::motion.Disable(mm::Pulley); mm::motion.Disable(mm::Pulley);
ml::leds.SetMode(mg::globals.ActiveSlot(), ml::green, ml::on); ml::leds.SetMode(mg::globals.ActiveSlot(), ml::green, ml::on);

View File

@ -7,10 +7,11 @@
#include "../modules/motion.h" #include "../modules/motion.h"
#include "../modules/permanent_storage.h" #include "../modules/permanent_storage.h"
#include "../modules/user_input.h" #include "../modules/user_input.h"
#include "../debug.h"
namespace logic { namespace logic {
void FeedToFinda::Reset(bool feedPhaseLimited) { void FeedToFinda::Reset(bool feedPhaseLimited) {
dbg_logic_P(PSTR("\nFeed to FINDA\n\n"));
state = EngagingIdler; state = EngagingIdler;
this->feedPhaseLimited = feedPhaseLimited; this->feedPhaseLimited = feedPhaseLimited;
ml::leds.SetMode(mg::globals.ActiveSlot(), ml::green, ml::blink0); ml::leds.SetMode(mg::globals.ActiveSlot(), ml::green, ml::blink0);
@ -23,6 +24,8 @@ bool FeedToFinda::Step() {
switch (state) { switch (state) {
case EngagingIdler: case EngagingIdler:
if (mi::idler.Engaged() && ms::selector.Slot() == mg::globals.ActiveSlot()) { 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));
state = PushingFilament; state = PushingFilament;
mm::motion.InitAxis(mm::Pulley); mm::motion.InitAxis(mm::Pulley);
mm::motion.PlanMove<mm::Pulley>(config::feedToFinda, config::pulleyFeedrate); mm::motion.PlanMove<mm::Pulley>(config::feedToFinda, config::pulleyFeedrate);
@ -35,6 +38,8 @@ bool FeedToFinda::Step() {
mm::motion.AbortPlannedMoves(); // stop pushing filament mm::motion.AbortPlannedMoves(); // stop pushing filament
// FINDA triggered - that means it works and detected the filament tip // FINDA triggered - that means it works and detected the filament tip
mg::globals.SetFilamentLoaded(mg::FilamentLoadState::InSelector); 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));
state = OK; state = OK;
} else if (mm::motion.QueueEmpty()) { // all moves have been finished and FINDA didn't switch on } else if (mm::motion.QueueEmpty()) { // all moves have been finished and FINDA didn't switch on
state = Failed; state = Failed;
@ -44,7 +49,11 @@ bool FeedToFinda::Step() {
} }
return false; return false;
case OK: case OK:
dbg_logic_P(PSTR("Feed to FINDA OK"));
return true;
case Failed: case Failed:
dbg_logic_P(PSTR("Feed to FINDA FAILED"));
return true;
default: default:
return true; return true;
} }