JonA1961 / MAX7219array

Drive an array of MAX7219 8x8 LED matrices via SPI in Python from the Raspberry Pi
MIT License
47 stars 12 forks source link

Rotate the display by 90 or 270 degree? #1

Open torinnguyen opened 8 years ago

torinnguyen commented 8 years ago

My LED matrixes are rotated 90 degree from your setup. Is there a built-in function for this?

JonA1961 commented 8 years ago

The documentation included here includes details of all the functions included. There isn't one to do what I think you want. You may have a different design of board to mine (eg the one from Electrodragon). My library was written for the one detailed in this post on www.raspi.tv: http://raspi.tv/2013/8-x-8-led-array-driven-by-max7219-on-the-raspberry-pi-via-python and you may wish to read the discussion under post #18 on there. It sounds as though the assignment of rows & columns in your matrix to registers in the MAX7219 is different to that in the other design of board, which is what my library was designed for. It might be possible with some analysis and experimentation to work out how to change the library to drive your board, but you would need to do that yourself.

maquinuz commented 8 years ago

See here how this other project implements the Rotate Function and it is using on his led.py .. It supports ( 0, 90, 180, 270 ) , so that all letters on matrix 8x8 are rotated before printed.

https://github.com/rm-hull/max7219/blob/master/max7219/rotate8x8.py#L22 https://github.com/rm-hull/max7219/blob/master/max7219/led.py#L398

I do like the way you coded MAX7219array, it is a great work ! But I needed to be able to rotate.. So I'm trying hard to hack it and see if I should rotate inside your ( send_bytes(column_data) )
or before it like on each Character when called from Fonts...

Cat30Mk3 commented 7 years ago

I'm running into the same issue using Electrodragon 8x8's - have you had any success in rotating the display?

swoodford commented 7 years ago

I'm using the SainSmart MAX7219 Dot Matrix Module 4 (https://www.amazon.com/SainSmart-MAX7219-Matrix-Module-Arduino/dp/B00WWNZZAS). The 8x8 array panels are arranged in a 1x4 row and the demo runs on each 8x8 panel but there is no way to rotate the text so that it displays properly on the 1x4 row.

swoodford commented 7 years ago

image

signaleleven commented 6 years ago

I needed it in a pinch and I made this terrible thing

for idx in range(len(SINCLAIRS_FONT)):
 SINCLAIRS_FONT[idx]=[reduce(lambda byte, bit: int(byte) << 1 | int(bit), line) for line in list(zip(*[list(bin(linex)[2:].zfill(8)) for linex in SINCLAIRS_FONT[idx]][::-1]))]
 SINCLAIRS_FONT[idx]=[reduce(lambda byte, bit: int(byte) << 1 | int(bit), line) for line in list(zip(*[list(bin(linex)[2:].zfill(8)) for linex in SINCLAIRS_FONT[idx]][::-1]))]
 SINCLAIRS_FONT[idx]=[reduce(lambda byte, bit: int(byte) << 1 | int(bit), line) for line in list(zip(*[list(bin(linex)[2:].zfill(8)) for linex in SINCLAIRS_FONT[idx]][::-1]))]

It rotates the font. Of course it only works for displaying static info, as the scrolling and such would still be wrong.

additude commented 5 years ago

I would like to continue using MAX7219array as it is well written and has features that can be complimented. I just wish I understood the direction issue more as I also need to rotate the text for my (8x8)x(1x4) LED array.