mirror of
https://github.com/eried/portapack-mayhem.git
synced 2025-08-15 01:45:46 -04:00
Touch: Use calibration matrix.
This commit is contained in:
parent
e813db16fd
commit
7492d50f0b
2 changed files with 7 additions and 21 deletions
|
@ -220,21 +220,10 @@ private:
|
|||
TouchDetected,
|
||||
};
|
||||
|
||||
static constexpr uint32_t width_pixels = 240;
|
||||
static constexpr uint32_t height_pixels = 320;
|
||||
|
||||
static constexpr float r_touch_threshold = 0x1000;
|
||||
static constexpr size_t touch_count_threshold { 4 };
|
||||
static constexpr uint32_t touch_stable_bound { 4 };
|
||||
|
||||
static constexpr float calib_x_low = 0.07f;
|
||||
static constexpr float calib_x_high = 0.94f;
|
||||
static constexpr float calib_x_range = calib_x_high - calib_x_low;
|
||||
|
||||
static constexpr float calib_y_low = 0.04f;
|
||||
static constexpr float calib_y_high = 0.91f;
|
||||
static constexpr float calib_y_range = calib_y_high - calib_y_low;
|
||||
|
||||
// Ensure filter length is equal or less than touch_count_threshold,
|
||||
// or coordinates from the last touch will be in the initial averages.
|
||||
Filter<touch_count_threshold> filter_x;
|
||||
|
@ -249,12 +238,7 @@ private:
|
|||
&& filter_y.stable(touch_stable_bound);
|
||||
}
|
||||
|
||||
ui::Point filtered_point() const {
|
||||
return {
|
||||
static_cast<ui::Coord>(filter_x.value()),
|
||||
static_cast<ui::Coord>(filter_y.value())
|
||||
};
|
||||
}
|
||||
ui::Point filtered_point() const;
|
||||
|
||||
void touch_started() {
|
||||
fire_event(ui::TouchEvent::Type::Start);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue