Add calibration methods and app (#520)
This commit is contained in:
@@ -0,0 +1,9 @@
|
||||
#pragma once
|
||||
|
||||
#include <Tactility/app/App.h>
|
||||
|
||||
namespace tt::app::touchcalibration {
|
||||
|
||||
LaunchId start();
|
||||
|
||||
} // namespace tt::app::touchcalibration
|
||||
@@ -27,6 +27,8 @@ public:
|
||||
|
||||
virtual bool supportsTouchDriver() = 0;
|
||||
|
||||
virtual bool supportsCalibration() const { return false; }
|
||||
|
||||
/** Could return nullptr if not supported */
|
||||
virtual std::shared_ptr<TouchDriver> getTouchDriver() = 0;
|
||||
};
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
namespace tt::settings::touch {
|
||||
|
||||
struct TouchCalibrationSettings {
|
||||
bool enabled = false;
|
||||
int32_t xMin = 0;
|
||||
int32_t xMax = 0;
|
||||
int32_t yMin = 0;
|
||||
int32_t yMax = 0;
|
||||
};
|
||||
|
||||
TouchCalibrationSettings getDefault();
|
||||
|
||||
bool load(TouchCalibrationSettings& settings);
|
||||
|
||||
TouchCalibrationSettings loadOrGetDefault();
|
||||
|
||||
bool save(const TouchCalibrationSettings& settings);
|
||||
|
||||
bool isValid(const TouchCalibrationSettings& settings);
|
||||
|
||||
TouchCalibrationSettings getActive();
|
||||
|
||||
void setRuntimeCalibrationEnabled(bool enabled);
|
||||
|
||||
void invalidateCache();
|
||||
|
||||
bool applyCalibration(const TouchCalibrationSettings& settings, uint16_t xMax, uint16_t yMax, uint16_t& x, uint16_t& y);
|
||||
|
||||
} // namespace tt::settings::touch
|
||||
Reference in New Issue
Block a user