Migrate ES3C35P to latest main firmware
This commit is contained in:
@@ -10,6 +10,7 @@
|
||||
#ifdef ESP_PLATFORM
|
||||
#include <Tactility/service/displayidle/DisplayIdleService.h>
|
||||
#endif
|
||||
#include <Tactility/lvgl/Lvgl.h>
|
||||
#include <Tactility/settings/DisplaySettings.h>
|
||||
|
||||
#include <app/event.h>
|
||||
@@ -90,6 +91,21 @@ void onOrientationSet(lv_event_t* event) {
|
||||
}
|
||||
}
|
||||
|
||||
void onFontSizeChanged(lv_event_t* event) {
|
||||
auto* ctx = static_cast<Context*>(lv_event_get_user_data(event));
|
||||
auto* dropdown = static_cast<lv_obj_t*>(lv_event_get_target(event));
|
||||
uint32_t selected_index = lv_dropdown_get_selected(dropdown);
|
||||
if (selected_index >= static_cast<uint32_t>(settings::display::FontSize::Count)) {
|
||||
return;
|
||||
}
|
||||
auto selected_size = static_cast<settings::display::FontSize>(selected_index);
|
||||
if (selected_size != ctx->displaySettings.fontSize) {
|
||||
ctx->displaySettings.fontSize = selected_size;
|
||||
ctx->displaySettingsUpdated = true;
|
||||
lvgl::applyFontSize(selected_size);
|
||||
}
|
||||
}
|
||||
|
||||
void onTimeoutSwitch(lv_event_t* event) {
|
||||
auto* ctx = static_cast<Context*>(lv_event_get_user_data(event));
|
||||
auto* sw = static_cast<lv_obj_t*>(lv_event_get_target(event));
|
||||
@@ -208,6 +224,23 @@ void createWidgets(lv_obj_t* parent, void* userData) {
|
||||
// Set the dropdown to match current orientation enum
|
||||
lv_dropdown_set_selected(orientation_dropdown, static_cast<uint16_t>(ctx->displaySettings.orientation));
|
||||
|
||||
// Font size
|
||||
|
||||
auto* font_size_wrapper = lv_obj_create(main_wrapper);
|
||||
lv_obj_set_size(font_size_wrapper, LV_PCT(100), LV_SIZE_CONTENT);
|
||||
lv_obj_set_style_pad_all(font_size_wrapper, 0, LV_STATE_DEFAULT);
|
||||
lv_obj_set_style_border_width(font_size_wrapper, 0, LV_STATE_DEFAULT);
|
||||
|
||||
auto* font_size_label = lv_label_create(font_size_wrapper);
|
||||
lv_label_set_text(font_size_label, "Font size");
|
||||
lv_obj_align(font_size_label, LV_ALIGN_LEFT_MID, 0, 0);
|
||||
|
||||
auto* font_size_dropdown = lv_dropdown_create(font_size_wrapper);
|
||||
lv_dropdown_set_options(font_size_dropdown, "Small\nDefault\nLarge");
|
||||
lv_obj_align(font_size_dropdown, LV_ALIGN_RIGHT_MID, 0, 0);
|
||||
lv_obj_add_event_cb(font_size_dropdown, onFontSizeChanged, LV_EVENT_VALUE_CHANGED, ctx);
|
||||
lv_dropdown_set_selected(font_size_dropdown, static_cast<uint16_t>(ctx->displaySettings.fontSize));
|
||||
|
||||
// Screen timeout
|
||||
// Note: DisplayIdleService doesn't act on these settings for kernel-driver displays yet
|
||||
// (it only looks up the deprecated tt::hal::display::DisplayDevice), so these currently
|
||||
@@ -274,7 +307,7 @@ void createWidgets(lv_obj_t* parent, void* userData) {
|
||||
|
||||
ctx->screensaverDropdown = lv_dropdown_create(screensaver_wrapper);
|
||||
// Note: order correlates with settings::display::ScreensaverType enum order
|
||||
lv_dropdown_set_options(ctx->screensaverDropdown, "None\nBouncing Balls\nMystify\nMatrix Rain\nStackChan");
|
||||
lv_dropdown_set_options(ctx->screensaverDropdown, "None\nBouncing Balls\nMystify\nMatrix Rain\nStackChan\nMCP Screen");
|
||||
lv_obj_align(ctx->screensaverDropdown, LV_ALIGN_RIGHT_MID, 0, 0);
|
||||
lv_obj_add_event_cb(ctx->screensaverDropdown, onScreensaverChanged, LV_EVENT_VALUE_CHANGED, ctx);
|
||||
lv_dropdown_set_selected(ctx->screensaverDropdown, static_cast<uint16_t>(ctx->displaySettings.screensaverType));
|
||||
|
||||
Reference in New Issue
Block a user