From 3b119e80968d9267da4753687a6740d1189daa80 Mon Sep 17 00:00:00 2001 From: Dimitri Sokolyuk Date: Fri, 15 May 2015 14:31:57 +0200 Subject: Reorganize definitions --- cutter.go | 23 ----------------------- main.go | 1 + robo.go | 26 ++++++++++++++++++++++++-- units.go | 2 ++ 4 files changed, 27 insertions(+), 25 deletions(-) diff --git a/cutter.go b/cutter.go index 4abc479..bc78a9c 100644 --- a/cutter.go +++ b/cutter.go @@ -30,8 +30,6 @@ import ( Usable: 4000x5440 pt */ -var A4 = Point{272 * MM, 200 * MM} // Portrait - type Cutter struct { *bufio.ReadWriter } @@ -159,20 +157,6 @@ func (c Cutter) MoveRelative(p Point) { c.Send("O", p) } -type LineStyle int - -const ( - Solid LineStyle = iota - Dots - ShortDash - Dash - LongDash - DashDot - DashLongDot - DashDoubleDot - DashLongDoubleDot -) - const ( Custom1 LineStyle = iota + 100 // 2 args ? --a-- b --a-- Custom2 // 3 args ? --a-- b -c- b -c- b --a-- @@ -355,13 +339,6 @@ func (c Cutter) Wait() { } } -type Orientation int - -const ( - Portrait Orientation = iota - Landscape -) - func (c Cutter) Orientation(l Orientation) { c.Send("FN", l) } diff --git a/main.go b/main.go index 5400e33..a4769c7 100644 --- a/main.go +++ b/main.go @@ -49,6 +49,7 @@ func main() { //c.MustMarks(Point{18 * CM, 19 * CM}, Type2) Initialize(handle, 113, Portrait) + A4.UpperRight(handle.Writer) PrintStdin(handle.Writer) //DrawPic(handle.Writer) } diff --git a/robo.go b/robo.go index bd96931..825ab8e 100644 --- a/robo.go +++ b/robo.go @@ -127,9 +127,31 @@ func UpperRight(c *bufio.ReadWriter) Point { return point(c, "U") } func StatusWord(c *bufio.ReadWriter) Point { return point(c, "@") } func DistanceCorrection(c *bufio.ReadWriter) Point { return point(c, "FA") } +type Orientation int + +const ( + Portrait Orientation = iota + Landscape +) + func (o Orientation) Orientation(c *bufio.Writer) { send(c, "FN", o) } -func (l LineStyle) LineStyle(c *bufio.Writer) { send(c, "L", l) } -func (p Point) LineStyle(c *bufio.Writer) { p.send(c, "L100,1,") } + +type LineStyle int + +const ( + Solid LineStyle = iota + Dots + ShortDash + Dash + LongDash + DashDot + DashLongDot + DashDoubleDot + DashLongDoubleDot +) + +func (l LineStyle) LineStyle(c *bufio.Writer) { send(c, "L", l) } +func (p Point) LineStyle(c *bufio.Writer) { p.send(c, "L100,1,") } func triple(c *bufio.ReadWriter, cmd string) Triple { send(c.Writer, cmd) diff --git a/units.go b/units.go index 7e3d12e..b82e34b 100644 --- a/units.go +++ b/units.go @@ -11,6 +11,8 @@ const ( PT = IN / 72 ) +var A4 = Point{272 * MM, 200 * MM} + type Unit float64 func (u Unit) String() string { -- cgit v1.2.3