help using LCD Assistant and GIMP(Resolved)
msiriwardena
Posts: 301
I am trying use OLED 96X16 which uses the SSD1306 chip to display images.
So far I have been successful creating an image 96X16pic. image.
But I am not successful is to convert the image into propeller ($) binary data.
The LCD Assistant is used to convert the image Hex Data but
when I try to convert Hex Data, the conversion displays all "Hex 0" in C format.
If I get the image converted to Hex Data the I could convert Mex Data to ($) binary data.
I know this have been done before but I cannot find the way to do it. I
googled and looked in this forum but with no successful.
I hope someone will enlighten me with the details how to proceed.
Thank you,
Siri
So far I have been successful creating an image 96X16pic. image.
But I am not successful is to convert the image into propeller ($) binary data.
The LCD Assistant is used to convert the image Hex Data but
when I try to convert Hex Data, the conversion displays all "Hex 0" in C format.
If I get the image converted to Hex Data the I could convert Mex Data to ($) binary data.
I know this have been done before but I cannot find the way to do it. I
googled and looked in this forum but with no successful.
I hope someone will enlighten me with the details how to proceed.
Thank you,
Siri
Comments
It just dawned on me that a simple Python program could process the C output to Spin -- I'm going to give that a try right now.
My first issue is the LCD Assistant is all "0x00" every single data point.
I will do a global replace if I can get a true Hex output and add the byte headers manually.
I can read the 96X16 created image but unable to convert with the LCD Assistant.
Thanks
Siri
Is your image monochrome (1 bit per pixel)? Maybe the software gets confused if it is not...
From the command line enter: python lcda_convert.py tablename where tablename is the name of the input file (from LCDA) file less the '.c' extension.
I am still new to Python programming -- if there is a better way to write this program, please let me know.
The forum doesn't allow the attachment of Python files so I appended .txt to that file -- remove this before use.
Thank you for your help.
Siri
The program works . There are a few things that can make it more 'pythonic':
instead of you can use instead of you are encouraged to use (Reading and Writing files):
the last requires some slight changes to the logic
EDIT:
This is how my process_file would end up using he hints from above:
I got a bit different coding style than @JonnyMac and tend to merge multiple lines into one if I can get away with it : the line p = [...] seems like magic but is using list comprehension to get stuff done, it is basically the same as a for loop)
That is something I tend to avoid -- I always go for obvious. The owners of the company I work for have told us that they are working on have Guido van Rossum come to our office for a day (no date set); I am looking forward to hearing his perspective. What I don't understand is the requirement for colons after definitions and in if-elif-else constructs.
Anyway, thanks for the feedback. I will copy-and-paste snippets into idle so that I can fully understand what's happening.
block indicator, makes it easier to see when indentation is required
look here aswell: list-comprehensions
EDIT: Python style guide is almost recommended reading when you code in python.