From 0d0c55fafb5442f0ba11055b13fa54c983bd4a4c Mon Sep 17 00:00:00 2001 From: Dimitri Sokolyuk Date: Sat, 16 May 2015 14:24:59 +0200 Subject: Add Step --- cutter.go | 10 ---------- robo.go | 19 +++++++++++++++++++ 2 files changed, 19 insertions(+), 10 deletions(-) diff --git a/cutter.go b/cutter.go index f35f400..cff16c7 100644 --- a/cutter.go +++ b/cutter.go @@ -78,16 +78,6 @@ func (c Cutter) Send(a ...interface{}) { c.EOT() } -type StepDirection byte - -const ( - StepStop StepDirection = 1 << iota >> 1 - StepDown - StepUp - StepRight - StepLeft -) - func (c Cutter) Esc(bytes ...byte) { c.WriteByte(ESC) for _, b := range bytes { diff --git a/robo.go b/robo.go index d2ca8a7..b1264ae 100644 --- a/robo.go +++ b/robo.go @@ -42,6 +42,13 @@ func (p Point) SearchMarks(c *bufio.ReadWriter) bool { return parseUnit(recv(c.Reader)) == 0 } +func (p Point) SearchMarksManual(c *bufio.ReadWriter) bool { + send(c.Writer, "TB99") + send(c.Writer, "TB55,1") + send(c.Writer, "TB23,", p) + return parseUnit(recv(c.Reader)) == 0 +} + func (ph Path) send(c *bufio.Writer, a ...interface{}) { fmt.Fprint(c, a...) for _, p := range ph { @@ -195,3 +202,15 @@ func Initialize(c *bufio.ReadWriter, mid int, o Orientation) { Unit(400).RegMarkLen(c.Writer) o.Orientation(c.Writer) } + +type StepDirection byte + +const ( + StepStop StepDirection = 1 << iota >> 1 + StepDown + StepUp + StepRight + StepLeft +) + +func (s StepDirection) Step(c *bufio.Writer) { esc(c, NUL, byte(s)) } -- cgit v1.2.3