Errors out on bigger displays
Hello, I'm trying to hook up a bigger display made from hanover. it has 15 (or 16) rows and a lot of columns, I haven't been able to count them yet but they are 200+ definitely.
When trying to use for example 15 (or 16) rows and 256 columns for testing it errors out when I try to send data to it.
/home/raspberry/flippy-flipdot-web/node_modules/flipdot-display/flipdot.js:217
matrix[i][j] = bit;
^
TypeError: Cannot set properties of undefined (setting '0')
at FlipDot.dataToMatrix (/home/raspberry/flippy-flipdot-web/node_modules/flipdot-display/flipdot.js:217:22)
at Socket.<anonymous> (/home/raspberry/flippy-flipdot-web/app.js:165:23)
at Socket.emit (node:events:517:28)
at /home/raspberry/flippy-flipdot-web/node_modules/socket.io/lib/socket.js:531:14
at process.processTicksAndRejections (node:internal/process/task_queues:77:11)
Any suggestions?
I think I solved it by modifing the code a bit in flipdot.js as referenced in the error
adding matrix[i] = []; solves the error but don't know if it introduces new errors?
edit2: I think its not working as it clears the display every time I try to click on an individual dot from the web
FlipDot.prototype.dataToMatrix = function(hex_data = this.decode(this.packet.data)) {
var matrix = this.matrix();
for (var j = 0; j < this.columns; j++) {
// walk bytes in column
for (var b = 0; b < this.col_bytes; b++) {
// walk bits in byte constructing hex value
for (var i = 8*b; i < (this.rows * (b+1)); i++) {
matrix[i] = [];
var bit = (hex_data[j] >> i) & 0x01;
matrix[i][j] = bit;
}
}
}
return matrix;
}
I have a 32×17 led display with a controller. I took a packet capture for a repeating pattern of full on followed by full off (except for the top left pixel which is on). Edit: the display is at address 7.
0232380339330132383030043332023138363046464646303146464646303146464646303146464646303146464646303146464646303146464646303146464646303146464646303146464646303146464646303146464646303146464646303146464646303146464646303146464646303146464646303146464646303146464646303146464646303146464646303146464646303146464646303146464646303146464646303146464646303146464646303146464646303146464646303146464646303146464646303146464646303103304502363033303030034434023238033933013238303004333202363033303030034434023238033933013238303004333202313836303031303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030300332440232380339330132383030043332023630333030300344340232380339330132383030043332023138363046464646303146464646303146464646303146464646303146464646303146464646303146464646303146464646303146464646303146464646303146464646303146464646303146464646303146464646303146464646303146464646303146464646303146464646303146464646303146464646303146464646303146464646303146464646303146464646303146464646303146464646303146464646303146464646303146464646303146464646303146464646303146464646303103304502323803393301323830300433320236303330303003443402323803393301323830300433320231383630303130303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030033244023238033933013238303004333202363033303030034434
The following capture will display Hello World (scrolling):-
0230387b5c6d6f6465305c666974327b48656c6c6f20576f726c647d7d033837
Decoded:-
00000000: 0230 387b 5c6d 6f64 6530 5c66 6974 327b .08{\mode0\fit2{
00000010: 4865 6c6c 6f20 576f 726c 647d 7d03 3837 Hello World}}.87