Skip to content
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

Proposal to Separate SSD1306 Component to a Standalone Repository #22

Open
Krzyshio opened this issue May 29, 2023 · 11 comments
Open

Proposal to Separate SSD1306 Component to a Standalone Repository #22

Krzyshio opened this issue May 29, 2023 · 11 comments

Comments

@Krzyshio
Copy link

Krzyshio commented May 29, 2023

Hi @nopnop2002,

I've been using your SSD1306 Driver for esp-idf and find it very useful.
However, I noticed that the SSD1306 driver is bundled together with numerous examples within the same repository.

Although these examples provide valuable context, I suggest separating the SSD1306 driver into its own dedicated repository. This would make it easier for developers to integrate the driver into their projects, possibly as a Git submodule, without the necessity of cloning the entire current repository.

Separating the driver into its own repository could streamline its adoption by other developers and make it more accessible.

Please consider this proposal and let me know your thoughts.

Thanks for your time

@nopnop2002
Copy link
Owner

nopnop2002 commented May 29, 2023

I noticed that the SSD1306 driver is bundled together with numerous examples within the same repository.

Drivers are only here.

All samples use this.

https://github.com/nopnop2002/esp-idf-ssd1306/tree/master/components/ssd1306

You can only clone this directory.

This has the same result as putting just the driver in a separate repository.

$ mkdir your_directory
$ cd your_directory
$ git init
$ git config core.sparsecheckout true
$ git remote add origin https://github.com/nopnop2002/esp-idf-ssd1306
$ echo components >> .git/info/sparse-checkout
$ git pull origin master
$ ls -R
.:
components

./components:
ssd1306

./components/ssd1306:
CMakeLists.txt     font8x8_basic.h  ssd1306.h      ssd1306_spi.c
Kconfig.projbuild  ssd1306.c        ssd1306_i2c.c

@Krzyshio
Copy link
Author

Thanks for your quick response and for the explanation on how to use sparse checkout to isolate the driver.

However, the method you suggested lacks one important feature for developers, that is direct linkage to your original repository.

By using your driver as a standalone repository or as a Git submodule, each project that uses your driver can easily reference back to the original repository, allowing other developers to understand where the driver came from and perhaps contribute to its development.

Furthermore, with a direct link to the original repository, developers can watch for updates, issues, and discussions regarding the driver, keeping them in the loop for any potential changes or improvements. This would not be possible with the current method you've suggested as the link between the original repository and the cloned directory is lost.

Lastly, with a Git submodule or standalone repository, updating to the latest version of the driver is more straightforward. Instead of manually performing the sparse checkout for newer commits, developers can use Git's built-in mechanisms to update submodules, ensuring they have the latest version with less manual intervention.

I believe these benefits justify considering the usage of a standalone repository or Git submodule for your SSD1306 driver. Please let me know your thoughts on this.

@nopnop2002
Copy link
Owner

nopnop2002 commented May 29, 2023

ESP-IDF behaves differently depending on the version.

V4.X and V5.X are less compatible and should be considered completely different.

We made many fixes to make it work using single-source for both V4.X and V5.X.
However, in some repositories the differences were so great that it was necessary to split the branches.

Perhaps V5.X and V6.X will be completely different things

In this case, create a branch in the repository and manage the source for each version.

Luckily, SSD1306 can currently provide the source code in one branch, but we may need to separate the branches in the near future.

Even if we used a standalone repository for our SSD1306 driver, we still need to separate the branchs.

V4.X can be used until July 2024.
Developers using V4.X may require a set of non-latest versions of the driver and sample code at the same time.
Only developers using V6.X will need the latest versions of the drivers and example code.

@Krzyshio
Copy link
Author

Despite these challenges, I still believe that separating the SSD1306 driver into its own repository and using Git submodules could be beneficial. This would not eliminate the need for maintaining separate branches for different ESP-IDF versions, but it could simplify the process of integrating your driver into other projects.

When your driver is used as a Git submodule in a project, developers can easily switch between the branches in your repository to match their ESP-IDF version. This allows them to work with the version of your driver that is compatible with their ESP-IDF version, while also maintaining a direct link to your repository.

Additionally, the use of Git submodules can make the process of updating to the latest version of your driver much simpler. Instead of manually performing the sparse checkout for newer commits, developers can use Git's built-in mechanisms to update the submodule, ensuring they always have the latest compatible version with less manual intervention.

@digiexchris
Copy link

I think you could accomplish both just by having the component live at the top level of this project, and have the examples live inside an examples directory inside that component. That's what many components do in the idf-component-registry.

mkdir examples
mv * examples/
mv examples/components/ssd1306/* ./
rmdir examples/components

done :D

I agree with making it a top level component in this repository, right now I have to manage it by cloning it somewhere else, and have my build scripts copy the component in, and make comments saying which version it is and where it came from. Less than ideal, it breaks with how most components are distributed right now.

@nopnop2002
Copy link
Owner

@digiexchris

I would like you to show me the specific directory structure so that there is no misunderstanding.

@digiexchris
Copy link

digiexchris commented Dec 19, 2023 via email

@nopnop2002
Copy link
Owner

@digiexchris

Thank you for your quick response.
I'll consider it.

@nopnop2002
Copy link
Owner

nopnop2002 commented Dec 28, 2023

I saw this.
https://github.com/eldendiss/DendoStepper

This directory structure is similar to that commonly found in Arduino libraries.

On the other hand, the official esp-idf sample makes extensive use of component directories.

./wifi/antenna/components
./ethernet/enc28j60/components
./ethernet/basic/components
./bluetooth/nimble/throughput_app/blecent_throughput/components
./bluetooth/esp_ble_mesh/ble_mesh_coex_test/components
./bluetooth/esp_ble_mesh/aligenie_demo/components
./system/unit_test/components
./system/console/advanced/components
./system/gcov/components
./peripherals/spi_master/hd_eeprom/components
./peripherals/dedicated_gpio/soft_uart/components
./peripherals/dedicated_gpio/soft_i2c/components
./peripherals/dedicated_gpio/soft_spi/components
./peripherals/gpio/matrix_keyboard/components
./storage/custom_flash_driver/components
./build_system/cmake/plugins/components
./build_system/cmake/import_prebuilt/prebuilt/components
./build_system/cmake/import_lib/components

@digiexchris
Copy link

digiexchris commented Dec 30, 2023

yes and that works fine, as long as the cmakelists.txt file in the root of the repo resolves those paths correctly. The espressif toolchain has complicated rules to resolve nested cmake files. If you provided a cmakelists.txt in the root of this repo, that would solve the issue for most.

@bullestock
Copy link

It is easy enough to use this project as a submodule in an ESP-IDF project:

cd components
mkdir ssd1306
cd ssd1306
git submodule add https://github.com/nopnop2002/esp-idf-ssd1306.git

Now, in the top level CMakeLists.txt, add

set(EXTRA_COMPONENT_DIRS
    ./components/ssd1306/esp-idf-ssd1306/components/ssd1306/)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants