More improvment and refinement

All features are adressable from the macro language.
Ditto printing should work properly.
Target pisition only calculated by the commands that use them.
Tool changes implemented according to convention.
M300 and M420 support implemented.
master
WHPThomas 2013-04-23 00:22:44 +10:00
parent c891a9aed5
commit aa582b21ce
5 changed files with 457 additions and 342 deletions

717
gpx.c

File diff suppressed because it is too large Load Diff

13
gpx.h
View File

@ -29,16 +29,12 @@
#include <limits.h> #include <limits.h>
#define GPX_VERSION "0.6 (beta)" #define GPX_VERSION "0.7 (beta)"
/* Nonzero to 'simulate' RPM using 5D, zero to disable */ /* Nonzero to 'simulate' RPM using 5D, zero to disable */
#define ENABLE_RPM 1 #define ENABLE_RPM 1
/* Nonzero to enable G146 and G147, zero to disable */
#define EXPERIMENTAL_GCODE 1
#ifdef _WIN32 #ifdef _WIN32
# define EOL "\r\n" # define EOL "\r\n"
#else #else
@ -58,9 +54,7 @@
#define E_IS_SET 0x20 #define E_IS_SET 0x20
#define F_IS_SET 0x40 #define F_IS_SET 0x40
#define L_IS_SET 0x80
#define P_IS_SET 0x100 #define P_IS_SET 0x100
#define Q_IS_SET 0x200
#define R_IS_SET 0x400 #define R_IS_SET 0x400
#define S_IS_SET 0x800 #define S_IS_SET 0x800
@ -102,9 +96,7 @@ typedef struct tCommand {
double e; double e;
double f; double f;
double l;
double p; double p;
double q;
double r; double r;
double s; double s;
@ -173,7 +165,8 @@ typedef struct tTool {
typedef struct tOverride { typedef struct tOverride {
double actual_filament_diameter; double actual_filament_diameter;
double filament_scale; double filament_scale;
unsigned nozzle_temperature; unsigned standby_temperature;
unsigned active_temperature;
unsigned build_platform_temperature; unsigned build_platform_temperature;
} Override; } Override;

29
gpx.ini
View File

@ -4,7 +4,7 @@
; gcode to x3g conversion configuration file ; gcode to x3g conversion configuration file
; ;
; POST PROCESSING OPTIONS ;************ POST PROCESSING OPTIONS ************
[printer] [printer]
@ -35,7 +35,13 @@ ditto_printing=0
build_progress=1 build_progress=1
; RIGHT EXTRUDER ; override the gcode build plate temperature
; 0 = disabled
build_platform_temperature=0
;************ RIGHT EXTRUDER ************
[right] [right]
@ -45,17 +51,17 @@ build_progress=1
actual_filament_diameter=0 actual_filament_diameter=0
; override gcode for the right nozzle temperature ; override gcode for the right active temperature
; 0 = disabled ; 0 = disabled
nozzle_temperature=0 active_temperature=0
; override the gcode build plate temperature ; override gcode for the right standby temperature
; 0 = disabled ; 0 = disabled
build_platform_temperature=0 standby_temperature=0
; LEFT EXTRUDER ;************ LEFT EXTRUDER ************
[left] [left]
@ -65,7 +71,12 @@ build_platform_temperature=0
actual_filament_diameter=0 actual_filament_diameter=0
; override gcode for the right nozzle temperature ; override gcode for the right active temperature
; 0 = disabled ; 0 = disabled
nozzle_temperature=0 active_temperature=0
; override gcode for the right standby temperature
; 0 = disabled
standby_temperature=0

View File

@ -20,6 +20,8 @@
; along with this program; if not, write to the Free Software Foundation, ; along with this program; if not, write to the Free Software Foundation,
; Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ; Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
;@machine r2x
; PREFIX ; PREFIX
(*(* THIS IS A NESTED COMMENT *)*) (*(* THIS IS A NESTED COMMENT *)*)
@ -244,18 +246,14 @@ M131 X Y Z A B
M70 (M132 - load EEPROM) M70 (M132 - load EEPROM)
M132 X Y Z A B M132 X Y Z A B
; M146 - Set RGB LED value
M70 (M146 - set LED)
M146 R255 L0 S0 P0
; M147 - Set Beep
M70 (M147 - set beep)
M147 S4000 P100
; M140 - Set Build Platform Temperature ; M140 - Set Build Platform Temperature
M70 (M140 - hbp temp) M70 (M140 - hbp temp)
M140 T0 S100 M140 T0 S100
; M300 - Set Beep
M70 (M300 - set beep)
M300 S4000 P100
; M320 - Acceleration on for subsequent instructions ; M320 - Acceleration on for subsequent instructions
M70 (M320 - acc on) M70 (M320 - acc on)
M320 M320
@ -268,6 +266,10 @@ M321
M70 (M322 - pause@z) M70 (M322 - pause@z)
M322 Z10 M322 Z10
; M420 - Set RGB LED value
M70 (M420 - set LED)
M420 R255 E0 B0 P0
; T1 - Set Current Tool 1 ; T1 - Set Current Tool 1
M70 (T1 - set tool) M70 (T1 - set tool)
T1 T1

View File

@ -26,7 +26,7 @@ import sys
toolCommandTable = { toolCommandTable = {
1: ("", "[1] init: Initialize firmware to boot state"), 1: ("", "[1] init: Initialize firmware to boot state"),
3: ("<H", "[3] Extruder: set temperature = %i"), 3: ("<H", "[3] set target temperature = %i"),
4: ("<B", "[4] Motor 1: set speed (PWM) = %i"), 4: ("<B", "[4] Motor 1: set speed (PWM) = %i"),
5: ("<B", "[5] Motor 2: set speed (PWM) = %i"), 5: ("<B", "[5] Motor 2: set speed (PWM) = %i"),
6: ("<I", "[6] Motor 1: set speed (RPM) = %i"), 6: ("<I", "[6] Motor 1: set speed (RPM) = %i"),
@ -35,12 +35,12 @@ toolCommandTable = {
9: ("<I", "[9] Motor 2: set direction = %i"), 9: ("<I", "[9] Motor 2: set direction = %i"),
10: ("B", "[10] Motor 1: toggle = %d"), 10: ("B", "[10] Motor 1: toggle = %d"),
11: ("B", "[11] Motor 2: toggle = %d"), 11: ("B", "[11] Motor 2: toggle = %d"),
12: ("B", "[12] Fan: toggle = %d"), 12: ("B", "[12] toggle cooling fan = %d"),
13: ("B", "[13] Valve: toggle = %d"), 13: ("B", "[13] toggle blower fan = %d"),
13: ("B", "[14] Servo 1: angle = %d"), 14: ("B", "[14] Servo 1: angle = %d"),
13: ("B", "[15] Serve 2: angle = %d"), 15: ("B", "[15] Servo 2: angle = %d"),
27: ("B", "[27] Automated build platform: toggle = %d"), 27: ("B", "[27] Automated build platform: toggle = %d"),
31: ("<H", "[31] Build Platform: set temperature = %i"), 31: ("<H", "'[31] set build platform temperature = %i"),
} }
def parseToolAction(): def parseToolAction():
@ -55,7 +55,7 @@ def parseToolAction():
return (index,command,contents) return (index,command,contents)
def printToolAction(tuple): def printToolAction(tuple):
print "\t[136] Tool %i:" % (tuple[0]), print "\t[136] Extruder(%i)" % (tuple[0]),
# command - tuple[1] # command - tuple[1]
# data - tuple[2] # data - tuple[2]
(parse, disp) = toolCommandTable[tuple[1]] (parse, disp) = toolCommandTable[tuple[1]]
@ -121,13 +121,13 @@ commandTable = {
131: ("<BIH","\t[131] Home minimum on %X, feedrate %i, timeout %i s"), 131: ("<BIH","\t[131] Home minimum on %X, feedrate %i, timeout %i s"),
132: ("<BIH","\t[132] Home maximum on %X, feedrate %i, timeout %i s"), 132: ("<BIH","\t[132] Home maximum on %X, feedrate %i, timeout %i s"),
133: ("<I","\t[133] Delay of %i us"), 133: ("<I","\t[133] Delay of %i us"),
134: ("<B","\t[134] Switch to tool %i"), 134: ("<B","\t[134] Change extruder %i"),
135: ("<BHH","\t[135] Wait for tool %i (%i ms between polls, %i s timeout"), 135: ("<BHH","\t[135] Wait until extruder %i ready (%i ms between polls, %i s timeout"),
136: (parseToolAction, printToolAction), 136: (parseToolAction, printToolAction),
137: ("<B", "\t[137] Enable/disable axes %X"), 137: ("<B", "\t[137] Enable/disable steppers %X"),
138: ("<H", "\t[138] User block on ID %i"), 138: ("<H", "\t[138] User block on ID %i"),
139: ("<iiiiiI","\t[139] Absolute move to (%i,%i,%i,%i,%i) at DDA %i"), 139: ("<iiiiiI","\t[139] Absolute move to (%i,%i,%i,%i,%i) at DDA %i"),
140: ("<iiiii","\t[140] Extended Machine position set as (%i,%i,%i,%i,%i)"), 140: ("<iiiii","\t[140] Set extended position as (%i,%i,%i,%i,%i)"),
141: ("<BHH","\t[141] Wait for platform %i (%i ms between polls, %i s timeout)"), 141: ("<BHH","\t[141] Wait for platform %i (%i ms between polls, %i s timeout)"),
142: ("<iiiiiIB","\t[142] Move to (%i,%i,%i,%i,%i) in %i us (relative: %X)"), 142: ("<iiiiiIB","\t[142] Move to (%i,%i,%i,%i,%i) in %i us (relative: %X)"),
143: ("<b","\t[143] Store home position for axes %d"), 143: ("<b","\t[143] Store home position for axes %d"),