Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: Hotend Shutdown/Restart While Waiting for Filament Change #5675

Closed
GadgetNutt opened this issue Jan 11, 2017 · 128 comments
Closed

Feature: Hotend Shutdown/Restart While Waiting for Filament Change #5675

GadgetNutt opened this issue Jan 11, 2017 · 128 comments
Labels

Comments

@GadgetNutt
Copy link
Contributor

GadgetNutt commented Jan 11, 2017

Title kind of says it all. On a long print, the printer may come to a filament change point in code and need to wait some time before the user comes along to change the filament. There's no point in the hotend staying on for hours until one comes along to change the filament. In the m600 code, perhaps there could be code to shut down the hotend in when #defined HOTEND_OFF_DURING_FILAMENT_CHANGE.

@ghost
Copy link

ghost commented Jan 11, 2017

Ooooh... That would be nice.

@Roxy-3D
Copy link
Member

Roxy-3D commented Jan 11, 2017

That would be almost trivial to add. Maybe a 5 minute default until the nozzle is turned off?

@ghost
Copy link

ghost commented Jan 11, 2017

I wouldn't think so. 5 minutes is a long time with no filament movement. I would be more worried about the heat traveling past the heatbreak and causing issues.

@ghost
Copy link

ghost commented Jan 11, 2017

Just the option to use or not use would be nice.

@Roxy-3D
Copy link
Member

Roxy-3D commented Jan 11, 2017

I wouldn't think so. 5 minutes is a long time with no filament movement. I would be more worried about the heat traveling past the heatbreak and causing issues.

Actually.... to your point... It is worse than that. The M600 retracts the filament out of the nozzle so the only filament left is the stuff that is stuck to the inside wall of the nozzle.

I suspect my nozzle would be OK with a 5 minute delay. After all, the nozzle is going to hold temperature at the 'correct' number during that time. But still.... it would be easy to make it user configurable (probably in Configuration_adv.h).

I am out of town without my printer. I have no way to test code right now. But I can take a look at it and see how bad the changes are to do this. If it isn't too complex, I might be able to post the changes for you to try out and verify.

@ghost
Copy link

ghost commented Jan 11, 2017

Ok. I am eagerly waiting. ;)

@Roxy-3D
Copy link
Member

Roxy-3D commented Jan 11, 2017

Turning it off is easy... We just modify this loop to also watch for the default time out for the nozzle:

    while (wait_for_user) {
      #if HAS_BUZZER
        millis_t ms = millis();
        if (ms >= next_buzz) {
          BUZZ(300, 2000);
          next_buzz = ms + 2500; // Beep every 2.5s while waiting
        }
      #endif
      idle(true);
    }

But then... If the nozzle has been turned off, we will need to add a loop (much like UBL's G26 nozzle and bed preheat) to get it back up to temperature prior to continuing. This is the UBL code to get the bed and nozzle up to temperature. Obviously, the bed code can be removed. And probably the messages and confirmation should be changed.

bool turn_on_heaters() {
#if HAS_TEMP_BED
  #if ENABLED(ULTRA_LCD)
    if ( bed_temp > 25 ) {
      lcd_setstatus( "G26 Heating Bed.  ", true);
      lcd_quick_feedback();
  #endif
      UBL_has_control_of_LCD_Panel++;
      thermalManager.setTargetBed( bed_temp );
      while( abs(thermalManager.degBed()-bed_temp) > 3 ) {
  	if ( G29_lcd_clicked() ) {
		strcpy( lcd_status_message, "Leaving G26    "); // We can't do lcd_setstatus() without having it continue;
  		while ( G29_lcd_clicked() )			// Debounce the switch
			idle();
            	lcd_setstatus( "Leaving G26     ", true);	// Now we do it right.
		return 1;
	}
	idle();
      }
  #if ENABLED(ULTRA_LCD)
    }
    lcd_setstatus( "G26 Heating Nozzle. ", true);
    lcd_quick_feedback();
  #endif
#endif
 
//
// Now turn on the hotend (nozzle) and wait for it to come up to 
// temperature.

  thermalManager.setTargetHotend( hotend_temp , 0 );
  while( abs(thermalManager.degHotend(0)-hotend_temp) > 3 ) {
  	if ( G29_lcd_clicked() ) {
		strcpy( lcd_status_message, "Leaving G26    "); // We can't do lcd_setstatus() without having it continue;
  		while ( G29_lcd_clicked() )			// Debounce the switch
			idle();
            	lcd_setstatus( "Leaving G26     ", true);	// Now we do it right.
		return 1;
	}
	idle();
  }

#if ENABLED(ULTRA_LCD)
  lcd_setstatus( "                  ", true);
  lcd_quick_feedback();
#endif
  return 0;
}

I'll get things sorted out over the next few days and make one small code block you can surgically insert into M600. It should be just a cut and paste to try it out when I get the first pass of it done.

@GadgetNutt
Copy link
Contributor Author

Great! Thank you.

@Roxy-3D
Copy link
Member

Roxy-3D commented Jan 19, 2017

OK! I have the first pass done. I'm sorry it took so long. I'm skiing and by the end of the day I'm so tired I can barely layout my cloths for the next day. Right now I have the nozzle time out set for 5 minutes (in Configuration_adv.h) You can change that to 10 seconds to verify correct operation if you don't want to wait that long.

It is very likely it won't work the first time. But it should be close. If you tell me how it fails, we can probably get it working pretty quickly. You can download the code at: https://github.com/Roxy-3D/Marlin/tree/RCBugFix

This addition is based off of RCBugFix (as of today).

@GadgetNutt
Copy link
Contributor Author

Very much appreciated. I'll give it a try and let you know. Thank you!

@GadgetNutt
Copy link
Contributor Author

Ok, this is what we have so far. It turns off the heaters after the timeout. It would be nice if it showed the temperature during this process. However, when I click to reheat, the machine just shuts down within seconds.

@Roxy-3D
Copy link
Member

Roxy-3D commented Jan 20, 2017

However, when I click to reheat, the machine just shuts down within seconds.

Yes... I realized this morning I was missing a call to idle(); in the warm up loop. I didn't have any way to get to a computer and fix that until just now. Without the call to idle(); the watchdog timers will trigger and shut down the machine.

I believe it should be showing the temperature during both the wait (and cool down) as well as the re-heat period. I have the idle() call inserted. If you can give it another try... It might just work for you now.

@Tannoo Are you following this thread still? It might be ready for you to jump in and test it.

@ghost
Copy link

ghost commented Jan 20, 2017

Yes I am. And I will.

@GadgetNutt
Copy link
Contributor Author

I'm using the RepRapDiscountSmartGraphicsController. When M600 is sent, the whole screen goes to the changing filament message. It doesn't show any stats on the heaters or position or anything else during that time.

I'll add the idle() call and try again.

@Roxy-3D
Copy link
Member

Roxy-3D commented Jan 20, 2017

When M600 is sent, the whole screen goes to the changing filament message. It doesn't show any stats on the heaters or position or anything else during that time.

Oh! I understand what you are saying... I added a couple of messages:

      lcd_filament_change_show_message(FILAMENT_CHANGE_MESSAGE_CLICK_TO_HEAT_NOZZLE);
      lcd_filament_change_show_message(FILAMENT_CHANGE_MESSAGE_WAIT_FOR_NOZZLES_TO_HEAT);

I think what you are saying is the Filament Change code takes over the entire LCD Panel and right now we are losing the temperature and position numbers. It is only being used to display simple instructions to the user and not display the machine's status. When I get home and can look at things on a live printer, I suspect we can easily get those numbers back on the display. But I wouldn't dare try to do that without having a printer to look at.

Please see if the new messages make sense and accurately reflect the state of the machine.

@ghost
Copy link

ghost commented Jan 20, 2017

Hopefully we don't loose the stepper positioning during this event. Meaning that I hope the steppers don't timeout.

@Roxy-3D
Copy link
Member

Roxy-3D commented Jan 20, 2017

In Configuration_adv.h you can set the default stepper deactivation time. You may want to bump it up.

#define DEFAULT_STEPPER_DEACTIVE_TIME 120

But... I wonder if the M600 filament change command should over ride this. If we are waiting for the user to do a filament change, should we keep the steppers locked in position? It would seem to me that would make sense.

Does anybody have any strong feelings on this thought?

@ghost
Copy link

ghost commented Jan 20, 2017

I have a stronger feeling of where to put tmps as:

thermalManager.setTargetHotend( tmps[iii] , iii );

tmps was not declared in this scope.

@GadgetNutt
Copy link
Contributor Author

@Tannoo It's supposed to be "temps"

@ghost
Copy link

ghost commented Jan 20, 2017

ok...Roxy must have been typing too fast. lol

@GadgetNutt
Copy link
Contributor Author

GadgetNutt commented Jan 20, 2017

Also Tannoo, don't forget to enable:

#define FILAMENT_CHANGE_FEATURE // Enable filament exchange menu and M600 g-code (used for runout sensor too)

in configuration_adv.h

@GadgetNutt
Copy link
Contributor Author

Well, seems to work now. I haven't used it mid print yet, but so far so good. Looking forward to display data during the filament change.

@Roxy-3D
Copy link
Member

Roxy-3D commented Jan 20, 2017

But... I wonder if the M600 filament change command should over ride this. If we are waiting for the user to do a filament change, should we keep the steppers locked in position? It would seem to me that would make sense.

You said that already.... :)

I've got a super bad internet connection. I apologize for the double post! (but I deleted it!)

I'm kind of soliciting feedback about how badly people will react if

#define DEFAULT_STEPPER_DEACTIVE_TIME 120

doesn't always do what it is specified as. If we over ride this timeout, we aren't doing what we say we will do. But to your point.... I don't think it makes sense to lose position just because the user takes 10 minutes to change the filament.

If somebody has a strong feeling about this, PLEASE SPEAK UP NOW! Please explain why it gives you heartburn!

Maybe the 'Right' way to handle this is to add one more #define in the Filament Change configuration area that says:

#define STEPPER_MOTORS_DONT_TIMEOUT_DURING_FILAMENT_CHANGE

@GadgetNutt
Copy link
Contributor Author

GadgetNutt commented Jan 20, 2017

I would strongly say yes, lock the steppers while the filament change is occuring. My client can go for very prolonged periods (hours up to a day maybe) before getting to change the filament. It would be very bad if the position changed because the motors were no longer locked.

@ghost
Copy link

ghost commented Jan 20, 2017

A little humor never hurts anything. :P

@GadgetNutt
Copy link
Contributor Author

GadgetNutt commented Jan 20, 2017

Very true. Some of us aren't as good at humor as others...(like me)

@Roxy-3D
Copy link
Member

Roxy-3D commented Jan 20, 2017

A little humor never hurts anything. :P

Agreed...

I'll start looking at how complicated it will be to add the control:

#define STEPPER_MOTORS_DONT_TIMEOUT_DURING_FILAMENT_CHANGE

That's not a joke!

@ghost
Copy link

ghost commented Jan 20, 2017

I sent M18 S1000 at the start of the print.
I went to watch some other programming on a TV.
I sent M600 near the end of the print.
I went to finish watching the programming I started earlier while listening to an annoying beep. :P
I came back (6 mins?) to check the nozzle temp by a piece of filament first...it was cold (so was the nozzle).
Steppers were still active.
Changed the filament and clicked the screen.
Waited and it started extruding and display was just as this was not an issue.
So...it works for me also. It works flawless.

Adding the hotend temp on the filament change screen would be a good thing.

Plus:

  • I didn't see the message Wait for filament unload.
  • I did see the message Click to heat nozzle. I changed that to say Click to heat nozzle(s).
  • I did see the message Wait to heat nozzle. I changed to say Heating nozzle(s)....

Should it say to Insert filament and press button to continue.?
I ask that because there is no pause after the hotend gets to temp and filament purge begins.
It's fine, just a different message would do.

@Roxy-3D
Copy link
Member

Roxy-3D commented Jan 20, 2017

I'm not sure it is valid to change multiple nozzle filaments with a single M600. The reason is it is very typical to lower the temperature of all nozzles that are not the active tool at the moment. I'm not sure the lower temperature is appropriate for retracting and removing the filament and it probably is not suitable for starting the new filament.

I didn't see the message that it was unloading any nozzle.

   stepper.synchronize();
    lcd_filament_change_show_message(FILAMENT_CHANGE_MESSAGE_UNLOAD);

    // Unload filament
  ...
    // Synchronize steppers and then disable extruders steppers for manual filament changing
    stepper.synchronize();
    disable_e0();
    disable_e1();
    disable_e2();
    disable_e3();
    delay(100);
...
    // Wait for filament insert by user and press button
    lcd_filament_change_show_message(FILAMENT_CHANGE_MESSAGE_INSERT);

The retraction is very short in time. Are you sure you didn't just miss it? But I wonder if we need an idle(); call right after the

    lcd_filament_change_show_message(FILAMENT_CHANGE_MESSAGE_UNLOAD);

to get it up onto the display before it gets over written by the next lcd_filament_change_show_message() call ???? Can you try adding an idle(); right after that and see if that forces the message to be displayed? If so, I'll update the fork with that at the same time I add the

#define STEPPER_MOTORS_DONT_TIMEOUT_DURING_FILAMENT_CHANGE

@ghost
Copy link

ghost commented Jan 20, 2017

stepper.synchronize();
lcd_filament_change_show_message(FILAMENT_CHANGE_MESSAGE_UNLOAD);

// Unload filament
if (code_seen('L')) destination[E_AXIS] += code_value_axis_units(E_AXIS);
#if defined(FILAMENT_CHANGE_UNLOAD_LENGTH) && FILAMENT_CHANGE_UNLOAD_LENGTH > 0
  else destination[E_AXIS] -= FILAMENT_CHANGE_UNLOAD_LENGTH;
#endif

RUNPLAN(FILAMENT_CHANGE_UNLOAD_FEEDRATE);

// Synchronize steppers and then disable extruders steppers for manual filament changing
stepper.synchronize();
disable_e0();
disable_e1();
disable_e2();
disable_e3();
delay(100);

I can see it being really quick if the FILAMENT_CHANGE_UNLOAD_LENGTH is really short. It is set to 100.
When I used filament change in RCBugFix, it took about 10 secs or so to unload.

Dunno what happened to this one yet. BTW, I have removed the (s)'s.

@Roxy-3D
Copy link
Member

Roxy-3D commented Jan 25, 2017

Ok, major issue. If you click to continue (before the nozzle timeout happens), the screen changes to the heatup screen and stays there. I have to kill the printer.

OK! I'll look at that tomorrow. That probably won't be hard to get cleaned up.

@Roxy-3D
Copy link
Member

Roxy-3D commented Jan 26, 2017

@Tannoo I didn't check to see if it compiles clean. (It should) But it should behave correctly in all cases now.

@ghost
Copy link

ghost commented Jan 26, 2017

I was about to try to create a PR on your branch....I had just gotten it to work by adding just 2 lines:

    // Wait for filament insert by user and press button
    lcd_filament_change_show_message(FILAMENT_CHANGE_MESSAGE_INSERT);
    for( iii=0; iii<HOTENDS; iii++)        // Store current temps
      temps[iii] = thermalManager.target_temperature[iii];

That would be the for loop that I added here. I also tested it working just fine now.

@ghost
Copy link

ghost commented Jan 26, 2017

That is because I found out that the temp was empty when the timeout did not expire. So this was to give temp a current value from the get-go.

@Roxy-3D
Copy link
Member

Roxy-3D commented Jan 26, 2017

Yeah... There are a couple of solutions. The problem is, if the nozzle doesn't time out... The temps are never remembered. So in the case where the user terminates the loop early... It wants to wait for the nozzle to be at some random temperatures.

In my fix, I just move the part that stores the current nozzle temperatures (before setting them at 0.0) up outside the loop so we always know what the temps should be.

@ghost
Copy link

ghost commented Jan 26, 2017

ok. I will try it.

@ghost
Copy link

ghost commented Jan 26, 2017

Compiles fine.
Works perfect in and out of timeout.
Thank you! and GOOD JOB for not having a printer to test it on!
You are gooooood.

@Roxy-3D
Copy link
Member

Roxy-3D commented Jan 27, 2017

Now the big question: I'm going to put this into the UBL code base. But that is a development branch. New features are welcome in development branches. The question I have is if these new features should go into a 'Release Candidate'. Opinions from the users are very welcome.

@ghost
Copy link

ghost commented Jan 27, 2017

I say go for it.

@ghost
Copy link

ghost commented Jan 27, 2017

Release candidates are mostly bug free.

@Roxy-3D
Copy link
Member

Roxy-3D commented Jan 27, 2017

The issue is... If we keep adding new options and features, the code base never stabilizes. I feel pretty confident about these changes. But it really does set a bad example.

@GadgetNutt
Copy link
Contributor Author

GadgetNutt commented Jan 27, 2017

  1. I agree it sets a bad example.
  2. This is a relatively minor change. It's not like its changing a major functionality of the program. AND it's something for safety and it should have been included with the filament change feature in the first place. I'd consider that the filament change feature was buggy without it (and in fact it was as the ENTIRE reason I suggested it is because eventually the hotend turns off anyway without these changes, like many hours, causing additional issues trying to get it to turn on again).

Further to qualify "the ENTIRE reason I suggested it", my client originally contacted me about the issue with the hotend turning off during the filament change longterm wait and it was a solution we came up with together.

@Roxy-3D
Copy link
Member

Roxy-3D commented Jan 27, 2017

I think I agree. This actually is a safety item (at least to help protect the printer) and in hindsight it really is necessary for the function to work correctly.

I feel better about merging it!

@thinkyhead
Copy link
Member

thinkyhead commented Feb 15, 2017

Do you think it also makes sense for the print job timer to pause itself during M600?

…adding that.

@thinkyhead
Copy link
Member

thinkyhead commented Feb 15, 2017

Another thing that may happen if the machine is left sitting too long inside M600 is that the steppers will be powered on the whole time. When steppers are sitting still but being held by powered drivers, this uses the most power and generates the most heat. It's not too good for the drivers or the steppers. Perhaps it would be prudent to allow the steppers to disable under the same circumstances that the heaters are disabled, even though this may cause lost steps. (Of course, on a delta this is probably a bad idea.)

@ghost
Copy link

ghost commented Feb 15, 2017

What about double the nozzle shutdown time down to a min of 10mins?

@ghost
Copy link

ghost commented Feb 15, 2017

Maybe a max of an hour?

@ghost
Copy link

ghost commented Feb 15, 2017

Pausing the print job timer, I have no objections to that.

@GadgetNutt
Copy link
Contributor Author

GadgetNutt commented Feb 15, 2017

Pausing print timer sounds good to me.

@thinkyhead
Copy link
Member

Various fixes, print job timer pause, and the problem of the first click being eaten have been fixed, and merged into RCBugFix. Please test the updated M600 when you have a chance.

@Roxy-3D
Copy link
Member

Roxy-3D commented Feb 18, 2017

Various fixes, print job timer pause, and the problem of the first click being eaten have been fixed, and merged into RCBugFix.

What was eating the 'first click' ? I thought it was eating the 'last click' ! That might have been why I was having a hard time finding it.

Please test the updated M600 when you have a chance.

Will do...

@github-actions
Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked and limited conversation to collaborators Mar 18, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

4 participants