Re-enable filament runout + add debug msgs

Needs a fix on the MMU side (report FeedToBondtech::DisengageIdler)
This commit is contained in:
D.R.racer 2022-06-09 13:49:30 +02:00
parent b6b265e371
commit 1ff7459743
3 changed files with 40 additions and 20 deletions

View File

@ -17,10 +17,12 @@ FSensorBlockRunout::FSensorBlockRunout() {
#if (FILAMENT_SENSOR_TYPE == FSENSOR_PAT9125) #if (FILAMENT_SENSOR_TYPE == FSENSOR_PAT9125)
fsensor.setJamDetectionEnabled(false); //suppress filament jam detection while loading filament. fsensor.setJamDetectionEnabled(false); //suppress filament jam detection while loading filament.
#endif //(FILAMENT_SENSOR_TYPE == FSENSOR_PAT9125) #endif //(FILAMENT_SENSOR_TYPE == FSENSOR_PAT9125)
// SERIAL_ECHOLNPGM("FSBlockRunout");
} }
FSensorBlockRunout::~FSensorBlockRunout() { FSensorBlockRunout::~FSensorBlockRunout() {
fsensor.settings_init(); // restore filament runout state. fsensor.settings_init(); // restore filament runout state.
// SERIAL_ECHOLNPGM("FSUnBlockRunout");
} }
# if FILAMENT_SENSOR_TYPE == FSENSOR_IR # if FILAMENT_SENSOR_TYPE == FSENSOR_IR
@ -113,6 +115,7 @@ void Filament_sensor::triggerFilamentInserted() {
} }
void Filament_sensor::triggerFilamentRemoved() { void Filament_sensor::triggerFilamentRemoved() {
// SERIAL_ECHOLNPGM("triggerFilamentRemoved");
if (runoutEnabled if (runoutEnabled
&& (eFilamentAction == FilamentAction::None) && (eFilamentAction == FilamentAction::None)
&& !saved_printing && !saved_printing
@ -124,7 +127,10 @@ void Filament_sensor::triggerFilamentRemoved() {
|| eeprom_read_byte((uint8_t *)EEPROM_WIZARD_ACTIVE) || eeprom_read_byte((uint8_t *)EEPROM_WIZARD_ACTIVE)
) )
){ ){
// filRunout(); // SERIAL_ECHOPGM("runoutEnabled="); SERIAL_ECHOLN((int)runoutEnabled);
// SERIAL_ECHOPGM("eFilamentAction="); SERIAL_ECHOLN((int)eFilamentAction);
// SERIAL_ECHOPGM("saved_printing="); SERIAL_ECHOLN((int)saved_printing);
filRunout();
} }
} }
@ -140,6 +146,7 @@ void Filament_sensor::filAutoLoad() {
} }
void Filament_sensor::filRunout() { void Filament_sensor::filRunout() {
SERIAL_ECHOLNPGM("filRunout");
runoutEnabled = false; runoutEnabled = false;
autoLoadEnabled = false; autoLoadEnabled = false;
stop_and_save_print_to_ram(0, 0); stop_and_save_print_to_ram(0, 0);

View File

@ -168,8 +168,7 @@ void MMU2::mmu_loop() {
logicStepLastStatus = LogicStep(); // it looks like the mmu_loop doesn't need to be a blocking call logicStepLastStatus = LogicStep(); // it looks like the mmu_loop doesn't need to be a blocking call
if (is_mmu_error_monitor_active) if (is_mmu_error_monitor_active){
{
// Call this every iteration to keep the knob rotation responsive // Call this every iteration to keep the knob rotation responsive
// This includes when mmu_loop is called within manage_response // This includes when mmu_loop is called within manage_response
ReportErrorHook((uint16_t)lastErrorCode); ReportErrorHook((uint16_t)lastErrorCode);
@ -214,7 +213,15 @@ bool MMU2::tool_change(uint8_t index) {
manage_response(false, false); // true, true); manage_response(false, false); // true, true);
// reset current position to whatever the planner thinks it is // reset current position to whatever the planner thinks it is
// SERIAL_ECHOPGM("TC1:p=");
// SERIAL_ECHO(position[E_AXIS]);
// SERIAL_ECHOPGM("TC1:cp=");
// SERIAL_ECHOLN(current_position[E_AXIS]);
plan_set_e_position(current_position[E_AXIS]); plan_set_e_position(current_position[E_AXIS]);
// SERIAL_ECHOPGM("TC2:p=");
// SERIAL_ECHO(position[E_AXIS]);
// SERIAL_ECHOPGM("TC2:cp=");
// SERIAL_ECHOLN(current_position[E_AXIS]);
extruder = index; //filament change is finished extruder = index; //filament change is finished
SetActiveExtruder(0); SetActiveExtruder(0);
@ -355,7 +362,15 @@ bool MMU2::load_filament_to_nozzle(uint8_t index) {
// reset current position to whatever the planner thinks it is // reset current position to whatever the planner thinks it is
st_synchronize(); st_synchronize();
// SERIAL_ECHOPGM("LFTN1:p=");
// SERIAL_ECHO(position[E_AXIS]);
// SERIAL_ECHOPGM("LFTN1:cp=");
// SERIAL_ECHOLN(current_position[E_AXIS]);
plan_set_e_position(current_position[E_AXIS]); plan_set_e_position(current_position[E_AXIS]);
// SERIAL_ECHOPGM("LFTN2:p=");
// SERIAL_ECHO(position[E_AXIS]);
// SERIAL_ECHOPGM("LFTN2:cp=");
// SERIAL_ECHOLN(current_position[E_AXIS]);
// Finish loading to the nozzle with finely tuned steps. // Finish loading to the nozzle with finely tuned steps.
execute_extruder_sequence((const E_Step *)load_to_nozzle_sequence, sizeof(load_to_nozzle_sequence) / sizeof (load_to_nozzle_sequence[0])); execute_extruder_sequence((const E_Step *)load_to_nozzle_sequence, sizeof(load_to_nozzle_sequence) / sizeof (load_to_nozzle_sequence[0]));
@ -372,8 +387,6 @@ bool MMU2::eject_filament(uint8_t index, bool recover) {
if( ! WaitForMMUReady()) if( ! WaitForMMUReady())
return false; return false;
WaitForHotendTargetTempBeep();
ReportingRAII rep(CommandInProgress::EjectFilament); ReportingRAII rep(CommandInProgress::EjectFilament);
current_position[E_AXIS] -= MMU2_FILAMENTCHANGE_EJECT_FEED; current_position[E_AXIS] -= MMU2_FILAMENTCHANGE_EJECT_FEED;
plan_buffer_line_curposXYZE(2500.F / 60.F); plan_buffer_line_curposXYZE(2500.F / 60.F);
@ -595,6 +608,8 @@ void MMU2::execute_extruder_sequence(const E_Step *sequence, uint8_t steps) {
current_position[E_AXIS] += pgm_read_float(&(step->extrude)); current_position[E_AXIS] += pgm_read_float(&(step->extrude));
plan_buffer_line_curposXYZE(pgm_read_float(&(step->feedRate))); plan_buffer_line_curposXYZE(pgm_read_float(&(step->feedRate)));
st_synchronize(); st_synchronize();
// SERIAL_ECHOPGM("EES:");
// SERIAL_ECHOLN(position[E_AXIS]);
step++; step++;
} }
} }
@ -641,12 +656,12 @@ void MMU2::ReportProgress(ProgressCode pc) {
} }
void MMU2::OnMMUProgressMsg(ProgressCode pc){ void MMU2::OnMMUProgressMsg(ProgressCode pc){
if( pc != lastProgressCode){ if (pc != lastProgressCode) {
ReportProgress(pc); ReportProgress(pc);
lastProgressCode = pc; lastProgressCode = pc;
// Act accordingly - one-time handling // Act accordingly - one-time handling
switch(pc){ switch (pc) {
case ProgressCode::FeedingToBondtech: case ProgressCode::FeedingToBondtech:
// prepare for the movement of the E-motor // prepare for the movement of the E-motor
st_synchronize(); st_synchronize();
@ -658,26 +673,27 @@ void MMU2::OnMMUProgressMsg(ProgressCode pc){
} }
} else { } else {
// Act accordingly - every status change (even the same state) // Act accordingly - every status change (even the same state)
switch(pc){ switch (pc) {
case ProgressCode::FeedingToBondtech: case ProgressCode::FeedingToBondtech:
case ProgressCode::FeedingToFSensor: case ProgressCode::FeedingToFSensor:
if ( loadFilamentStarted ) if (loadFilamentStarted) {
{ switch (WhereIsFilament()) {
switch ( WhereIsFilament() )
{
case FilamentState::AT_FSENSOR: case FilamentState::AT_FSENSOR:
// fsensor triggered, finish FeedingToBondtech state // fsensor triggered, finish FeedingToBondtech state
loadFilamentStarted = false; loadFilamentStarted = false;
// After the MMU knows the FSENSOR is triggered it will: // After the MMU knows the FSENSOR is triggered it will:
// 1. Push the filament by additional 30mm (see fsensorToNozzle) // 1. Push the filament by additional 30mm (see fsensorToNozzle)
// 2. Disengage the idler and push another 5mm. // 2. Disengage the idler and push another 5mm.
// SERIAL_ECHOPGM("ATF1=");
// SERIAL_ECHO(current_position[E_AXIS]);
current_position[E_AXIS] += 30.0f + 2.0f; current_position[E_AXIS] += 30.0f + 2.0f;
plan_buffer_line_curposXYZE(MMU2_LOAD_TO_NOZZLE_FEED_RATE); plan_buffer_line_curposXYZE(MMU2_LOAD_TO_NOZZLE_FEED_RATE);
// SERIAL_ECHOPGM("ATF2=");
// SERIAL_ECHOLN(current_position[E_AXIS]);
break; break;
case FilamentState::NOT_PRESENT: case FilamentState::NOT_PRESENT:
// fsensor not triggered, continue moving extruder // fsensor not triggered, continue moving extruder
if(!blocks_queued()) if (!blocks_queued()) { // Only plan a move if there is no move ongoing
{ // Only plan a move if there is no move ongoing
current_position[E_AXIS] += 2.0f; current_position[E_AXIS] += 2.0f;
plan_buffer_line_curposXYZE(MMU2_LOAD_TO_NOZZLE_FEED_RATE); plan_buffer_line_curposXYZE(MMU2_LOAD_TO_NOZZLE_FEED_RATE);
} }

View File

@ -6195,7 +6195,6 @@ void printf_IRSensorAnalogBoardChange(){
static bool lcd_selftest_IRsensor(bool bStandalone) static bool lcd_selftest_IRsensor(bool bStandalone)
{ {
bool ret = false;
FSensorBlockRunout fsBlockRunout; FSensorBlockRunout fsBlockRunout;
IR_sensor_analog::SensorRevision oldSensorRevision = fsensor.getSensorRevision(); IR_sensor_analog::SensorRevision oldSensorRevision = fsensor.getSensorRevision();
IR_sensor_analog::SensorRevision newSensorRevision; IR_sensor_analog::SensorRevision newSensorRevision;
@ -6206,7 +6205,7 @@ static bool lcd_selftest_IRsensor(bool bStandalone)
if(volt_IR_int < fsensor.IRsensor_Hmin_TRESHOLD){ if(volt_IR_int < fsensor.IRsensor_Hmin_TRESHOLD){
if(!bStandalone) if(!bStandalone)
lcd_selftest_error(TestError::FsensorLevel,"HIGH",""); lcd_selftest_error(TestError::FsensorLevel,"HIGH","");
goto exit; return false;
} }
lcd_show_fullscreen_message_and_wait_P(_i("Insert the filament (do not load it) into the extruder and then press the knob."));////MSG_INSERT_FIL c=20 r=6 lcd_show_fullscreen_message_and_wait_P(_i("Insert the filament (do not load it) into the extruder and then press the knob."));////MSG_INSERT_FIL c=20 r=6
volt_IR_int = fsensor.getVoltRaw(); volt_IR_int = fsensor.getVoltRaw();
@ -6214,15 +6213,13 @@ static bool lcd_selftest_IRsensor(bool bStandalone)
if(volt_IR_int > (fsensor.IRsensor_Lmax_TRESHOLD)){ if(volt_IR_int > (fsensor.IRsensor_Lmax_TRESHOLD)){
if(!bStandalone) if(!bStandalone)
lcd_selftest_error(TestError::FsensorLevel,"LOW",""); lcd_selftest_error(TestError::FsensorLevel,"LOW","");
goto exit; return false;
} }
if(newSensorRevision != oldSensorRevision) { if(newSensorRevision != oldSensorRevision) {
fsensor.setSensorRevision(newSensorRevision, true); fsensor.setSensorRevision(newSensorRevision, true);
printf_IRSensorAnalogBoardChange(); printf_IRSensorAnalogBoardChange();
} }
ret = true; return true;
exit:
return ret;
} }
static void lcd_detect_IRsensor(){ static void lcd_detect_IRsensor(){