Which limit switch is easy to get at when you are standing over your printer?
Printable View
Y would be.
Here is the video I mentioned before as I just found it again:
https://www.youtube.com/watch?v=sk1aP6MQEhc
Basically he is doing something like this and I am unsure how M600 compares ->
Code:M83 ; turn on relative movement for extruder
G1 E-5.000000 F6000 ; retract filament 5mm
G1 X0.000000 Y0.000000 Z4.000000 F9000 ; home X and Y axis leave Z at current height
M84 E ; release extruder stepper motor from 'holding' position
@pause ; pause print!
G1 X0.000000 Y0.000000 F9000 ; upon resume, rehome X/Y in case position was bumped out
G1 X69.080000 Y58.560000 F9000 ; move back to next layer starting position
G1 E0 F6000 ; reset extruder, ready to push out plastic again
G1 F9000
M82 ; set extruder movement back to absolute ready for next layer
One bad thing about what he is doing is he is turning all the motors off. It is very difficult not to move the X & Y when you do this as you are feeding new filament into the extruder. The M600 selectively turns off only the Extruder's motor.
We can leverage the M119 code to look for the Y Limit switch being pressed. It looks like:
#if defined(Y_MIN_PIN) && Y_MIN_PIN > -1
SERIAL_PROTOCOLPGM(MSG_Y_MIN);
SERIAL_PROTOCOLLN(((READ(Y_MIN_PIN)^Y_MIN_ENDSTOP_ INVERTING)?MSG_ENDSTOP_HIT:MSG_ENDSTOP_OPEN))
#endif
I think if you replace this section of code in your Marlin_main.cpp it will probably work. Probably, you should just add a M600 command to something small you can print and see if it does the right thing. My concern is if your print homes to the max position of the bed we might have to swap the Y_MIN_PIN label with Y_MAX_PIN.
Once you get that change folded into your code and tested, please report back. If everything works as expected, I'm going to change the directions on the M600 Filament Change thread to allow using limit switches as an option.Code:#ifdef FILAMENTCHANGEENABLE
#ifndef ULTIPANEL
bool lcd_clicked()
{
int pin_being_examined;
int ii, iii, jj;
pin_being_examined=Y_MIN_PIN;
pinMode(pin_being_examined, INPUT_PULLUP); // Set it to Input with a pull up if it hasnt
delay(50); // been used since RESET.
iii = digitalRead(pin_being_examined); // Get the current state of pin.
return !iii;
}
void lcd_pressed()
{
while( lcd_clicked() != 0 ) // Wait for the switch to be released
;
delay(50);
while( lcd_clicked() != 1 ) // Wait for the switch to be pressed
;
delay(50);
}
#endif
#endif
Hi Roxy,
I was thinking of doing something along these lines, but using Y_MIN on a switch to detect filament being out, i.e., TRIGGERED if filament present, if OPEN filament is out. Then, when you run out of filament, it executes an M600.
To do this, would you place a check for Y_MIN at the top of the marlin_main.cpp loop, and if OPEN try to jump to the M600 code somehow? Would it be best to remove the M600 code to a routine that could be called by both the trigger and the main case code?
Hi! I got your posts approved!
I believe the main line Marlin code at GitHub has the logic to handle a filament check now. But it might be tied to having an LCD Panel. I don't know. I haven't looked at that. But to your question, Yes, the check would have to be in the main loop somewhere. That is the only higher level piece of code that is always running.
This is a bit of hack... But it is how the LCD Panels do their work. When you see the filament run out, you could use the function:
bool enquecommand(const char *cmd)
in Marlin_main.cpp to put a M600 into the buffer and then just return back to the main loop. The main loop would think the M600 command was part of the .GCODE file that it was processing. It would blindly do as told and do a filament change.
thanks for approving my posts!
I will look into the enquecommand call, and if you don't mind, I'll report back here on what happens.
Thanks again!
We've been using the "Ziggy" modification (https://docs.google.com/viewer?a=v&p...MzQzNTQyNjJmMA) to enqueue the M600 command when a filament fault is detected with our Tunell Filament Monitor (http://www.toybuilderlabs.com/produc...lament-monitor).
Here's a demo of it working with the Fusion3 F306: https://www.youtube.com/watch?v=6IJ5EZDe62Q