I am using repetier as firmware for a plotter.
I get the data for it in HPGL und convert them external to GCode.
It would be easier if I can use HPGL directly for the plotter.
The idea is to store a HPGL-file on the SD-Card und start with that file.
And interprete the HPGL-File in repetier.
That is the content of the HPGL-File:
IN;PU23911,33896;PD23893,33876;PD23873,33871;PD23851,33878;PD23828,33892;PD2378.....
the conversion is simple:
IN -> (start no importance)
PU23911,33896 -> (Pen Up) convert to:
M3
G1 X597.77 Y847.4 (the position is devided by 40)
M5
PD23893,33876 -> (Pen Down) convert to:
G1 X597.32 Y846,9 (values diveded by 40)
Only those 2 commands are of importance PU,PD.
What is the best way to do this?
I see 2 problems:
1) the content is in one line. so the ";" is the separator instead LF and CR.
even worse the ; is the comment-line sign in Gcode!
I am not clear where is the right point in the code...
in gcode.cpp line 442 #if SDSUPPORT sounds promising.
in line 515 if(ch == ';') commentDetected = true; // ignore new data until line end
That covers the ;comments in gcode - which is the HPGL command separator ...
2) is it better to convert PD/PU commands in G1 commands directly after reading it or is it easier
to add PU/PD to the command list??
in gcode.cpp line 496 and following pushCommand(); is this the command to start the print-commands?
Any help is very welcome! thanks