aboutsummaryrefslogtreecommitdiff
path: root/cutter.go
diff options
context:
space:
mode:
authorDimitri Sokolyuk <demon@dim13.org>2015-05-06 23:44:33 +0200
committerDimitri Sokolyuk <demon@dim13.org>2015-05-06 23:44:33 +0200
commite7be9ee27b1919eae9d49117ac17e27bd9f450b0 (patch)
tree2ff4f525dad5c0bccbffaf9f7c5a4b3249421e39 /cutter.go
parentb689698a7853bf8ce56a2d028e3ae47672ea090e (diff)
Use Scan* functions
Diffstat (limited to 'cutter.go')
-rw-r--r--cutter.go17
1 files changed, 7 insertions, 10 deletions
diff --git a/cutter.go b/cutter.go
index 76804e4..15f097e 100644
--- a/cutter.go
+++ b/cutter.go
@@ -225,22 +225,19 @@ func (c Cutter) UnknownFE(n int) {
c.Send("FE", n)
}
-func (c Cutter) parseDigit() (n int) {
+func (c Cutter) parseDigit() Unit {
s, _ := c.readResponse()
- fmt.Sscanf(s, "%v", &n)
- return
+ return ScanUnit(s)
}
-func (c Cutter) parsePoint() (p Point) {
+func (c Cutter) parsePoint() Point {
s, _ := c.readResponse()
- fmt.Sscanf(s, "%v,%v", &p.X, &p.Y)
- return
+ return ScanPoint(s)
}
-func (c Cutter) parseTriple() (t Triple) {
+func (c Cutter) parseTriple() Triple {
s, _ := c.readResponse()
- fmt.Sscanf(s, "%v,%v,%v", &t.U, &t.V, &t.W)
- return
+ return ScanTriple(s)
}
func (c Cutter) RegMarkLen(n Unit) {
@@ -258,7 +255,7 @@ func (c Cutter) GetCalibration() Point {
}
// Emited after auto calibration
-func (c Cutter) UnknownFQ5() int {
+func (c Cutter) UnknownFQ5() Unit {
c.Send("FQ5")
return c.parseDigit()
}