raspberryPi icon indicating copy to clipboard operation
raspberryPi copied to clipboard

Garbled image when using the test program

Open ObligedTester opened this issue 2 years ago • 5 comments

While using test_load_image in the "old" section for ssd1322, only a garbled square is shown. Its about 1 4th of the entire display width.

Any tip on what might cause this?

ObligedTester avatar Jan 02 '24 21:01 ObligedTester

Found it.

#define COLS_VIS_MIN 0x00 // Visible cols - start.
#define COLS_VIS_MAX 0x3f // Visible cols - end.
#define ROWS_VIS_MIN 0x00 // Visible rows - start.
#define ROWS_VIS_MAX 0x3f // Visible rows - end.

Both rows and cols are only 64 here, cols needs to be 0xff, then it works

ObligedTester avatar Jan 02 '24 21:01 ObligedTester

Thanks for your own perseverance here. These are really old development and test programs that never really got anywhere because my career intervened. I wanted to turn a "Fallout" lunchbox into a media player that looked like a bottlecap bomb but with a display that emulated the style of the terminals found in the game. I got as far as a startup animation and a font after installing the hardware. I look at some of my old programs now and wonder how I even started and I doubt I could ever really offer much help any more. Once I leave the "zone", I never easily get back in. I've moved on to different things lately but hope you find some use. I think there are fully functional SSD1322 drivers around these days - there weren't back then!

alidaf avatar Jan 03 '24 08:01 alidaf

Hello,

Thank you for your reply!

Actually I just started to experiment with these OLEDs, just because they are really cool. I often want to see how the drivers works "behind the scenes", and many of them are very complex or not very good documented. I found your "old" example easy to follow around what is going on. It's also a good fundamental for someone that want to try to write "their own" driver. -- Thanks very much for sharing it!

I just need to read up a bit on how the grayscale is working, and also the best way to convert a image to the bitmap. If you have any notes on this, feel free to share!

ObligedTester avatar Jan 03 '24 14:01 ObligedTester

I don't remember too much but I had a rummage around some of my scratch files and came across an image that I remember using at some point. In my scratch folder there's the original jpg, a bmp and a h file that looks like the actual bitmap converted into some format. Given the absence of any code to convert I must have used an online tool or similar. I reverse engineered bmp files many years ago and below a certain size they have a header giving dimensions etc, and then the RGB data with byte padding on 4-byte boundaries iirc. It took a while to figure out but it looks like the h file is just an array of pseudo-hex, i.e. uint8 that never go above 15, which is your 4-bit depth. You must have used graphics.h, which looks similar to the file I have but is multidimensional because it's actually 7 frames of an animation. I know it's not a lot to go on, but I hope it helps. I was very much like you, wanting to learn by my own analysis. I'm one of those people that just can't be taught traditionally since I have ASD/ADHD. I'm not even a programmer by discipline - everything has been self-taught but if I don't keep using it, I lose it very quickly!

alidaf avatar Jan 03 '24 16:01 alidaf

Thank you for that explanation, it really helped a lot! I was able to find a program that can convert a grayscale image to .h format. They are around here and there, but they all seem to be pretty buggy.

I'm the same way, I want to learn something by seeing how it works, and unfortunately, when I'm passed the most difficult part and got it to work, i usually move on to the next project :D

Again, thanks a lot for your time, help and making your code available to learn and draw inspiration from!

ObligedTester avatar Jan 06 '24 20:01 ObligedTester