Fixes for Waveshare Pico-ResTouch-LCD-3.5 (#1) #2
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I am working with this display board and the Raspberry Pi Pico:
https://www.waveshare.com/wiki/Pico-ResTouch-LCD-3.5
I tried your driver from the main branch in Github, but it didn't work for me. The main problem was that writing command parameters with SPI.write() only works if I write a single byte per write() call. I don't have a clear explanation for this, but looping one write() call per byte seems to be a safe workaround.
In addition, I found a bunch of opcodes that carried over from the source driver for ILI93xx chips but do not appear in the ILI9488 data sheet. I updated these codes based on the data sheet (although I didn't include everything in the data sheet). Similarly, the initialization code contained commands or parameters that didn't make sense based on the ILI9488 data sheet. I reduced these to a fairly minimal set that works OK for me.
Finally, I found that the code for draw_text8x8() had a bug with foreground and background colors. It turns out that any code using Micropython's FrameBuffer and the block() method to copy the FB's backing buffer to the ILI9488 is problematic. This is because FrameBuffers store the 16-bit colors in native byte-order (which is little-endian) while the ILI9488 expects colors to be big-endian. I couldn't find any code or hooks in FrameBuffer to deal with this, so I added code to the driver for byte-swapping and then flip the color value before writing into the FrameBuffer.
I don't know how much you are actively maintaining/supporting your driver, but I might as well send you these fixes if you want to use them. I'm fine with using my private version for my purposes, so no urgency to merge this from my end.
Thanks,
Tom Pavel