mattthebaker / Smoothieware-CHMT

Modular, opensource, high performance G-code interpreter and CNC controller written in Object-Oriented C++

Home Page:http://smoothieware.org/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Drag pin sensor

neliooliveira opened this issue · comments

Just finished converting my CHMT36VA to OpenPnP and noticed that the drag pin sensor is not used by OpenPnP which causes some issues when the head moves and the pin is stuck in the tape.
Is there any solution for this?

Got it working this night. Will submit a PR soon. Stay tuned!

@jlehmke will you submit the PR?

#6 Just submitted. I am really sorry for the delay, I still have a very time consuming project overdue, so this dropped slightly on my priority list.

I had in mind to submit the PR as soon as I have a working ScriptActuator for OpenPNP to wait for the dragpin to retract after pull. This is not yet done. But from the firmware side it works perfectly fine.

This script works well for me:

var pin = machine.getDefaultHead().getActuatorByName("PullNeedle");

if (actuateBoolean) {
        pin.actuate(true);
} else {
        pin.actuate(false);
        while (pin.read() == "1");
}

Could you please provide some informations about the setup-process for the sensor?

Where did you entered the script?
If its a new script: How does it have to be called?

Do I have to setup a "Signaler" to readout the status?

Edit:
I got it.
There has to be a new ScriptActuator "DRAGPIN" (or the same name like the old pin), which has a script like shown by jlehmke. It has to be located in the script-folder. In my case "Dragpin.js".
The old pin has to be called "PullNeedle" and represents the real hardware-pin.
Don't forget to transfer the coordinate system from "PullNeedle" to "DRAGPIN".

"PullNeedle" needs the following configuration in Gcode-Driver:
ACTUATOR_READ_COMMAND: M1000 switch dragpinstate
ACTUATOR_READ_REGEX: ^switch dragpinstate is (?<Value>\d+)

At the while-loop I added some buzzer-sounds to show the issue.
A ReferenceActuator called "BUZZER" needs the following Gcode-Driver:
M82{True:0}{False:1} ; M820/821

Added to the previous script:

var buzzer = machine.getActuatorByName("BUZZER");

[...]

while (pin.read() == "1"){
      buzzer.actuate(true);
      java.lang.Thread.sleep(500);
      buzzer.actuate(false);
      java.lang.Thread.sleep(1000);
}

Congratulation! Yes you're absolutely right, I forgot to mention the ACTUATOR_READ_REGEX command.

Nice use case for the buzzer, by the way. I like it!