Wait for external signal before executing G-Code command
Hello everyone,
I'm using the Repetier Firmware on an Arduino Due along with the RADDS Board. However, the Arduino only controls an extruder and not the stepper motors for the respective axes or a heated bed. The Arduino receives a binary signal from the outside via a pin.
My goal is to have the extruder execute the next G-code command every time there's a signal change from the outside. Even if it's just a G0 command and it doesn't extrude, it should "execute" the command upon the signal change. While waiting for a new signal, the extruder should maintain temperature and extrusion speed. Ideally the board should not wait for feedback from the extruder (as in the case of the M109 command). It should blindly execute the commands as soon as a signal comes from outside.
Where in the code do I write that a new G-code command should be executed upon a new signal? I've been unsuccessful so far.
Thanks in advance!
Comments
which is the starting function to execute a function regardless from the source. But you must still run periodical actions so maybe better add it e.g. in
where it gets called. Search also other occurences where it gets called.
The G-Code im sending via Repetier Host looks like this:
Currently my CommandLoop ist looking like the code below, i didnt change the commandloop, i just added my parts.
Im sending signals at 10-second intervals to the Arduino, but the Extruder doesnt do anything.
(The Configuration.h and the pins.h are all set up). I also dont get any feedback from the Repetier Host.
void Commands::commandLoop() {
is not necessary.
As a test replace
TriggerState = digitalRead(28);
with
TriggerState = ! TriggerState;
to see if it would still execute. Should apart the fact that you broke sd write. If it now works it is only that line not getting changing signals.
Did you define pin 28 as input pin in setup?
Also note that with this throtteling host/server might create timeouts, also I hope that busy would still get send preventing it.
Yes, ive already definde pin 28 in setup as input.
I've tried a program that counted incoming signals, and everything worked fine there. So, TriggerState = digitalRead(28); is working, but I'll give it a try the way you've written it, just to be sure.
Next up im gonna uncomment all the debugs in Repetier.h and look into the possible debug messages.
If you got any other ideas, why its not working, pls letme know
I suspect something might be wrong with the buffers, but I couldn't find anything. I've also tried increasing the buffer sizes.