diff Joystick.h @ 1:fd012dcc048d

added isCentered, dvx, dvy
author ark
date 2017-01-29 13:59 +0100
parents f31cf3175189
children 395297edda26
line wrap: on
line diff
--- a/Joystick.h	Thu Jan 26 00:48:42 2017 +0100
+++ b/Joystick.h	Sun Jan 29 13:59:21 2017 +0100
@@ -25,6 +25,12 @@
         float vx;
         // if calibrated, current vector, y component
         float vy;
+        // flag, if true joystick is considered centered/idle
+        bool isCentered;
+        // "digital" vector, x
+        int dvx;
+        // "digital" vector, y
+        int dvy;
 
         // flag, if true joystick is calibrated.
         bool isCalibrated;
@@ -34,12 +40,26 @@
         // calibrated center of y axis
         int centerY;
 
-        /** center deadzone radius. if the joystick is not calibrated,
+        /** 
+         * center deadzone radius, if the joystick is not calibrated.
+         *
          * positions within this distance from the center are considered in the
          * center.
          */
-        const int CENTER_DEADZONE = 50;
+        const int CENTER_DEADZONE_UNCALIBRATED = 50;
         
+        /** 
+         * center deadzone radius, if the joystick is calibrated.
+         * positions within this distance from the center are considered in the
+         * center.
+         */
+        const int CENTER_DEADZONE_CALIBRATED = 5;
+
+        /** 
+         * center radius, for digital interpretation.
+         */
+        const int CENTER_RADIUS_DIGITAL = 100;
+
         /**
             create an uninitialised Joystick.
             setup() must be called after this to make it usable.