working commands. singleton deleted

Dependents:   GonioTrainer

Revision:
1:fd4c0e2decb8
Parent:
0:e188325211af
Child:
2:c9e47ac47edb
--- a/ReadCommand.cpp	Thu Jun 04 10:56:18 2015 +0000
+++ b/ReadCommand.cpp	Sun Jun 07 14:11:14 2015 +0000
@@ -1,4 +1,5 @@
 #include "ReadCommand.h"
+#include "OfflineCommand.h"
 
 ReadCommand::ReadCommand()
 {
@@ -22,6 +23,7 @@
 
 void ReadCommand::execute()
 {
+    //Read has nothing to do with the IMU interrupt
 }
 
 void ReadCommand::button()
@@ -37,30 +39,29 @@
 void ReadCommand::readFromMemory()
 {
     float angle;
-    int16_t gyro;
-
-    this->storage->read(addr);
+    float gyro;
 
-    angle_H= this->storage->readData();
-    angle_L = this->storage->readData();
-    imu_H = this->storage->readData();
-    imu_L = this->storage->readData();
-
-    //for(int i = 0; i <100; i++) {
-    do{
-        angle = ((angle_H << 8) + angle_L) * 0.087912087;
-        gyro = ((imu_H << 8) + imu_L)/ 200;
+    for(int i = 0; i <= OfflineCommand::getLastAddress(); i = i + 4 ) {
+        this->storage->read(i);
 
         angle_H= this->storage->readData();
         angle_L = this->storage->readData();
         imu_H = this->storage->readData();
         imu_L = this->storage->readData();
+
+        this->storage->endAction();
+
+        angle = ((angle_H << 8) + angle_L) * 0.087912087;
         
         
-        printf("Memory: angle = %.2f, gyroX =  %d\n", angle, gyro);
-    } while(angle_H != 0xFF);
-    
-    this->storage->endAction();
+        gyro = ((float)((imu_H << 8) + imu_L)) / 200;
+        //float xgyro = ((float)sensors->getGyroX())/200;
+     
+
+        printf("Memory: angle = %.2f, gyroX =  %.4f\n", angle, gyro);
+    }
+
+
     printf("DONE!\n");
 }