Updated with emergency button and watchdog code

Dependencies:   QEI2 chair_BNO055 PID VL53L1X_Filter

Dependents:   wheelchairControlSumer2019

Revision:
30:a6659c5a8109
Parent:
29:052247c0f0e0
--- a/wheelchair.cpp	Thu Jun 27 22:54:46 2019 +0000
+++ b/wheelchair.cpp	Fri Jun 28 17:00:27 2019 +0000
@@ -57,7 +57,7 @@
 void Wheelchair::assistSafe_thread()
 {
     int ToFV[12];
-    for(int i = 0; i < 6; i++)                                              // reads from the ToF Sensors
+    for(int i = 0; i < 6; i++)                                                          // Reads from the ToF Sensors
     {
         ToFV[i] = (*(ToF+i))->readFromOneSensor();
         //out->printf("%d ", ToFV[i]);
@@ -65,6 +65,7 @@
         //out->printf("\r\n");
     int sensor1 = ToFV[1];
     int sensor4 = ToFV[5];
+    
     //out->printf("%d, %d\r\n", sensor1, sensor4);
     /*if(curr_vel < 1 &&((2 * maxDecelerationSlow*sensor1 < curr_vel*curr_vel*1000*1000 || 
     2 * maxDecelerationSlow*sensor4 < curr_vel*curr_vel*1000*1000) && 
@@ -111,17 +112,17 @@
     out->printf("on\r\n");
     imu = new chair_BNO055(pc, time);
     Wheelchair::stop();                                                                 // Wheelchair is initially stationary
-    imu->setup();                                                                       // turns on the IMU
+    imu->setup();                                                                       // Turns on the IMU
     wheelS = qeiS;                                                                      // "wheel" is called for encoder
     wheel = qei;   
-    ToF = ToFT;                                                                         // passes pointer with addresses of ToF sensors
+    ToF = ToFT;                                                                         // Passes pointer with addresses of ToF sensors
     
-    for(int i = 0; i < 12; i++)                                               // initializes the ToF Sensors
+    for(int i = 0; i < 12; i++)                                                         // Initializes the ToF Sensors
     {
         (*(ToF+i))->initReading(0x31+((0x02)*i), 50000);
     }
          
-    out->printf("wheelchair setup done \r\n");                                          // Make sure it initialized; prints in serial monitor
+    out->printf("wheelchair setup done \r\n");                                          // Make sure its initialized; prints in serial monitor
     ti = time;
     
 
@@ -254,7 +255,7 @@
     }
  
     myPID.SetTunings(5,0, 0.004);                                                       // Sets the constants for P and D
-    myPID.SetOutputLimits(0,high-def-.12);                                              //Limit is set to the differnce between def and low
+    myPID.SetOutputLimits(0,high-def-.12);                                              // Limit is set to the differnce between def and low
     myPID.SetControllerDirection(REVERSE);                                              // PID mode: Reverse
  
     /* PID stops when approaching a litte more than desired angle */