Here

Dependencies:   Hexi_KW40Z Hexi_OLED_SSD1351 nRF24L01 FXOS8700

Revision:
21:6d54edeb2f33
Parent:
19:195a0891e8e9
--- a/main.cpp	Wed Apr 19 17:11:00 2017 +0000
+++ b/main.cpp	Wed Apr 26 16:41:30 2017 +0000
@@ -123,10 +123,10 @@
             } else {
                 screenNum--;
             }
-        } else {
-            StartHaptic();
+        } else if(alert == false) {
             screenNum = 5;
         }
+        StartHaptic();
     }
 }
 
@@ -173,6 +173,9 @@
 int main()
 {
     accel.accel_config();
+    
+    oled.FillScreen(COLOR_BLACK);
+    
 
     // Get & set OLED Class Default Text Properties
     oled.GetTextProperties(&textProperties);
@@ -193,10 +196,11 @@
 
     //Change font color to white
     textProperties.fontColor   = COLOR_WHITE;
-    textProperties.alignParam = OLED_TEXT_ALIGN_CENTER;
+    textProperties.alignParam = OLED_TEXT_ALIGN_RIGHT;
 
     txThread.start(txTask); //Start transmitting Sensor Tag Data
 
+
     while (true) {
         accel.acquire_accel_data_g(accel_data);
         accel_rms = sqrt(((accel_data[0]*accel_data[0])+(accel_data[1]*accel_data[1])+(accel_data[2]*accel_data[2]))/3);
@@ -204,11 +208,13 @@
         y = accel_data[1] *10000;
         z = accel_data[2] *10000;
 
+
+
         // Check screen, alert and num values
         //printf("Screen = %i Num = %i alert = %d\n\r",screenNum,num,alert);
         // Check Fall Data
         //printf("%4.4f\n\r",accel_rms);
-        if(accel_rms*10 > 12.4) { //Triggers AlertBMP if fall is detected
+        if(accel_rms*10 > 14.0 && alert == false) { //Triggers AlertBMP if fall is detected
             oled.DrawImage(AlertBMP,0,0);
             previous = screenNum;//Allows to return to previous screen.
             num = screenNum - 1;//^
@@ -220,6 +226,8 @@
         //Trigger Blinking Red LED when alarm is set off
         if(alert == true) {
             redLed = !redLed;
+            hapticTimer.start(30);
+            haptic = 1;
         }
         if((screenNum != num && alert == false) || screenNum == 4) {
             redLed = 1;