Mouse code for the MacroRat

Dependencies:   ITG3200 QEI

Files at this revision

API Documentation at this revision

Comitter:
kyleliangus
Date:
Sat May 27 00:41:19 2017 +0000
Parent:
34:69342782fb68
Child:
36:9c4cc9944b69
Commit message:
4th Dip switch down to move

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
main.h Show annotated file Show diff for this revision Revisions of this file
--- a/main.cpp	Fri May 26 17:21:04 2017 +0000
+++ b/main.cpp	Sat May 27 00:41:19 2017 +0000
@@ -39,7 +39,7 @@
 */
 
 #define IP_CONSTANT 1.93
-#define II_CONSTANT 0.00001
+#define II_CONSTANT 0.0001
 #define ID_CONSTANT 0.175
 
 void pidOnEncoders();
@@ -857,6 +857,14 @@
     dipButton3.fall(&disableButton3);
     dipButton4.fall(&disableButton4);
 
+    serial.printf("%d, %d, %d\n", dipFlags, BUTTON1_FLAG, dipFlags & BUTTON1_FLAG);
+    while( (dipFlags & BUTTON4_FLAG) == 0 )
+    {
+        // do nothing until ready
+    }
+    serial.printf("%d, %d, %d\n", dipFlags, BUTTON1_FLAG, dipFlags & BUTTON1_FLAG);
+    wait( 2 );
+
     // init the wall, and mouse loc arrays:
     wallArray[MAZE_LEN - 1 - mouseY][mouseX] = 0xE;
     visitedCells[MAZE_LEN - 1 - mouseY][mouseX] = 1;
--- a/main.h	Fri May 26 17:21:04 2017 +0000
+++ b/main.h	Sat May 27 00:41:19 2017 +0000
@@ -49,7 +49,7 @@
 */
 
 // Doing DEBUGGING
-#define DEBUGGING 1
+#define DEBUGGING 0
 Serial serial(PC_6, PC_7);
 
 // Gyro
@@ -84,7 +84,7 @@
 void changeManhattanDistance(bool headCenter);
 bool hasVisited(int x, int y);
 
-int dipFlags = 0;
+volatile int dipFlags = 0;
 #define BUTTON1_FLAG 0x1
 #define BUTTON2_FLAG 0x2
 #define BUTTON3_FLAG 0x4