mirror of
https://github.com/portapack-mayhem/mayhem-firmware.git
synced 2026-08-19 06:03:59 +00:00
Touch: Use calibration matrix.
This commit is contained in:
@@ -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 */
|
||||
|
||||
Reference in New Issue
Block a user