Touch: Use calibration matrix.

This commit is contained in:
Jared Boone
2016-07-27 14:08:02 -07:00
parent e813db16fd
commit 7492d50f0b
2 changed files with 7 additions and 21 deletions

View File

@@ -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);