From ada146f45cac107928c55780b0adad94d332cdc6 Mon Sep 17 00:00:00 2001 From: Dimitri Sokolyuk Date: Fri, 15 May 2015 02:40:28 +0200 Subject: Add more methods --- cutter.go | 9 +++------ robo.go | 10 ++++++++++ testpattern.go | 6 +++--- 3 files changed, 16 insertions(+), 9 deletions(-) diff --git a/cutter.go b/cutter.go index ff2f0a5..d77a5a2 100644 --- a/cutter.go +++ b/cutter.go @@ -30,10 +30,7 @@ import ( Usable: 4000x5440 pt */ -var ( - A4 = Point{272 * MM, 200 * MM} // Portrait - Origin = Point{0, 0} -) +var A4 = Point{272 * MM, 200 * MM} // Portrait type Cutter struct { *bufio.ReadWriter @@ -178,8 +175,8 @@ const ( const ( Custom1 LineStyle = iota + 100 // 2 args ? --a-- b --a-- - Custom2 // 3 args ? --a-- b -c- b -c- b --a-- - Custom3 // 3 args ? --a-- b -c- b --a-- + Custom2 // 3 args ? --a-- b -c- b -c- b --a-- + Custom3 // 3 args ? --a-- b -c- b --a-- ) func (c Cutter) LineType(n LineStyle) { diff --git a/robo.go b/robo.go index a57807f..b447ba7 100644 --- a/robo.go +++ b/robo.go @@ -108,3 +108,13 @@ func Version(c *bufio.ReadWriter) string { send(c.Writer, "FG") return recv(c.Reader) } + +func GoHome(c *bufio.Writer) { send(c, "TT") } +func Home(c *bufio.Writer) { send(c, "H") } +func Origin(c *bufio.Writer) { send(c, "FJ") } +func Calibrate(c *bufio.Writer) { send(c, "TB70") } + +func Calibration(c *bufio.ReadWriter) Point { + send(c.Writer, "TB71") + return NewPoint(recv(c.Reader)) +} diff --git a/testpattern.go b/testpattern.go index a8aa637..e761fd5 100644 --- a/testpattern.go +++ b/testpattern.go @@ -2,8 +2,8 @@ package main func (c Cutter) TestPattern() { c.Factor(Triple{100, 100, 100}) - c.Offset(Origin) - c.WriteLowerLeft(Origin) + c.Offset(Point{0, 0}) + c.WriteLowerLeft(Point{0, 0}) c.Move(Point{510, 637}) c.Bezier(1, Point{510, 637}, Point{439, 637}, @@ -27,5 +27,5 @@ func (c Cutter) TestPattern() { c.Move(Point{510, 1018}) c.Draw(Point{510, 2}) - c.Move(Origin) + c.Move(Point{0, 0}) } -- cgit v1.2.3