Simple filament end sensor

Hi, 
so... I want to make a simple end of filament sensor (something like that: [www.thingiverse.com]), and want to connect it to a max. Z position sensor (because i'm not using it).
I use Rumba mainbord, I know how to make sensor, but... I'm pretty lame at programming.I don't know how to create the code in Repetier Firmware. 
I found a code that works in Marlin, and it's made im the way that when the swith is off it calls the M600 to change the filament command.
here is the code which I found that works in Marlin and I my question is how to do it in Repetier Firmware?
Quote
in pins.h under the board your using add

#define PAUSE_PIN 42 

i used pin 42 just for testing but you can use any you have free.


in Marlin.h find void kill(); and add after it

void pause();

in Marlin_main.cpp find void setup() and after setup_killpin(); add

setup_pausepin();

then find void manage_inactivity() then find 

#if defined(KILL_PIN) &amp;&amp; KILL_PIN &gt; -1<br style="clear: both;">if( 0 == READ(KILL_PIN) )<br style="clear: both;">kill();<br style="clear: both;">#endif

and after it add 

#if defined(PAUSE_PIN) &amp;&amp; PAUSE_PIN &gt; -1<br style="clear: both;">if( 0 == READ(PAUSE_PIN) )<br style="clear: both;">pause();<br style="clear: both;">#endif

finally at the end of the file add the following

void setup_pausepin()<br style="clear: both;">{<br style="clear: both;">#if defined(PAUSE_PIN) &amp;&amp; PAUSE_PIN &gt; -1<br style="clear: both;">pinMode(PAUSE_PIN,INPUT);<br style="clear: both;">WRITE(PAUSE_PIN,HIGH);<br style="clear: both;">#endif<br style="clear: both;">}<br style="clear: both;"><br style="clear: both;">void pause()<br style="clear: both;">{<br style="clear: both;">enquecommand("M600");<br style="clear: both;">enquecommand("G4 P0");<br style="clear: both;">enquecommand("G4 P0");<br style="clear: both;">enquecommand("G4 P0");<br style="clear: both;">}<br style="clear: both;">

This works but you could change the M600 to what ever you want. The G4 P0 does nothing but is there just to fill the buffer otherwise you get the M600 added 4 times in the buffer.

Im sure there is a better way but give it a go


Comments

Sign In or Register to comment.