app critics will say it's money, cash, toes

Revision:
6:887df9bbe705
Parent:
5:c75ea8bfa9fb
Child:
7:9e2172e6550a
--- a/source/main.cpp	Tue Oct 30 14:54:24 2018 +0000
+++ b/source/main.cpp	Tue Oct 30 17:20:10 2018 +0000
@@ -43,21 +43,27 @@
 }
 
 void updateSensorValue() {
-       
     mpu.readAccelData(destination);
     
-    int16_t acc_x = destination[0];
-    uint8_t acc_y = destination[1];
-    uint8_t acc_z = destination[2];
+    int16_t acc_x = destination[0] / 1000.0;
+    int16_t acc_y = destination[1] / 1000.0;
+    int16_t acc_z = destination[2] / 1000.0;
     
-    uint8_t sqr_acc_x = acc_x*acc_x;
-    uint8_t sqr_acc_y = acc_y*acc_y;
-    uint8_t sqr_acc_z = acc_z*acc_z;
+    int16_t sqr_acc_x = acc_x*acc_x;
+    int16_t sqr_acc_y = acc_y*acc_y;
+    int16_t sqr_acc_z = acc_z*acc_z;
+    printf("sqr_acc_x: " );
+    printf("%d\n", sqr_acc_x);
     
     double sum_acc = sqr_acc_x + sqr_acc_y + sqr_acc_z;
+    printf("sum_acc: " );
+    printf("%f\n", sum_acc);
     
-    uint8_t value = sqrt(sum_acc);
+    int16_t value = sqrt(sum_acc);
     hrmCounter = acc_x;
+    printf("value: " );
+    printf("%d\n", value);
+    /* printf("%u\n", (unsigned int)acc_x);*/
 
     hrService->updateHeartRate(hrmCounter);
 }
@@ -65,7 +71,6 @@
 void blinkCallback(void)
 {
     led1 = !led1; /* Do blinky on LED1 while we're waiting for BLE events */
-
     BLE &ble = BLE::Instance();
     if (ble.gap().getState().connected) {
         eventQueue.call(updateSensorValue);
@@ -125,7 +130,9 @@
     ble.gap().setAdvertisingInterval(1000); /* 1000ms */
     ble.gap().startAdvertising();
 
+
     printMacAddress();
+
 }
 
 void scheduleBleEventsProcessing(BLE::OnEventsToProcessCallbackContext* context) {