Implement Tulip Creative Computer 4r11 (#608)
This commit is contained in:
@@ -22,12 +22,15 @@
|
||||
#include <Tactility/service/ServiceRegistration.h>
|
||||
#include <Tactility/service/audio/Audio.h>
|
||||
#include <Tactility/settings/TimePrivate.h>
|
||||
#include <Tactility/settings/TouchCalibrationSettings.h>
|
||||
|
||||
#include <gps/module.h>
|
||||
#include <gps_generic/module.h>
|
||||
#include <gps_meshtastic/module.h>
|
||||
|
||||
#include <crypt/module.h>
|
||||
#include <lvgl/devices/pointer.h>
|
||||
#include <lvgl/lvgl.h>
|
||||
#include <lvgl/module.h>
|
||||
#include <lvgl/widgets/toolbar.h>
|
||||
|
||||
@@ -360,6 +363,33 @@ static void stopAppFromToolbar(lv_event_t*) {
|
||||
app::stop();
|
||||
}
|
||||
|
||||
#ifdef CONFIG_TT_TOUCH_CALIBRATION_SUPPORTED
|
||||
|
||||
// Applies the calibration persisted by the touch calibration app to the live pointer indev.
|
||||
// lvgl_devices_attach() runs before onLvglStarted(), so the default indev already exists here.
|
||||
static void applySavedTouchCalibration() {
|
||||
settings::touch::TouchCalibrationSettings settings = settings::touch::loadOrGetDefault();
|
||||
if (!settings.enabled || !settings::touch::isValid(settings)) {
|
||||
return;
|
||||
}
|
||||
|
||||
LvglPointerCalibration calibration = {
|
||||
.x_min = settings.xMin,
|
||||
.x_max = settings.xMax,
|
||||
.y_min = settings.yMin,
|
||||
.y_max = settings.yMax,
|
||||
};
|
||||
|
||||
lvgl_lock();
|
||||
auto* indev = lvgl_pointer_get_default();
|
||||
if (indev != nullptr) {
|
||||
lvgl_pointer_set_calibration(indev, &calibration);
|
||||
}
|
||||
lvgl_unlock();
|
||||
}
|
||||
|
||||
#endif // CONFIG_TT_TOUCH_CALIBRATION_SUPPORTED
|
||||
|
||||
static void onLvglStarted() {
|
||||
ToolbarConfig toolbar_config = { .nav_action_callback = stopAppFromToolbar };
|
||||
lvgl_toolbar_configure(&toolbar_config);
|
||||
@@ -379,6 +409,10 @@ static void onLvglStarted() {
|
||||
|
||||
lvgl::initTrackball();
|
||||
|
||||
#ifdef CONFIG_TT_TOUCH_CALIBRATION_SUPPORTED
|
||||
applySavedTouchCalibration();
|
||||
#endif
|
||||
|
||||
memory_print_stats();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user