Skip to content
Snippets Groups Projects
Commit bdae9449 authored by Thomas Oster's avatar Thomas Oster
Browse files

Merge pull request #26 from quillford/smoothieboard

Marlin driver
parents dd808c8f 4eca1174
No related branches found
No related tags found
No related merge requests found
...@@ -46,7 +46,8 @@ public class LibInfo ...@@ -46,7 +46,8 @@ public class LibInfo
SampleDriver.class, SampleDriver.class,
ExportSVG.class, ExportSVG.class,
GenericGcodeDriver.class, GenericGcodeDriver.class,
SmoothieBoard.class SmoothieBoard.class,
Marlin.class
}; };
} }
} }
/**
* This file is part of LibLaserCut.
* Copyright (C) 2011 - 2014 Thomas Oster <mail@thomas-oster.de>
*
* LibLaserCut is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* LibLaserCut is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with LibLaserCut. If not, see <http://www.gnu.org/licenses/>.
*
**/
package com.t_oster.liblasercut.drivers;
import com.t_oster.liblasercut.drivers.GenericGcodeDriver;
import java.io.IOException;
import java.util.Arrays;
import java.util.LinkedList;
import java.util.List;
/**
* This class implements a driver for the laser cutter fork of Marlin.
*
* @author quillford
*/
public class Marlin extends GenericGcodeDriver {
public Marlin()
{
//set some Marlin specific defaults
setIdentificationLine("start");
setWaitForOKafterEachLine(true);
setBaudRate(115200);
setLineend("CRLF");
setInitDelay(10);
setPreJobGcode(getPreJobGcode()+",G28 XY,M3");
setPostJobGcode(getPostJobGcode()+",G0 X0Y0,M5");
//Marlin has no way to upload over the network so remove the upload url text
setHttpUploadUrl("");
setHost("");
}
@Override
public String getIdentificationLine()
{
return("start");
}
@Override
public String[] getPropertyKeys()
{
List<String> result = new LinkedList<String>();
result.addAll(Arrays.asList(super.getPropertyKeys()));
result.remove(GenericGcodeDriver.SETTING_IDENTIFICATION_STRING);
result.remove(GenericGcodeDriver.SETTING_WAIT_FOR_OK);
result.remove(GenericGcodeDriver.SETTING_BAUDRATE);
result.remove(GenericGcodeDriver.SETTING_LINEEND);
result.remove(GenericGcodeDriver.SETTING_INIT_DELAY);
result.remove(GenericGcodeDriver.SETTING_HTTP_UPLOAD_URL);
result.remove(GenericGcodeDriver.SETTING_HOST);
return result.toArray(new String[0]);
}
/**
* Waits for the Identification line and returns null if it's alright
* Otherwise it returns the wrong line
* @return
* @throws IOException
*/
@Override
protected String waitForIdentificationLine() throws IOException
{
if (getIdentificationLine() != null && getIdentificationLine().length() > 0)
{
String line = waitForLine();
if (line.startsWith(getIdentificationLine()))
{//we received the identification line ("start"), now we have to skip the rest of Marlin's dump
while(!(waitForLine().startsWith("echo:SD")))
{
//do nothing and wait until Marlin has dumped all of the settings
}
return null;
}
}
return null;
}
@Override
public String getModelName()
{
return "Marlin";
}
@Override
public Marlin clone()
{
Marlin clone = new Marlin();
clone.copyProperties(this);
return clone;
}
}
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment