Refactor build workflow and update LCD panel configuration

- Removed the intermediate step of storing all variants in an environment variable to prevent exceeding size limits.
- Updated the logic for selecting variants based on changes in the GitHub Actions workflow.
- Enhanced the LCD panel configuration for `esp_lcd_ili9486` and `esp_lcd_nv3030b` to support new RGB element order handling.
- Adjusted SSD1306 display initialization to ensure compatibility with different IDF versions by using individual field assignments.
This commit is contained in:
Xiaoxia
2026-08-07 23:43:47 +08:00
parent 85ff44a759
commit ef84728631
4 changed files with 50 additions and 26 deletions
+7 -8
View File
@@ -29,22 +29,21 @@ jobs:
- name: Test build tooling
run: python -m unittest discover -s scripts/tests -v
- id: list
name: Get all variant list
run: |
echo "all_variants=$(python scripts/build.py --list-boards --json)" >> $GITHUB_OUTPUT
- id: select
name: Select variants based on changes
shell: bash
env:
ALL_VARIANTS: ${{ steps.list.outputs.all_variants }}
run: |
EVENT_NAME="${{ github.event_name }}"
# push 到 main 分支,编译全部变体
if [[ "$EVENT_NAME" == "push" ]]; then
echo "variants=$ALL_VARIANTS" >> $GITHUB_OUTPUT
# Keep the full matrix out of an environment variable. A single
# Linux environment entry is limited to 128 KiB, and the variant
# JSON can exceed that as boards are added.
{
printf 'variants='
python scripts/build.py --list-boards --json
} >> "$GITHUB_OUTPUT"
exit 0
fi
+14 -1
View File
@@ -77,7 +77,7 @@ esp_err_t esp_lcd_new_panel_ili9486(const esp_lcd_panel_io_handle_t io, const es
ESP_GOTO_ON_FALSE(false, ESP_ERR_NOT_SUPPORTED, err, TAG, "unsupported color space");
break;
}
#else
#elif ESP_IDF_VERSION < ESP_IDF_VERSION_VAL(6, 0, 0)
switch (panel_dev_config->rgb_endian) {
case LCD_RGB_ENDIAN_RGB:
ili9486->madctl_val = 0;
@@ -89,6 +89,19 @@ esp_err_t esp_lcd_new_panel_ili9486(const esp_lcd_panel_io_handle_t io, const es
ESP_GOTO_ON_FALSE(false, ESP_ERR_NOT_SUPPORTED, err, TAG, "unsupported rgb endian");
break;
}
#else
switch (panel_dev_config->rgb_ele_order) {
case LCD_RGB_ELEMENT_ORDER_RGB:
ili9486->madctl_val = 0;
break;
case LCD_RGB_ELEMENT_ORDER_BGR:
ili9486->madctl_val |= LCD_CMD_BGR_BIT;
break;
default:
ESP_GOTO_ON_FALSE(false, ESP_ERR_NOT_SUPPORTED, err, TAG,
"unsupported rgb element order");
break;
}
#endif
switch (panel_dev_config->bits_per_pixel) {
+14 -1
View File
@@ -73,7 +73,7 @@ esp_err_t esp_lcd_new_panel_nv3030b(const esp_lcd_panel_io_handle_t io, const es
ESP_GOTO_ON_FALSE(false, ESP_ERR_NOT_SUPPORTED, err, TAG, "unsupported color space");
break;
}
#else
#elif ESP_IDF_VERSION < ESP_IDF_VERSION_VAL(6, 0, 0)
switch (panel_dev_config->rgb_endian) {
case LCD_RGB_ENDIAN_RGB:
nv3030b->madctl_val = 0;
@@ -85,6 +85,19 @@ esp_err_t esp_lcd_new_panel_nv3030b(const esp_lcd_panel_io_handle_t io, const es
ESP_GOTO_ON_FALSE(false, ESP_ERR_NOT_SUPPORTED, err, TAG, "unsupported rgb endian");
break;
}
#else
switch (panel_dev_config->rgb_ele_order) {
case LCD_RGB_ELEMENT_ORDER_RGB:
nv3030b->madctl_val = 0;
break;
case LCD_RGB_ELEMENT_ORDER_BGR:
nv3030b->madctl_val |= LCD_CMD_BGR_BIT;
break;
default:
ESP_GOTO_ON_FALSE(false, ESP_ERR_NOT_SUPPORTED, err, TAG,
"unsupported rgb element order");
break;
}
#endif
switch (panel_dev_config->bits_per_pixel) {
+15 -16
View File
@@ -101,26 +101,25 @@ private:
void InitializeSsd1306Display() {
// SSD1306 config
esp_lcd_panel_io_i2c_config_t io_config = {
.dev_addr = 0x3C,
.on_color_trans_done = nullptr,
.user_ctx = nullptr,
.control_phase_bytes = 1,
.dc_bit_offset = 6,
.lcd_cmd_bits = 8,
.lcd_param_bits = 8,
.flags = {
.dc_low_on_data = 0,
.disable_control_phase = 0,
},
.scl_speed_hz = 400 * 1000,
};
// IDF 5.5 and 6.x declare these fields in a different order. Assign
// them individually so C++ designated-initializer ordering is irrelevant.
esp_lcd_panel_io_i2c_config_t io_config = {};
io_config.dev_addr = 0x3C;
io_config.scl_speed_hz = 400 * 1000;
io_config.control_phase_bytes = 1;
io_config.dc_bit_offset = 6;
io_config.lcd_cmd_bits = 8;
io_config.lcd_param_bits = 8;
io_config.on_color_trans_done = nullptr;
io_config.user_ctx = nullptr;
io_config.flags.dc_low_on_data = 0;
io_config.flags.disable_control_phase = 0;
ESP_ERROR_CHECK(esp_lcd_new_panel_io_i2c_v2(display_i2c_bus_, &io_config, &panel_io_));
ESP_ERROR_CHECK(esp_lcd_new_panel_io_i2c(display_i2c_bus_, &io_config, &panel_io_));
ESP_LOGI(TAG, "Install SSD1306 driver");
esp_lcd_panel_dev_config_t panel_config = {};
panel_config.reset_gpio_num = -1;
panel_config.reset_gpio_num = GPIO_NUM_NC;
panel_config.bits_per_pixel = 1;
esp_lcd_panel_ssd1306_config_t ssd1306_config = {