bitluni / ESP32Lib

http://bitluni.net/esp32-vga/
441 stars 78 forks source link

Advanced modes and refactoring suggestions #50

Closed Martin-Laclaustra closed 3 years ago

Martin-Laclaustra commented 4 years ago

Dear Matthias, I am working in refactoring several parts to ease code comprehension, increase modularity, and allow more flexibility for expanding the library. All my suggested changes are explained in detail in the commit messages in the "advanced_redesign" branch of my fork (commits starting from "Graphics class redesign" to "In ESP32Lib.h exclude old composite video modes"): https://github.com/Martin-Laclaustra/martin-laclaustra_ESP32Lib/tree/advanced_redesign

I am not creating a pull request for this until you can look into it and agree that it is a step forward.

I started with the Graphics class, but I am going to visit other classes as well. I aim to keep all changes ordered (one class at a time) to help understanding what is going on in the code. I needed to start this refactoring because before, the structure was holding back development of new modes that I have been preparing. Also, it took me some effort to understand the overall design and I would like to clear the path for other collaborators that want to contribute (some documenting tasks are also planned).

So far, the modes I developed were modular (independent patches) and fully compatible with the current status of your master branch. This refactoring is based on my "advanced" branch, which is your master branch with all my patches merged in. Until you can review and comment on the specific changes, anyone can use and/or test the new modes by downloading the branch from my repository: git clone -b advanced https://github.com/Martin-Laclaustra/martin-laclaustra_ESP32Lib.git I will go on with new modes in the redesigned branch, that will also be available and functional to anyone who want to use it: git clone -b advanced_redesign https://github.com/Martin-Laclaustra/martin-laclaustra_ESP32Lib.git

Regards, Martin

Martin-Laclaustra commented 4 years ago

I pushed the fix for PAL and the code for fast composite rendering to the advanced_redesign branch in my repo. Instructions on how to get that branch are in the opening post of this issue thread. It now works with millions of colors at a reasonable rate. One test nice to the eye is to get the "Raytracer" example, change 3 lines:

(12) VGA14Bit vga; to CompositeColorDAC vga; or CompositeColorLadder vga; (50) vga.setFrameBufferCount(2); to vga.setFrameBufferCount(1); (54) vga.init(VGAMode::MODE320x200, vga.VGABlackEdition); to vga.init(CompMode::MODENTSCColor240P, 25, false); or other modes (see "CompositeDACColorMode.ino" example)

It would be great if this branch could be tested with other hardware. Bitluni's own boards and other people's modules ( @bootrino , this is a good opportunity to help).

This branch is a work in progress aiming to improve encapsulation and modularity in order to ease reusing the modes for different output devices and ultimately to allow porting the code to other platforms. The API in this branch is not guaranteed to be stable.

Martin-Laclaustra commented 3 years ago

It would be great if this branch could be tested with other hardware. Bitluni's own boards and other people's modules.

We tested it with Bitluni's boards and it works!

This is included in the "development" branch here and eventually it will be merged into "master".