-
-
Notifications
You must be signed in to change notification settings - Fork 173
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Recommendation: move screen/pin definition in common files #24
Comments
I know it become a little bit clumsy when I add more and more driver on it.
In my previous using other display library experience, Ucglib is most
straightforward to let me configured to what I want and test the examples.
So I followed its style. I am considering only keep this style in only one
example and comment in other example refer to it.
「Marc MERLIN <notifications@github.com>」在 2021年2月13日週六,14:16 寫道:
… (feel free to close this issue after you've read it, there is a
suggestion, plus some pointers to my own work that may be useful to you)
The examples you give are really good, but the many many ways to define
the screens, is very long because there are so many options (and for good
reason).
Have you considered factoring that out into a common file?
For instance, see:
- https://github.com/marcmerlin/tft-playground/blob/master/tft_pins.h
=> this is compatible with you, adafruit libs, and other libs
- https://github.com/marcmerlin/tft-playground/blob/master/arduinogfx.h
=> those are definitions just for your lib
Then you can have the adafruit example like this:
https://github.com/marcmerlin/tft-playground/tree/master/ili3941graphicstest
And your example code like that:
https://github.com/marcmerlin/tft-playground/tree/master/PDQgraphicstest
This makes it easy to change the pin and screen in one place and all the
demos are updated at the same time.
And if you have a little time, please look at
https://github.com/marcmerlin/FastLED_NeoMatrix_SmartMatrix_LEDMatrix_GFX_Demos
especially
https://github.com/marcmerlin/FastLED_NeoMatrix_SmartMatrix_LEDMatrix_GFX_Demos/blob/master/neomatrix_config.h
neomatrix_config solves a similar problem to yours: a single config file
that contains 2D hardware definition and then all the demos source that
file and work automatically.
Currently I support a few TFTs from adafruit lib, but I will add support
for your driver because your driver is better :)
If you are curious, I support a lot of different hardware, including
RGBPanels and neopixel matrices, see my base class:
https://github.com/marcmerlin/Framebuffer_GFX
The only issue is that my base class is RGB888, which is a bit wasteful
for TFTs that are RGB565. For 320x240, the framebuffer is 224KB which is
too big on an ESP32 without PSRAM
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#24>, or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ADE5WWZDPXNWRW4U7V7EORDS6YKNRANCNFSM4XR2NU3Q>
.
|
thanks for your reply, it's just a suggestion since I went through the same thing than you with my set of 2D libraries. Having a file with definitions that you can include, makes things easier in my opinion, but you can decide what's best for you. |
Another alternative is build a Wiki for Arduino_GFX and simple drop a link in code comment. |
That works too. I'll leave it up to you, it's your library and your choice ;) |
Just commit the changes, only PDQgraphicstest.ino keep the long version. Is it good enough? |
I think that helps the other examples, yes. Thank you for that. Now, if it were me (and what I did in my lib) is to use an include file where the screen is defined After that when I use your library, I only have to edit arduinogfx.h , and all the demos would work. |
Arduino IDE not show header files at parent folder, user cannot read that file easily. And also when you start a new project from save as an example, the header files at parent folder will not copy to new project folder and that is not easy to fix for beginner. |
Thanks for letting me know. So, in my library, I cheat: I use symlinks It works great on linux and MacOS, but not on windows which does not support symlinks :( I really wish there was a simple solution to this need that works for everyone, your library and mine have the same exact need. |
I posted the question here, maybe we'll get a good suggestion: https://forum.arduino.cc/index.php?topic=731975 |
the answers I got, were
I'm not sure if you like option #2 , I'll let you decide. |
(feel free to close this issue after you've read it, there is a suggestion, plus some pointers to my own work that may be useful to you)
The examples you give are really good, but the many many ways to define the screens, is very long because there are so many options (and for good reason).
Have you considered factoring that out into a common file?
For instance, see:
Then you can have the adafruit example like this: https://github.com/marcmerlin/tft-playground/tree/master/ili3941graphicstest
And your example code like that: https://github.com/marcmerlin/tft-playground/tree/master/PDQgraphicstest
This makes it easy to change the pin and screen in one place and all the demos are updated at the same time.
And if you have a little time, please look at
https://github.com/marcmerlin/FastLED_NeoMatrix_SmartMatrix_LEDMatrix_GFX_Demos
especially https://github.com/marcmerlin/FastLED_NeoMatrix_SmartMatrix_LEDMatrix_GFX_Demos/blob/master/neomatrix_config.h
neomatrix_config solves a similar problem to yours: a single config file that contains 2D hardware definition and then all the demos source that file and work automatically.
Currently I support a few TFTs from adafruit lib, but I will add support for your driver because your driver is better :)
If you are curious, I support a lot of different hardware, including RGBPanels and neopixel matrices, see my base class:
https://github.com/marcmerlin/Framebuffer_GFX
The only issue is that my base class is RGB888, which is a bit wasteful for TFTs that are RGB565. For 320x240, the framebuffer is 224KB which is too big on an ESP32 without PSRAM
The text was updated successfully, but these errors were encountered: