Ghost Mouse / Mbed 2 deprecated ghost_mouse

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
jennabarton
Date:
Wed Apr 05 01:49:16 2017 +0000
Parent:
16:6b4a71e6f75a
Child:
18:d7a681bc22e5
Commit message:
working x-y;

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/main.cpp	Wed Apr 05 01:35:55 2017 +0000
+++ b/main.cpp	Wed Apr 05 01:49:16 2017 +0000
@@ -51,7 +51,7 @@
 
 //movement
 int deadzone = 1;
-int mouseMoveMult = 40;
+int mouseMoveMult = 20;
 
 //counts for clicks
 int clickDeadzone = 10;
@@ -149,8 +149,8 @@
     //look at delta btwn prev val and current
     //TODO: moving average
     if((prevx != 1023 || prevy != 1023) && (currx != 1023 && curry != 1023)){
-        int diffX = currx - prevx;
-        int diffY = -1*(curry - prevy);
+        short diffX = currx - prevx;
+        short diffY = -1*(curry - prevy);
     
         //fix diffX
         if(diffX > deadzone){
@@ -163,7 +163,7 @@
         //fix diffY
         if(diffY > deadzone){
             diffY -= deadzone;
-        } else if (diffX < -1*deadzone){
+        } else if (diffY < -1*deadzone){
             diffY += deadzone;
         } else{
             diffY = 0;
@@ -176,7 +176,7 @@
         updatex[0] = diffX;
         updatey[0] = diffY;
         
-        
+       
 //        pc.printf("updating x to : %d", diffX);
 //        pc.printf("\t updating y to : %d \n", diffY);