aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJamie Sanson <jamie.sanson@outlook.com>2016-06-12 19:24:45 +1200
committerJamie Sanson <jamie.sanson@outlook.com>2016-06-12 19:24:45 +1200
commit9366b5c0da0d4a1a7f60d7fe52a14d8e05f0a5a9 (patch)
tree680c13ab96c1f11aa2fbf173ea9cf8bf3f1d8ec7
parenteb89c6b37f76fc2b68420fcf190b4a42eabef9a8 (diff)
downloadmetis-1-onboard-altitude-logging.tar.gz
metis-1-onboard-altitude-logging.tar.bz2
metis-1-onboard-altitude-logging.zip
Fix formatting and correct chipselectaltitude-logging
-rw-r--r--test_flight_basic_logging/libraries/MPU9250_helper/MPU9250_helper.cpp10
-rw-r--r--test_flight_basic_logging/test_flight_basic_logging.ino9
2 files changed, 10 insertions, 9 deletions
diff --git a/test_flight_basic_logging/libraries/MPU9250_helper/MPU9250_helper.cpp b/test_flight_basic_logging/libraries/MPU9250_helper/MPU9250_helper.cpp
index 35fbb8c..0668469 100644
--- a/test_flight_basic_logging/libraries/MPU9250_helper/MPU9250_helper.cpp
+++ b/test_flight_basic_logging/libraries/MPU9250_helper/MPU9250_helper.cpp
@@ -312,8 +312,8 @@ void MPU9250_helper::readMagData(int16_t * destination)
void MPU9250_helper::resetMS5637()
{
Wire1.beginTransmission(MS5637_ADDRESS); // Initialize the Tx buffer
- Wire1.write(MS5637_RESET); // Put reset command in Tx buffer
- Wire1.endTransmission(); // Send the Tx buffer
+ Wire1.write(MS5637_RESET); // Put reset command in Tx buffer
+ Wire1.endTransmission(); // Send the Tx buffer
}
void MPU9250_helper::readPromMS5637(uint16_t * destination)
@@ -323,13 +323,13 @@ void MPU9250_helper::readPromMS5637(uint16_t * destination)
Wire1.beginTransmission(MS5637_ADDRESS); // Initialize the Tx buffer
Wire1.write(0xA0 | ii << 1); // Put PROM address in Tx buffer
Wire1.endTransmission(I2C_NOSTOP); // Send the Tx buffer, but send a restart to keep connection alive
- uint8_t i = 0;
+ uint8_t i = 0;
Wire1.requestFrom(MS5637_ADDRESS, 2); // Read two bytes from slave PROM address
- while (Wire1.available()) {
+ while (Wire1.available()) {
data[i++] = Wire1.read(); } // Put read results in the Rx buffer
destination[ii] = (uint16_t) (((uint16_t) data[0] << 8) | data[1]); // construct PROM data for return to main program
+ }
}
-}
uint32_t MPU9250_helper::MS5637Read(uint8_t CMD, uint8_t OSR)
{
diff --git a/test_flight_basic_logging/test_flight_basic_logging.ino b/test_flight_basic_logging/test_flight_basic_logging.ino
index cbeb28c..dc6edb8 100644
--- a/test_flight_basic_logging/test_flight_basic_logging.ino
+++ b/test_flight_basic_logging/test_flight_basic_logging.ino
@@ -25,7 +25,6 @@
By Jamie Sanson
*/
-
#include <i2c_t3.h>
#include <SD.h>
#include <SPI.h>
@@ -37,8 +36,10 @@ int8_t Ascale = AFS_16G;
int8_t Gscale = GFS_250DPS;
int8_t Mscale = MFS_16BITS; // Choose either 14-bit or 16-bit magnetometer resolution
int8_t Mmode = 0x02; // 2 for 8Hz, 6 for 100Hz continuous
+
boolean serialDebug = true;
-const int sdChipSelect = 20;
+
+const int sdChipSelect = 10;
// END REGION
// REGION SENSOR FIELDS
@@ -91,8 +92,8 @@ void setup() {
printData("ACCEL_X,ACCEL_Y,ACCEL_Z,GYRO_X,GYRO_y,GYRO_Z,MAG_X,MAG_Y,MAG_Z,ALT,TIME,\n");
}
-void loop() {
- helper.readAccelData(accelCount); // Read the x/y/z adc values
+void loop() {
+ helper.readAccelData(accelCount);
helper.readGyroData(gyroCount);
helper.readMagData(magCount);