GPX/gpx.h

148 lines
2.8 KiB
C
Raw Normal View History

2013-04-11 05:32:34 +04:00
//
// gpx.c
//
// Created by WHPThomas on 1/04/13.
//
// Copyright (c) 2013 WHPThomas.
//
2013-04-12 17:47:40 +04:00
// gpx references ReplicatorG sources from /src/replicatorg/drivers
2013-04-11 05:32:34 +04:00
// which are part of the ReplicatorG project - http://www.replicat.org
// Copyright (c) 2008 Zach Smith
// and Makerbot4GSailfish.java Copyright (C) 2012 Jetty / Dan Newman
//
// 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 2 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, write to the Free Software Foundation,
// Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#ifndef gpx_gpx_h
#define gpx_gpx_h
#include <limits.h>
// x3g axes bitfields
#define X_IS_SET 0x1
#define Y_IS_SET 0x2
#define Z_IS_SET 0x4
#define A_IS_SET 0x8
#define B_IS_SET 0x10
2013-04-12 17:47:40 +04:00
#define XYZ_BIT_MASK 0x7
#define AXES_BIT_MASK 0x1F
2013-04-11 05:32:34 +04:00
#define E_IS_SET 0x20
2013-04-11 05:32:34 +04:00
#define F_IS_SET 0x40
#define L_IS_SET 0x80
#define P_IS_SET 0x100
2013-04-12 17:47:40 +04:00
#define Q_IS_SET 0x200
#define R_IS_SET 0x400
#define S_IS_SET 0x800
2013-04-11 05:32:34 +04:00
// commands
#define G_IS_SET 0x1000
#define M_IS_SET 0x2000
#define T_IS_SET 0x4000
2013-04-12 17:47:40 +04:00
#define COMMENT_IS_SET 0x8000
2013-04-11 05:32:34 +04:00
2013-04-12 17:47:40 +04:00
typedef struct tPoint2d {
double a;
double b;
} Point2d, *Ptr2d;
2013-04-11 05:32:34 +04:00
typedef struct tPoint3d {
double x;
double y;
double z;
} Point3d, *Ptr3d;
typedef struct tPoint5d {
double x;
double y;
double z;
double a;
double b;
} Point5d, *Ptr5d;
typedef struct tCommand {
// parameters
double x;
double y;
double z;
double a;
double b;
double e;
double f;
2013-04-12 17:47:40 +04:00
2013-04-11 05:32:34 +04:00
double l;
double p;
2013-04-12 17:47:40 +04:00
double q;
2013-04-11 05:32:34 +04:00
double r;
double s;
// commands
2013-04-12 17:47:40 +04:00
unsigned g;
unsigned m;
unsigned t;
2013-04-11 05:32:34 +04:00
// comments
char *comment;
// state
2013-04-12 17:47:40 +04:00
int flag;
2013-04-11 05:32:34 +04:00
} Command, *PtrCommand;
// endstop flags
#define ENDSTOP_IS_MIN 0
#define ENDSTOP_IS_MAX 1
2013-04-12 17:47:40 +04:00
// tool id
#define MAX_TOOL_ID 1
#define BUILD_PLATE_ID 2
// state
#define READY_STATE 0
#define RUNNING_STATE 1
#define ENDED_STATE 2
2013-04-11 05:32:34 +04:00
typedef struct tAxis {
double max_feedrate;
double home_feedrate;
double steps_per_mm;
unsigned endstop;
} Axis;
typedef struct tExtruder {
double max_feedrate;
double steps_per_mm;
double motor_steps;
2013-04-12 17:47:40 +04:00
unsigned has_heated_build_platform;
2013-04-11 05:32:34 +04:00
} Extruder;
typedef struct tMachine {
Axis x;
Axis y;
Axis z;
Extruder a;
Extruder b;
unsigned extruder_count;
2013-04-11 05:32:34 +04:00
unsigned timeout;
} Machine;
#endif