TurnkeyTyranny / buildlog-lasercutter-marlin

Marlin firmware modified and configured for LMN's buildlog.net inspired lasercutter
53 stars 33 forks source link

Create a VisiCut driver #1

Open t-oster opened 8 years ago

t-oster commented 8 years ago

Hi, I am the author of VisiCut. It looks like we are doing a lot of duplicate work. Would you consider writing a VisiCut driver for Marlin? Please have a look at my Grbl and Smoothieboard drivers (https://github.com/t-oster/LibLaserCut/pull/23), which should give you an impression on how easy it is to write a driver and probably you can just extend my generic gcode driver class to make a dedicated marlin driver.

I don't have a marlin compatible lasercutter and no time, but I am willing to assist if you have problems/questions.

adeebshihadeh commented 8 years ago

I have started to write one but ran into an issue. Once you open a connection to Marlin, it dumps your settings from the EEPROM which makes it hard to have a hardcoded identification line. How would this be handled?

adeebshihadeh commented 8 years ago

The error I am specifically getting is "Exception: Lasercutter did not respond 'ok', but 'echo: External Power Reset'instead".

adeebshihadeh commented 8 years ago

I have 'start' as the identification string, but Marlin dumps all of the following on connect.

start
echo: External Reset
Marlin 1.0.0
echo: Last Updated: Aug  3 2015 10:55:23 | Author: (none, default config)
Compiled: Aug  3 2015
echo: Free Memory: 2309  PlannerBufferBytes: 2576
echo:Hardcoded Default Settings Loaded
echo:Steps per unit:
echo:  M92 X157.48 Y157.48 Z6047.24 E0.00
echo:Maximum feedrates (mm/s):
echo:  M203 X3000.00 Y3000.00 Z10.00 E25.00
echo:Maximum Acceleration (mm/s2):
echo:  M201 X2600 Y2600 Z2 E2
echo:Acceleration: S=acceleration, T=retract acceleration
echo:  M204 S2000.00 T2000.00
echo:Advanced variables: S=Min feedrate (mm/s), T=Min travel feedrate (mm/s), B=minimum segment time (ms), X=maximum XY jerk (mm/s),  Z=maximum Z jerk (mm/s),  E=maximum E jerk (mm/s)
echo:  M205 S0.00 T0.00 B20000 X20.00 Z0.40 E5.00
echo:Home offset (mm):
echo:  M206 X0.00 Y0.00 Z0.00
echo:Laser lifetime usage:
echo: Hours: 0
 Minutes: 0
echo:PID settings:
echo:   M301 P22.20 I1.08 D114.00
echo:SD init fail
t-oster commented 8 years ago

Hi, so you are extending the GenericGcodeDriver? Then you have many possiblities:

Does the mariln output "OK" after each Gcode command? Maybe you can share your work-in-progress in a separate branch, so I can help reviewing the code. I think overriding the waitForIdentificationLine is the best idea, because it also allows for your settings to be read by visicut which could be useful later

adeebshihadeh commented 8 years ago

I am using the GenericGcodeDriver. I am not familiar with using forks with git submodules, so I have posted the driver here. Marlin does output OK after each command.

t-oster commented 8 years ago

LibLaserCut has it's own repository, so you can just clone this on github, create put your code in the "smoothieboard" branch and create a pull request to mine. But anyhow, I commented your gist, so you can also fiddle around with that. I will have more time to assist in 1-2-weeks since i am quite busy atm.

adeebshihadeh commented 8 years ago

@t-oster I've got it somewhat working in a not so reliable state. Most of the time when I try to connect, it says the port is in use when nothing open would be using it (other programs that can interface with marlin have no trouble with the same programs open).

t-oster commented 8 years ago

Hi. Maybe you did not close the port properly before? This happens when VisiCut crashes with an exception. How does it work if you always try to close the port before opening: https://github.com/t-oster/LibLaserCut/pull/24

adeebshihadeh commented 8 years ago

Thanks for the suggestion! I was able to close the serial port by opening an app to connect to serial interfaces and connecting then disconnecting. However I ran into a new issue. It says the job was sent and that I should press start... where was it send and where do I press start? RAMPS has no built in storage.

t-oster commented 8 years ago

This ist just a message you can configure when adding the lasercutter in visicut. It was intended for the epilog zing, which has a start-button. It was sent wherever the driver sent it, so hopefully via serial port to your device. My suggestion was to programmatically close the port before opening like in the linked commit: https://github.com/Tamagotono/LibLaserCut/commit/588eec07e6c01acf5b1b209fe5b3408c86939402

adeebshihadeh commented 8 years ago

I got it connected and I'm now getting "Exception: Underlying input stream returned zero bytes". This is what is sent. It seems like it is giving the controller no time to respond because it just stops. It is always after 21 commands.

Edit: wrong number of commands. I only measured the move commands at first.