how to alter library micro-gui-main for waveshare with st7789/xt2046 #9694
Replies: 6 comments 10 replies
-
suggestions are welcome :)
|
Beta Was this translation helpful? Give feedback.
-
You haven't stated the exact model of Waveshare display but it sounds similar to this one. Also you haven't stated what platform you're using. Is it a Pico? The first step to getting a new display working, and to validate your |
Beta Was this translation helpful? Give feedback.
-
The I am puzzled by your memory allocation failures. My Pico shows 182880 bytes free with nothing running, and 116480 bytes free running the You might like to read this doc on optimising your own code.
You can always create large fonts with font-to-py. I have users who created digital clock fonts with minimal character sets. The idea was a display which could be read across a room.
For all that my e-paper displays are rubbish, I have no complaints about my sample of this display from a hardware point of view. |
Beta Was this translation helpful? Give feedback.
-
mind you, my program does not have those memory allocation problems (yet) when i use it in combination with the crippled waveshare library...although it might come close, i have no idea. i have no idea why that is, but i'm guessing it has to do with what waveshare removed from the driver (boolpalette and more) in order to make their screen work. the plus is, because of this i made serious progress in my understanding of micropython. but apparantly not enough yet to analyze my sluggish code...... i removed a few things that do not have to be refreshed every second, i added your library to the pico so i could test your demos and as extra waste of space and then my script running on the waveshare set is still running without memory problems. so i wouldn't know if compacting the code by freezing would help. other things that might eat up memory, i use a pico W, so it also has code for wifi on board. if you have this display, pico w, ds3231 and maybe a relay or led i could give you my script so you can run it yourself. |
Beta Was this translation helpful? Give feedback.
-
The Pico W shows 161728 bytes free as against 182880 for the Pico, a ~20KiB loss. The aclock demo reports 90432 bytes free on Pico W. That is still a lot of RAM by microcontroller standards. In my view substantial nano-gui applications should be possible on Pico W. Unfortunately I don't have time to set up hardware, test and debug your code. If you raise questions in Discussions I and others will attempt to answer them. If your code is not too long, post it there for review. |
Beta Was this translation helpful? Give feedback.
-
i do have a question after another day of tries and tests, is it possible to rotate the screen from script?
where disp_mode = 0 defines the orientation of the screen. would that entail another buffer or could i just recalculate the x&y coordinates 240-x, 320-y when plucked from the buffer |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
due to the market i ended up with a waveshare 2.8 240x320 touchscreen and a fairly incomplete and crippled library that was not designed or optimised for this screen. but at least showed something on screen.
nonetheless i managed to make my first script (a clock with a few buttons) run on it.
however, due to the display size i made 2 font_to_py fonts, one at 40px and only numbers at 64px
although it works you can see the pico has a hard time getting it to the display and i do not know how to expand the menu without running into memory issues. i could try a smaller font size to clear up memory, but i'd rather improve or rewrite my script to better handle that display.
i thought that a better designed library and examples would help me on my way
so i found micro-gui-main from Peter Hinch and thought i would adapt the st7789_4bit.py to match resolution, and changed hardware_setup to match pin setup and i get a missing height error if i try to run aclock.py.
if i hard code height and width in there i get a driver incompatability.
i tried to use files from waveshares nanoguilib, (like st7789.py, writer.py,color_settings.py(=hardware_settings) but then all i got were memory errors.
so i'm stuck, unexperienced and would like a helping hand to make a better script.
i've included the waveshare st7789 driver that i use now and would like to see working with micro-gui-main
st7789.txt
Beta Was this translation helpful? Give feedback.
All reactions