aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDimitri Sokolyuk <demon@dim13.org>2015-05-02 01:14:40 +0200
committerDimitri Sokolyuk <demon@dim13.org>2015-05-02 01:14:40 +0200
commitaced6a38b47a5a1274687a1150c5030afd1b0751 (patch)
tree4a8faec3698aa2154858c7d6b91f95b7a31c10cf
parent12af401400969a9ef862161f4dc3a5253a7a6ce8 (diff)
Add some missing bits
-rw-r--r--cutter.go53
1 files changed, 49 insertions, 4 deletions
diff --git a/cutter.go b/cutter.go
index a1f5d09..a3b9cb7 100644
--- a/cutter.go
+++ b/cutter.go
@@ -64,8 +64,12 @@ func NewCutter(io *bufio.ReadWriter, o Orientation) Cutter {
c.UnknownFC(m.FC)
c.TrackEnhancing(On)
c.UnknownFE(0)
- c.UnknownTB(71)
- c.UnknownFA()
+
+ p := c.GetCalibration()
+ fmt.Println("Calibration", p)
+
+ p = c.UnknownFA()
+ fmt.Println("FA", p)
c.Orientation(o)
return Cutter{io}
@@ -237,16 +241,57 @@ func (c Cutter) UnknownFE(n int) {
c.Emit()
}
+func parsePoint(s string) (p Point) {
+ fmt.Sscanf(s, "%v,%v", &p.X, &p.Y)
+ return
+}
+
+func (c Cutter) RegistrationMarksLength(n int) {
+ fmt.Fprint(c, "TB51,", n)
+ e.Emit()
+}
+
+func (c Cutter) Calibrate() {
+ fmt.Fprint(c, "TB70")
+ e.Emit()
+}
+
+// Sensor position
+func (c Cutter) GetCalibration() Point {
+ fmt.Fprint(c, "TB71")
+ c.Emit()
+ s, _ := c.readResponse()
+ return parsePoint(s)
+}
+
+func (c Cutter) SetCalibration(p Point) {
+ if p.X > 40 || p.Y > 40 || p.X < -40 || p.Y < -40 {
+ return
+ }
+ fmt.Fprint(c, "TB72,", p)
+ c.Emit()
+}
+
+// Arg: percent +/- 2.00% -> +/- 200
+func (c Cutter) DistanseCorrection(n int) {
+ if n > 200 || n < -200 {
+ return
+ }
+ fmt.Fprint(c, "FB", n, ",0")
+ c.Emit()
+}
+
func (c Cutter) UnknownTB(n int) (string, error) {
fmt.Fprint(c, "TB", n)
c.Emit()
return c.readResponse()
}
-func (c Cutter) UnknownFA() (string, error) {
+func (c Cutter) UnknownFA() Point {
fmt.Fprint(c, "FA")
c.Emit()
- return c.readResponse()
+ s, _ := c.readResponse()
+ return parsePoint(s)
}
// VersionUpgrade