diff --git a/max7219/example_test.go b/max7219/example_test.go index b235c84..2a9f94c 100644 --- a/max7219/example_test.go +++ b/max7219/example_test.go @@ -51,6 +51,8 @@ func Example() { dev.SetGlyphs(max7219.CP437Glyphs, true) dev.SetDecode(max7219.DecodeNone) dev.ScrollChars([]byte("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"), 1, 100*time.Millisecond) + } else { + dev.SetDecode(max7219.DecodeB) } // display a count diff --git a/max7219/max7219.go b/max7219/max7219.go index de020c9..99c7687 100644 --- a/max7219/max7219.go +++ b/max7219/max7219.go @@ -290,10 +290,6 @@ func (d *Dev) writeChars(bytes []byte) error { copy(x, d.glyphs[0x20]) w[ix] = x } - limit := len(bytes) - if limit > len(w) { - limit = len(w) - } charPos := len(bytes) - 1 for ix := d.units - 1; ix >= 0 && charPos >= 0; ix-- { w[ix] = d.glyphs[bytes[charPos]] diff --git a/max7219/max7219_test.go b/max7219/max7219_test.go index c86ec1b..89a92ac 100644 --- a/max7219/max7219_test.go +++ b/max7219/max7219_test.go @@ -217,9 +217,9 @@ func TestCommand(t *testing.T) { defer pb.Close() record := &spitest.Record{} - dev, err := NewSPI(record, 4, 8) + dev, _ := NewSPI(record, 4, 8) record.Ops = make([]conntest.IO, 0) - err = dev.SetIntensity(0x0b) + err := dev.SetIntensity(0x0b) if err != nil { t.Error(err)