diff --git a/Documentation/ideas.md b/Documentation/ideas.md index 6a715193..2c378370 100644 --- a/Documentation/ideas.md +++ b/Documentation/ideas.md @@ -22,7 +22,6 @@ - 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. - Localisation of texts (load in boot app from sd?) -- Portrait support for GPIO app - Explore LVGL9's FreeRTOS functionality - 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) diff --git a/Tactility/Source/app/display/Display.cpp b/Tactility/Source/app/display/Display.cpp index cc85d73d..e0bb3cb6 100644 --- a/Tactility/Source/app/display/Display.cpp +++ b/Tactility/Source/app/display/Display.cpp @@ -94,7 +94,7 @@ static void onShow(AppContext& app, lv_obj_t* parent) { lv_slider_set_range(brightness_slider, 0, 255); 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); auto* hal_display = (tt::hal::Display*)lv_display_get_user_data(lvgl_display); tt_assert(hal_display != nullptr); diff --git a/Tactility/Source/app/gpio/Gpio.cpp b/Tactility/Source/app/gpio/Gpio.cpp index 43fbe713..19225cfa 100644 --- a/Tactility/Source/app/gpio/Gpio.cpp +++ b/Tactility/Source/app/gpio/Gpio.cpp @@ -127,9 +127,14 @@ void Gpio::onShow(AppContext& app, lv_obj_t* parent) { lv_obj_set_flex_grow(wrapper, 1); lv_obj_set_style_border_width(wrapper, 0, 0); - uint8_t column = 0; - uint8_t column_limit = 10; + auto* display = lv_obj_get_display(parent); + 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; + uint8_t column = 0; + uint8_t column_limit = is_landscape_display ? 10 : 5; lv_obj_t* row_wrapper = createGpioRowWrapper(wrapper); lv_obj_align(row_wrapper, LV_ALIGN_TOP_MID, 0, 0);