diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/touch-caps.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/src/touch-caps.c b/src/touch-caps.c index 50306e0..7f243c5 100644 --- a/src/touch-caps.c +++ b/src/touch-caps.c | |||
| @@ -49,10 +49,10 @@ void touch_caps_init(struct touch_dev *dev) | |||
| 49 | caps->min_y = 0; | 49 | caps->min_y = 0; |
| 50 | caps->max_y = 768; | 50 | caps->max_y = 768; |
| 51 | } | 51 | } |
| 52 | if (caps->min_orient == caps->max_orient) { | 52 | if (caps->min_orient == caps->max_orient) |
| 53 | caps->min_orient = 0; | ||
| 54 | caps->max_orient = 1; | 53 | caps->max_orient = 1; |
| 55 | } | 54 | if (caps->min_orient + caps->max_orient != 0) |
| 55 | caps->min_orient = -caps->max_orient; | ||
| 56 | if (caps->min_press == caps->max_press) { | 56 | if (caps->min_press == caps->max_press) { |
| 57 | caps->min_press = 0; | 57 | caps->min_press = 0; |
| 58 | caps->max_press = 256; | 58 | caps->max_press = 256; |
| @@ -62,8 +62,7 @@ void touch_caps_init(struct touch_dev *dev) | |||
| 62 | float touch_angle(const struct touch_dev *dev, int orient) | 62 | float touch_angle(const struct touch_dev *dev, int orient) |
| 63 | { | 63 | { |
| 64 | const struct touch_caps *caps = &dev->caps; | 64 | const struct touch_caps *caps = &dev->caps; |
| 65 | double div = caps->max_orient - caps->min_orient; | 65 | return orient / caps->max_orient * M_PI_2; |
| 66 | return ((orient - caps->min_orient) / div - 0.5) * M_PI; | ||
| 67 | } | 66 | } |
| 68 | 67 | ||
| 69 | float touch_pressure(const struct touch_dev *dev, int press) | 68 | float touch_pressure(const struct touch_dev *dev, int press) |
