Support GPIO app in vertical orientation (#129)

... and fix getting proper display in Display app
This commit is contained in:
Ken Van Hoeylandt 2024-12-15 22:07:34 +01:00 committed by GitHub
parent 49bf8e824c
commit e4b8519f67
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 8 additions and 4 deletions

View File

@ -22,7 +22,6 @@
- Show a warning screen if firmware encryption or secure boot are off when saving WiFi credentials. - Show a warning screen if firmware encryption or secure boot are off when saving WiFi credentials.
- Show a warning screen when a user plugs in the SD card on a device that only supports mounting at boot. - Show a warning screen when a user plugs in the SD card on a device that only supports mounting at boot.
- Localisation of texts (load in boot app from sd?) - Localisation of texts (load in boot app from sd?)
- Portrait support for GPIO app
- Explore LVGL9's FreeRTOS functionality - Explore LVGL9's FreeRTOS functionality
- Explore LVGL9's ILI93414 driver for 2.4" Yellow Board - Explore LVGL9's ILI93414 driver for 2.4" Yellow Board
- Replace M5Unified and M5GFX with custom drivers (so we can fix the Core2 SD card mounting bug, and so we regain some firmware space) - Replace M5Unified and M5GFX with custom drivers (so we can fix the Core2 SD card mounting bug, and so we regain some firmware space)

View File

@ -94,7 +94,7 @@ static void onShow(AppContext& app, lv_obj_t* parent) {
lv_slider_set_range(brightness_slider, 0, 255); lv_slider_set_range(brightness_slider, 0, 255);
lv_obj_add_event_cb(brightness_slider, onSliderEvent, LV_EVENT_VALUE_CHANGED, nullptr); lv_obj_add_event_cb(brightness_slider, onSliderEvent, LV_EVENT_VALUE_CHANGED, nullptr);
auto* lvgl_display = lv_display_get_default(); auto* lvgl_display = lv_obj_get_display(parent);
tt_assert(lvgl_display != nullptr); tt_assert(lvgl_display != nullptr);
auto* hal_display = (tt::hal::Display*)lv_display_get_user_data(lvgl_display); auto* hal_display = (tt::hal::Display*)lv_display_get_user_data(lvgl_display);
tt_assert(hal_display != nullptr); tt_assert(hal_display != nullptr);

View File

@ -127,9 +127,14 @@ void Gpio::onShow(AppContext& app, lv_obj_t* parent) {
lv_obj_set_flex_grow(wrapper, 1); lv_obj_set_flex_grow(wrapper, 1);
lv_obj_set_style_border_width(wrapper, 0, 0); lv_obj_set_style_border_width(wrapper, 0, 0);
uint8_t column = 0; auto* display = lv_obj_get_display(parent);
uint8_t column_limit = 10; auto horizontal_px = lv_display_get_horizontal_resolution(display);
auto vertical_px = lv_display_get_vertical_resolution(display);
bool is_landscape_display = horizontal_px > vertical_px;
int32_t x_spacing = 20; int32_t x_spacing = 20;
uint8_t column = 0;
uint8_t column_limit = is_landscape_display ? 10 : 5;
lv_obj_t* row_wrapper = createGpioRowWrapper(wrapper); lv_obj_t* row_wrapper = createGpioRowWrapper(wrapper);
lv_obj_align(row_wrapper, LV_ALIGN_TOP_MID, 0, 0); lv_obj_align(row_wrapper, LV_ALIGN_TOP_MID, 0, 0);