2010/1/12 Przemysław Firszt <prz...@firszt.eu>: >> weird, how comes this line was moved by the diff? > Looks like some mess in my private tree. I'll fix it as soon as we'll > get test results from Ping.
Attached patch is based on Przemo's. Not much difference from driver's perspective. However, it's a pain to see Przemo take all the joy by himself :). Ping From a36fbf77cf829920d1f877f8e7652cc7d42ee590 Mon Sep 17 00:00:00 2001 From: Ping Cheng <pi...@wacom.com> Date: Tue, 12 Jan 2010 13:34:46 -0800 Subject: [PATCH 2/2] Being part of the tilt2Rotation team For the fun of coding and hopefully, as a by-product, improving the precision Signed-off-by: Ping Cheng <pingli...@gmail.com> --- src/wcmTilt2Rotation.c | 13 ++++++------- 1 files changed, 6 insertions(+), 7 deletions(-) diff --git a/src/wcmTilt2Rotation.c b/src/wcmTilt2Rotation.c index 925bbd4..e7e69af 100644 --- a/src/wcmTilt2Rotation.c +++ b/src/wcmTilt2Rotation.c @@ -23,11 +23,6 @@ #include "xf86Wacom.h" #include <math.h> -#ifndef M_PI -#define M_PI 3.14159265358979323846 -#endif - - void wcmTilt2R(WacomDeviceStatePtr ds); /***************************************************************************** @@ -40,11 +35,15 @@ void wcmTilt2R(WacomDeviceStatePtr ds) { short tilt_x = ds->tiltx; short tilt_y = ds->tilty; + double rotation = 0.0; - ds->rotation = ABS(round(((180 * atan2(tilt_x,tilt_y)) / M_PI) - 180)); + /* other tilt-enabled devices need to apply round() after this call */ + if (tilt_x || tilt_y) + rotation = ((180.0 * atan2(-tilt_x,tilt_y)) / M_PI) + 180.0; /* Intuos4 mouse has an (180-5) offset */ - ds->rotation = ((360 - ds->rotation + 180 - 5) % 360) * 5; + ds->rotation = round((360.0 - rotation + 180.0 - 5.0) * 5.0); + ds->rotation %= 1800; if (ds->rotation >= 900) ds->rotation = 1800 - ds->rotation; -- 1.6.5.2 ------------------------------------------------------------------------------ This SF.Net email is sponsored by the Verizon Developer Community Take advantage of Verizon's best-in-class app development support A streamlined, 14 day to market process makes app distribution fast and easy Join now and get one step closer to millions of Verizon customers http://p.sf.net/sfu/verizon-dev2dev _______________________________________________ Linuxwacom-devel mailing list Linuxwacom-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel