iltis42 / XCVario

OpenIVario Wiki:
https://github.com/iltis42/OpenIVario/wiki
GNU General Public License v2.0
57 stars 33 forks source link

st7789 and ILI9341 Displays with new eglib #193

Closed skizzofly closed 2 years ago

skizzofly commented 2 years ago

Hello, from when we switched to the new eglib the two invertDisplay and setRedBlueTwist are not anymore working and they are just empty stubs.. As i am playing around with the project i had some problems with a touchscreen ILI9341 2.8 inch display (the read bpc one sold on amazon) and also with a super cute 2 inch ips st7789, the ILI was reversed and the ST had bad colors.. clearly the invertDisplay for the ILI and the setRedBlueTwist for the ST did not work anymore. Last good FW was the one of 14 dec 2021... I downloaded the source, setup the toolchain and started compiling a trial and error phase, i tried to call the ili9341_SetDisplayInversion but had no luck, so i said goodbye to the hardware 0x21 command and decided to make it software using the inlines.

I had to work on the AdaptUGC.h file adding the missing logic in the stubs and modifing the setColor inline function:

void invertDisplay( bool inv ) {invertDisp=inv;};           // solved in grafic layer
void setRedBlueTwist( bool twist ) {twistRB= twist;};           // no more needed, type of displays phased out
inline void undoClipRange() { eglib_undoClipRange(eglib);};
// color
inline void setColor( uint8_t idx, uint8_t r, uint8_t g, uint8_t b ) {
        twistRB?
            eglib_SetIndexColor(eglib, idx, invertDisp?~b:b, invertDisp?~g:g, invertDisp?~r:r):
            eglib_SetIndexColor(eglib, idx, invertDisp?~r:r, invertDisp?~g:g, invertDisp?~b:b);
}
inline void setColor( uint8_t r, uint8_t g, uint8_t b ) {
        twistRB?
            eglib_SetIndexColor(eglib, 0, invertDisp?~b:b, invertDisp?~g:g, invertDisp?~r:r):
            eglib_SetIndexColor(eglib, 0, invertDisp?~r:r, invertDisp?~g:g, invertDisp?~b:b);
}   

I also added the two bools at the end in the private section

bool twistRB;
bool invertDisp

I added a zip file with the modified header, please integrate it in the main code i really would be happy. Ciao

AdaptUGC_h.zip ;

iltis42 commented 2 years ago

Hi, and thanks for contributing, can you do a pull request with your changes ?

skizzofly commented 2 years ago

Hi, i tried but i'm not familiar with github.. and i would not like to mess up with the repo.

iltis42 commented 2 years ago

You needed to create your own fork by pressing the Fork button, right up: image Then in your fork you can apply those changes, either by editing in github webinterface, or you clone from there (instead from the official repo), and do your changes in your worspace (as usual), commit and push this back to your fork.

Finally, once your repo is compilable and tested, hit contribute: image to create the PR (pull request) towards the offical repo master branch. The above process is also described here in a short 5 minutes video: https://www.youtube.com/watch?v=rgbCcBNZcdQ

If you have further questions, don't hesitate to ask. In that way the risk to mess up something is the lowest we get, github does mostly the whole job to check, and last not least i will press the merge button if all is fine.

skizzofly commented 2 years ago

Thanks' i learned something new, and i contributed the project, I created the fork in my github profile I modified the file via web interface I cloned in my dev machine I compiled the cloned version and tested it on my dev board (i miss some components like the digital poti mcp4018 and the mcp3221, but more or less is all there to play around with) and verified all works I created the pull request.. after have tested the code. there must be pull https://github.com/iltis42/XCVario/pull/195 now.

Please check https://github.com/iltis42/XCVario/pull/194 i may have messed up something yesterday i hope it's nothing that can't be fixed.

For the rest I hope you appreciate the contribution, and congratulations for the project. The next step i was thinking is to make is a simple esp32+display only slave just to show the info of the main device.. When the club installed xcvario's on our gliders they removed the backseat remote display.. and we miss it a bit. I'm thinking on how to transfer data, if using bt, wifi or some serial wire maybee using TXD0 and some special nmea sentence interleaved in the log lines.