init commit for fix touchscreen bad corner (#1071)

fix a rounding issue and allow more sensible touchscreen
This commit is contained in:
zxkmm 2023-05-26 15:50:32 +08:00 committed by GitHub
parent 5bdf9363e9
commit 53fcdedb88
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 10 deletions

View file

@ -34,16 +34,16 @@ Metrics calculate_metrics(const Frame& frame) {
* fast *enough*?), so maybe leave it alone at least for now.
*/
const auto x_max = frame.x.xp;
const auto x_min = frame.x.xn;
const auto x_max = frame.x.xp / 16;
const auto x_min = frame.x.xn / 16;
const auto x_range = x_max - x_min;
const float x_position = (frame.x.yp + frame.x.yn) * 0.5f;
const float x_position = (frame.x.yp / 16 + frame.x.yn / 16) * 0.5f;
const float x_norm = (x_position - x_min) / x_range;
const auto y_max = frame.y.yn;
const auto y_min = frame.y.yp;
const auto y_max = frame.y.yn / 16;
const auto y_min = frame.y.yp / 16;
const auto y_range = y_max - y_min;
const float y_position = (frame.y.xp + frame.y.xn) * 0.5f;
const float y_position = (frame.y.xp / 16 + frame.y.xn / 16) * 0.5f;
const float y_norm = (y_position - y_min) / y_range;
const auto z_max = frame.pressure.yp;