aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDimitri Sokolyuk <demon@dim13.org>2015-05-15 02:40:28 +0200
committerDimitri Sokolyuk <demon@dim13.org>2015-05-15 02:40:28 +0200
commitada146f45cac107928c55780b0adad94d332cdc6 (patch)
tree4bb93690cf38728990b7f4b77fb0186eb61e8bd8
parente3cae1b64560df748350dc4c0b11a95ac3a1d4f6 (diff)
Add more methods
-rw-r--r--cutter.go9
-rw-r--r--robo.go10
-rw-r--r--testpattern.go6
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})
}