Skip to content
Snippets Groups Projects
SmoothieBoard.java 2.8 KiB
Newer Older
  • Learn to ignore specific revisions
  • Thomas Oster's avatar
    Thomas Oster committed
    /**
     * 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 java.io.IOException;
    
    import java.util.Arrays;
    import java.util.LinkedList;
    import java.util.List;
    
    Thomas Oster's avatar
    Thomas Oster committed
    
    /**
    
     * This class implements a driver for SmoothieBoard.
     * 
     * @author Thomas Oster <mail@thomas-oster.de>
    
    Thomas Oster's avatar
    Thomas Oster committed
     */
    
    public class SmoothieBoard extends GenericGcodeDriver {
    
        //set some smoothie-specific defaults
        setIdentificationLine("Smoothie");
        setWaitForOKafterEachLine(true);
    
        setBaudRate(115200);
        setLineend("CRLF");
    
        setPreJobGcode(getPreJobGcode()+",M3");
        setPostJobGcode(getPostJobGcode()+",M5");
    
      
      @Override
      public String getIdentificationLine()
      {
    
        if (UPLOAD_METHOD_IP.equals(this.uploadMethod))
    
          return "Smoothie command shell";
    
      @Override
      protected String waitForLine() throws IOException
      {
        String line = super.waitForLine();
        //The telnet interface for smoothie prepends lines with '> '
    
        if (UPLOAD_METHOD_IP.equals(this.uploadMethod) && line.startsWith("> "))
    
        {
          return line.substring(2);
        }
        return line;
      }
      
    
    Thomas Oster's avatar
    Thomas Oster committed
      @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_SPINDLE_MAX);
    
        result.remove(GenericGcodeDriver.SETTING_BLANK_LASER_DURING_RAPIDS);
    
        return result.toArray(new String[0]);
    
    Thomas Oster's avatar
    Thomas Oster committed
      @Override
    
      public String getModelName()
    
    Thomas Oster's avatar
    Thomas Oster committed
      }
    
      @Override
    
    Thomas Oster's avatar
    Thomas Oster committed
        SmoothieBoard clone = new SmoothieBoard();
    
        clone.copyProperties(this);
    
    Thomas Oster's avatar
    Thomas Oster committed
        return clone;
      }