/***************************************************************************
 * Name:      PlottWareFirmware.ino
 * Purpose:   Source and project for the Arduino firmware
 * Author:    Fandly Gergo (fandlygergo@gmail.hu)
 * Created:   2017-12-07
 * Copyright: Copyright (C) 2017 Fandly Gergo (systemtest.tk)
 * License: 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program 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 General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <https://www.gnu.org/licenses/>.
 **************************************************************************/

#include <Arduino.h>

#include <String.h>
#include <Stepper.h>

#include "config.h"
#include "globals.h"
#include "motors.h"
#include "gcodeutils.h"

void setup(){
	Serial.begin(9600);
	motorSetup();
	penSetup();
	penPinsSetup();
    if(XHOME){
        pinMode(XHOME_PIN, INPUT);
    }
    if(YHOME){
        pinMode(YHOME_PIN, INPUT);
    }
}

void loop(){
    if(Serial.available()){
        String code=Serial.readString();
        parseGcode(code);
    }
}
