mirror of
https://github.com/ByteWelder/Tactility.git
synced 2026-04-19 01:45:06 +00:00
Stop setting display user data
This commit is contained in:
parent
51f920c6e8
commit
660074db69
@ -74,7 +74,7 @@ class DisplayApp : public App {
|
||||
auto* slider = static_cast<lv_obj_t*>(lv_event_get_target(event));
|
||||
auto* lvgl_display = lv_display_get_default();
|
||||
assert(lvgl_display != nullptr);
|
||||
auto* hal_display = static_cast<hal::display::DisplayDevice*>(lv_display_get_user_data(lvgl_display));
|
||||
auto hal_display = hal::findFirstDevice<hal::display::DisplayDevice>(hal::Device::Type::Display);
|
||||
assert(hal_display != nullptr);
|
||||
|
||||
if (hal_display->getGammaCurveCount() > 0) {
|
||||
|
||||
@ -17,7 +17,7 @@ namespace tt::lvgl {
|
||||
|
||||
#define TAG "lvgl_init"
|
||||
|
||||
static std::shared_ptr<tt::hal::display::DisplayDevice> initDisplay(const hal::Configuration& config) {
|
||||
static std::shared_ptr<hal::display::DisplayDevice> initDisplay(const hal::Configuration& config) {
|
||||
assert(config.createDisplay);
|
||||
auto display = config.createDisplay();
|
||||
assert(display != nullptr);
|
||||
@ -34,15 +34,9 @@ static std::shared_ptr<tt::hal::display::DisplayDevice> initDisplay(const hal::C
|
||||
display->setBacklightDuty(0);
|
||||
}
|
||||
|
||||
void* existing_display_user_data = lv_display_get_user_data(lvgl_display);
|
||||
// esp_lvgl_port users user_data by default, so we have to modify the source
|
||||
// this is a check for when we upgrade esp_lvgl_port and forget to modify it again
|
||||
assert(existing_display_user_data == nullptr);
|
||||
lv_display_set_user_data(lvgl_display, display.get());
|
||||
|
||||
lv_display_rotation_t rotation = app::display::getRotation();
|
||||
if (rotation != lv_disp_get_rotation(lv_disp_get_default())) {
|
||||
lv_disp_set_rotation(lv_disp_get_default(), static_cast<lv_display_rotation_t>(rotation));
|
||||
if (rotation != lv_display_get_rotation(lv_display_get_default())) {
|
||||
lv_display_set_rotation(lv_display_get_default(), rotation);
|
||||
}
|
||||
|
||||
return display;
|
||||
@ -68,7 +62,7 @@ static bool initKeyboard(const std::shared_ptr<hal::display::DisplayDevice>& dis
|
||||
if (keyboard->start(display->getLvglDisplay())) {
|
||||
lv_indev_t* keyboard_indev = keyboard->getLvglIndev();
|
||||
lv_indev_set_user_data(keyboard_indev, keyboard.get());
|
||||
tt::lvgl::hardware_keyboard_set_indev(keyboard_indev);
|
||||
hardware_keyboard_set_indev(keyboard_indev);
|
||||
TT_LOG_I(TAG, "Keyboard started");
|
||||
return true;
|
||||
} else {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user