GPX/gpx.h

197 lines
3.8 KiB
C
Raw Normal View History

2013-04-11 05:32:34 +04:00
//
// gpx.c
//
// Created by WHPThomas <me(at)henri(dot)net> on 1/04/13.
2013-04-11 05:32:34 +04:00
//
// Copyright (c) 2013 WHPThomas, All rights reserved.
2013-04-11 05:32:34 +04:00
//
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_h
#define gpx_h
2013-04-11 05:32:34 +04:00
#include <limits.h>
#define GPX_VERSION "1.0 (RC2)"
2013-04-21 21:37:12 +04:00
/* Nonzero to 'simulate' RPM using 5D, zero to disable */
#define ENABLE_RPM 1
/* Nonzero to use M6 for tool changes and M116 to wait for temperature, zero to disable */
//#define M6_TOOL_CHANGE 1
2013-04-21 21:37:12 +04:00
#ifdef _WIN32
# define DELIM '\\'
2013-04-21 21:37:12 +04:00
# define EOL "\r\n"
#else
# define DELIM '/'
2013-04-21 21:37:12 +04:00
# define EOL "\n"
#endif
2013-04-11 05:32:34 +04:00
// 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 P_IS_SET 0x100
2013-04-12 17:47:40 +04:00
#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 p;
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;
double nominal_filament_diameter;
unsigned extruder_count;
2013-04-11 05:32:34 +04:00
unsigned timeout;
} Machine;
typedef struct tTool {
unsigned motor_enabled;
2013-04-21 21:37:12 +04:00
#if ENABLE_RPM
unsigned rpm;
2013-04-21 21:37:12 +04:00
#endif
unsigned nozzle_temperature;
unsigned build_platform_temperature;
} Tool;
typedef struct tOverride {
double actual_filament_diameter;
double filament_scale;
unsigned standby_temperature;
unsigned active_temperature;
unsigned build_platform_temperature;
} Override;
2013-04-21 21:37:12 +04:00
typedef struct tFilament {
char *colour;
double diameter;
unsigned temperature;
unsigned LED;
} Filament;
#define FILAMENT_MAX 32
typedef struct tCommandAt {
2013-04-21 21:37:12 +04:00
double z;
unsigned filament_index;
unsigned temperature;
} CommandAt;
2013-04-21 21:37:12 +04:00
#define COMMAND_AT_MAX 128
2013-04-11 05:32:34 +04:00
#endif