aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDimitri Sokolyuk <demon@dim13.org>2015-05-16 14:24:59 +0200
committerDimitri Sokolyuk <demon@dim13.org>2015-05-16 14:24:59 +0200
commit0d0c55fafb5442f0ba11055b13fa54c983bd4a4c (patch)
treec6225a34b607c70a2e5d7da255ba43742108be7e
parent234d7a09d640a7faee142d7dd8bd91e2292eba65 (diff)
Add Step
-rw-r--r--cutter.go10
-rw-r--r--robo.go19
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)) }