Skip to content

Commit

Permalink
tool: change monochrome python format
Browse files Browse the repository at this point in the history
  • Loading branch information
polldo committed May 20, 2022
1 parent e3dd81f commit dcc5bc1
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions tools/monochrome/monochrome.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,13 @@ func (m *Monochrome) ToCpp() string {
}

func (m *Monochrome) ToPy() string {
s := "image = bytearray(b'"
s += fmt.Sprintf("\\x%02x\\x%02x", m.width, m.height)
s := "image = bytearray(["
s += fmt.Sprintf("0x%02x, 0x%02x, ", m.width, m.height)
for _, b := range m.val {
s += fmt.Sprintf("\\x%02x", b)
s += fmt.Sprintf("0x%02x, ", b)
}
s += "')"
s = strings.TrimRight(s, ", ")
s += "])"
return s
}

Expand Down

0 comments on commit dcc5bc1

Please sign in to comment.