aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cutter.go11
-rw-r--r--main.go3
-rw-r--r--marks.go26
-rw-r--r--usb.go8
4 files changed, 28 insertions, 20 deletions
diff --git a/cutter.go b/cutter.go
index 8454ab8..a1f5d09 100644
--- a/cutter.go
+++ b/cutter.go
@@ -90,25 +90,20 @@ func (c Cutter) TestCut() {
type StepDirection byte
const (
- stepEnd StepDirection = 1 << iota >> 1
+ StepStop StepDirection = 1 << iota >> 1
StepDown
StepUp
- StepLeft
StepRight
+ StepLeft
)
-func (c Cutter) step(dir StepDirection) {
+func (c Cutter) Step(dir StepDirection) {
c.WriteByte(ESC)
c.WriteByte(NUL)
c.WriteByte(byte(dir))
c.Flush()
}
-func (c Cutter) Step(dir StepDirection) {
- c.step(dir)
- c.step(stepEnd)
-}
-
// CR returns carret to home on same line
func (c Cutter) CR() {
c.WriteString("TT")
diff --git a/main.go b/main.go
index f9a3982..f15fcc7 100644
--- a/main.go
+++ b/main.go
@@ -7,7 +7,8 @@ func main() {
cu := NewCutter(dev.Handle(), Portrait)
defer cu.Home()
- defer cu.LineType(Solid)
+ //defer cu.LineType(Solid)
+ //cu.Raw([]string{"L100,1,400,100"})
//cu.TestCut()
//cu.TestPattern()
diff --git a/marks.go b/marks.go
index 8a37b4d..5fee812 100644
--- a/marks.go
+++ b/marks.go
@@ -1,23 +1,29 @@
package main
-/*
- Marks
- +-- --+
- | |
-
-
-
- |
+/* Portrait
+--
+ | 3
+
+ | 1 2 |
+ +-- --+
Offset: 10mm (200 pt)
Length: 20mm (400 pt)
Width: 190mm (3800 pt)
Height: 262mm (5240 pt)
*/
-// 5440 x 4000
-// Origin: 200x200
+/* Landscape
+ +-- +
+ | 3
+
+ | 1 2 |
+ +-- --+
+ 1-2 262 mm
+ 1-3 190 mm
+ offset 10x10 mm
+ length 20 mm
+*/
func (c Cutter) DrawMarks() (string, error) {
c.Move(Point{600, 3800})
diff --git a/usb.go b/usb.go
index 245fbd4..aab16b6 100644
--- a/usb.go
+++ b/usb.go
@@ -22,6 +22,12 @@ var (
debug = 3
)
+func init() {
+ // bump timeouts to one minute
+ usb.DefaultReadTimeout *= 60
+ usb.DefaultWriteTimeout *= 60
+}
+
func CC100(desc *usb.Descriptor) bool {
if desc.Vendor == graphtec {
switch desc.Product {
@@ -48,7 +54,7 @@ func NewDevice() (d Device) {
}
log.Fatal("Cannot find Craft ROBO")
}
- return Device{ctx: ctx, dev: devs[0]}
+ return Device{ctx, devs[0]}
}
func (d Device) Close() {