Compare commits
3 Commits
269e6514df
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
|
9db00dd64c
|
|||
|
3832ca749f
|
|||
|
f37c194ab8
|
@@ -19,6 +19,7 @@ Runtime dependencies: Linux, a Brother QL label printer connected over USB
|
||||
$ go get -u https://janouch.name/sklad/cmd/sklad
|
||||
|
||||
You will need to bootstrap the database by writing a minimal 'db.json':
|
||||
|
||||
....
|
||||
{
|
||||
"Password": "login-password",
|
||||
|
||||
2
go.mod
2
go.mod
@@ -1,5 +1,5 @@
|
||||
module janouch.name/sklad
|
||||
|
||||
go 1.12
|
||||
go 1.17
|
||||
|
||||
require github.com/boombuler/barcode v1.0.1
|
||||
|
||||
15
ql/ql.go
15
ql/ql.go
@@ -240,8 +240,17 @@ func makePrintData(status *Status, image image.Image, rb bool) (data []byte) {
|
||||
mediaType = byte(0x0b)
|
||||
}
|
||||
|
||||
data = append(data, 0x1b, 0x69, 0x7a, 0x02|0x04|0x40|0x80, mediaType,
|
||||
byte(status.MediaWidthMM()), byte(status.MediaLengthMM()),
|
||||
const (
|
||||
flagValidMediaType = 0x02
|
||||
flagValidMediaWidth = 0x04
|
||||
flagValidMediaLength = 0x08
|
||||
flagPriorityToQuality = 0x40
|
||||
flagRecoveryAlwaysOn = 0x80
|
||||
)
|
||||
data = append(data, 0x1b, 0x69, 0x7a, flagValidMediaType|
|
||||
flagValidMediaWidth|flagValidMediaLength|
|
||||
flagPriorityToQuality|flagRecoveryAlwaysOn,
|
||||
mediaType, byte(status.MediaWidthMM()), byte(status.MediaLengthMM()),
|
||||
byte(dy), byte(dy>>8), byte(dy>>16), byte(dy>>24), 0, 0x00)
|
||||
|
||||
// Auto cut, each 1 label.
|
||||
@@ -256,7 +265,7 @@ func makePrintData(status *Status, image image.Image, rb bool) (data []byte) {
|
||||
data = append(data, 0x1b, 0x69, 0x4b, 0x08)
|
||||
}
|
||||
|
||||
if status.MediaLengthMM() != 0 {
|
||||
if status.MediaLengthMM() == 0 {
|
||||
// 3mm margins along the direction of feed. 0x23 = 35 dots, the minimum.
|
||||
data = append(data, 0x1b, 0x69, 0x64, 0x23, 0x00)
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user