Skip to content

Commit 7ee3f98

Browse files
committed
Update rgbmatrix, fix column calculation
1 parent 4bc9d71 commit 7ee3f98

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

matrix.go

+6-2
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ import (
3737
// DefaultConfig default WS281x configuration
3838
var DefaultConfig = HardwareConfig{
3939
Rows: 32,
40+
Cols: 32,
4041
ChainLength: 1,
4142
Parallel: 1,
4243
PWMBits: 11,
@@ -49,6 +50,8 @@ var DefaultConfig = HardwareConfig{
4950
type HardwareConfig struct {
5051
// Rows the number of rows supported by the display, so 32 or 16.
5152
Rows int
53+
// Cols the number of columns supported by the display, so 32 or 64 .
54+
Cols int
5255
// ChainLengthis the number of displays daisy-chained together
5356
// (output of one connected to input of next).
5457
ChainLength int
@@ -82,12 +85,13 @@ type HardwareConfig struct {
8285
}
8386

8487
func (c *HardwareConfig) geometry() (width, height int) {
85-
return c.Rows * c.ChainLength, c.Rows * c.Parallel
88+
return c.Cols * c.ChainLength, c.Rows * c.Parallel
8689
}
8790

8891
func (c *HardwareConfig) toC() *C.struct_RGBLedMatrixOptions {
8992
o := &C.struct_RGBLedMatrixOptions{}
9093
o.rows = C.int(c.Rows)
94+
o.cols = C.int(c.Cols)
9195
o.chain_length = C.int(c.ChainLength)
9296
o.parallel = C.int(c.Parallel)
9397
o.pwm_bits = C.int(c.PWMBits)
@@ -132,7 +136,7 @@ func NewRGBLedMatrix(config *HardwareConfig) (c Matrix, err error) {
132136
}
133137
}
134138
}()
135-
139+
136140
if isMatrixEmulator() {
137141
return buildMatrixEmulator(config), nil
138142
}

vendor/rpi-rgb-led-matrix

Submodule rpi-rgb-led-matrix updated 82 files

0 commit comments

Comments
 (0)