espressif / esp-idf

Espressif IoT Development Framework. Official development framework for Espressif SoCs.
Apache License 2.0
13.25k stars 7.19k forks source link

My complain about: esp-idf/examples/peripherals/lcd/i2c_oled (IDFGH-13245) #14179

Open sonictl opened 1 month ago

sonictl commented 1 month ago

Answers checklist.

General issue report

esp-idf version: v5.2.2

// complain about: esp-idf/examples/peripherals/lcd/i2c_oled

// 这个example有几个问题

// 对于使用ssd1306显示的人来讲,其实不需要 lvgl, 但给的例子不够精简,引入了lvgl的支持。这对初学者并不友好。example的设置,首先就是为初学者服务的,专家不需要example也能开发。

// 具体问题:

// 对初学者来说,要使用这个example代码就需要了解ESP-IDF自带的组件和外部组件。esp_lcd是本example需要的ESP-IDF内部组件,已经包含。lvgl却是外部组件,需要初学者学会如何添加 lvgl 这个外部组件。甚至还要求使用者理解什么是port的概念,什么又是 esp_lvgl_port。

// 既然要弃用以往的esp_ssd1306组件,就应该提供一个新的、与之对等的、从精简到复杂的example,而不是另起炉灶,甚至引入外部库。

// 这样操作肯定会增加项目的学习难度,最终于公司产品推广不利。

// 真不知道是怎么策划的这个demo...

suda-morris commented 1 month ago

Thanks for your valuable suggestion!

Yes, I agree the current LCD example are focus on too many things, including the promotion of the esp_bsp project. Which is good when the esp_bsp is still a new thing to the community. But now, it's a different story, we can see esp-bsp in many projects. So it's time to remove unnecessary dependencies in the esp-idf, and keep the examples there as clean as possible. In fact, the first release of the i2c_oled example does want to illustrate the usage of the "draw_bitmap" function, but later, this function was moved into the lvgl_port...

WRT the deprecation of esp_ssd1306 component, IMO we can refactor it and keep the help functions like "draw_string" "draw_rectangle". @espzav

BTW, if you want a simpler usage of the SSD1306 usage, you can find some in: https://github.com/espressif/esp-idf/blob/master/components/esp_lcd/test_apps/i2c_lcd/main/test_i2c_lcd_panel.c

sonictl commented 1 month ago

Thank you for your prompt response. In fact, there is a misunderstanding.

After further study and understanding, I have identified the reason for my confusion.

When I saw i2c_oled, I found that it is a folder within an ESP-IDF internal example, located at examples/peripherals/lcd/i2c_oled.

This path is easy to find, but this i2c_oled (essentially a project) can only be found when creating-a-new-project-through-examples by searching for 'i2c_oled'. When I was creating a new project, I tried searching with 'peripherals' and 'lcd' but found nothing. So, I was very confused as to why the example project available on GitHub could not be found in the ESP-IDF Examples panel in vsCode.

I suggest that your Examples search should include the names of parent folders. In other words, users should be able to search not only by the example project name but also by its parent elements. For instance, the keyword 'i2c_oled' works, but 'peripherals' and 'lcd' should also be searchable.

By the way, in the ESP Component Registry, the esp_ssd1306 page, it ask the reader to use a esp_lcd_panel_ssd1306.h in this link. To be honest, people will ask: what the hell is this .h file? new comer would feel confusing. The father folder in that .h file's path contains 'esp_lcd', BUT the 'esp_lcd' is different from 'lcd' here. OMG... This leads to my fault of finding this example which is under 'peripheral/lcd' path....Thus, I suggest the esp_ssd1306 page taking the users to this i2c_oled project.

I have add some instructions for 'Preparing source code' of this example project in the README.md file. Pull request has be submitted. Thx.

sonictl commented 1 month ago

By the way, i have tested the esp_port_lvgl on both 128x32 and 128x64 oled ssd1306. They does not support 128x32 oled well. Content will be squashed.