mirror of
https://github.com/eried/portapack-mayhem.git
synced 2025-05-20 15:40:26 -04:00
Touch: Use calibration matrix.
This commit is contained in:
parent
e813db16fd
commit
7492d50f0b
2 changed files with 7 additions and 21 deletions
|
@ -111,10 +111,8 @@ void Manager::feed(const Frame& frame) {
|
|||
// TODO: Add touch pressure hysteresis?
|
||||
touch_pressure = (metrics.r < r_touch_threshold);
|
||||
if( touch_pressure ) {
|
||||
const float x = width_pixels * (metrics.x - calib_x_low) / calib_x_range;
|
||||
filter_x.feed(x);
|
||||
const float y = height_pixels * (calib_y_high - metrics.y) / calib_y_range;
|
||||
filter_y.feed(y);
|
||||
filter_x.feed(metrics.x * 1024);
|
||||
filter_y.feed(metrics.y * 1024);
|
||||
}
|
||||
} else {
|
||||
filter_x.reset();
|
||||
|
@ -146,4 +144,8 @@ void Manager::feed(const Frame& frame) {
|
|||
}
|
||||
}
|
||||
|
||||
ui::Point Manager::filtered_point() const {
|
||||
return calibration().translate({ filter_x.value(), filter_y.value() });
|
||||
}
|
||||
|
||||
} /* namespace touch */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue