File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -14,7 +14,8 @@ framework = arduino
1414board = atmega328p
1515build_flags =
1616 -D VERBOSE
17- -D CHIPSAT_ID =2
17+ -D WIRE_TIMEOUT
18+ -D CHIPSAT_ID =3
1819upload_protocol = custom
1920upload_speed = 19200
20- upload_command = avrdude -C /Users/camerongoddard/Library/Arduino15/packages/arduino/tools/avrdude/6.3.0-arduino17/etc/avrdude.conf -P /dev/cu.usbmodem11301 -b 19200 -v -V -p atmega328p -c stk500v1 $UPLOAD_FLAGS -U flash:w:$SOURCE:i
21+ upload_command = avrdude -C /Users/camerongoddard/Library/Arduino15/packages/arduino/tools/avrdude/6.3.0-arduino17/etc/avrdude.conf -P /dev/cu.usbmodem211301 -b 19200 -v -V -p atmega328p -c stk500v1 $UPLOAD_FLAGS -U flash:w:$SOURCE:i
Original file line number Diff line number Diff line change 11#include " IMUMonitor.hpp"
22
3- IMUMonitor::IMUMonitor ()
3+ IMUMonitor::IMUMonitor (): imu(Wire)
44{
55}
66
@@ -10,7 +10,7 @@ void IMUMonitor::execute()
1010#ifdef VERBOSE
1111 Serial.println (F (" Turning on IMU" ));
1212#endif
13- if (!IMU .begin ()) {
13+ if (!imu .begin ()) {
1414#ifdef VERBOSE
1515 Serial.println (F (" IMU failed" ));
1616#endif
@@ -26,22 +26,22 @@ void IMUMonitor::execute()
2626void IMUMonitor::capture_imu_values ()
2727{
2828 // Check if the gyroscope, accelerometer, or magnetometer has new data available
29- if (IMU .gyroscopeAvailable ()) {
30- IMU .readGyroscope (
29+ if (imu .gyroscopeAvailable ()) {
30+ imu .readGyroscope (
3131 sfr::imu::gyro_x,
3232 sfr::imu::gyro_y,
3333 sfr::imu::gyro_z); // Data is in degrees/s
3434 }
3535
36- if (IMU .accelerationAvailable ()) {
37- IMU .readAcceleration (
36+ if (imu .accelerationAvailable ()) {
37+ imu .readAcceleration (
3838 sfr::imu::acc_x,
3939 sfr::imu::acc_y,
4040 sfr::imu::acc_z); // Data is in m/s^2
4141 }
4242
43- if (IMU .magneticFieldAvailable ()) {
44- IMU .readMagneticField (
43+ if (imu .magneticFieldAvailable ()) {
44+ imu .readMagneticField (
4545 sfr::imu::mag_x,
4646 sfr::imu::mag_y,
4747 sfr::imu::mag_z); // Data in uT
Original file line number Diff line number Diff line change @@ -19,6 +19,8 @@ class IMUMonitor
1919 * @brief Reads IMU data
2020 */
2121 void capture_imu_values ();
22+
23+ LSM9DS1Class imu;
2224};
2325
2426#endif
Original file line number Diff line number Diff line change 22
33TempMonitor::TempMonitor ()
44{
5- // Init I2C communication as master
6- Wire.begin ();
75}
86
97void TempMonitor::execute ()
Original file line number Diff line number Diff line change @@ -12,6 +12,10 @@ void setup()
1212 Serial.begin (9600 );
1313#endif
1414
15+ // Set I2C transaction timeout
16+ Wire.begin ();
17+ Wire.setWireTimeout (3000 );
18+
1519 sfr::gps::boot_time = millis ();
1620
1721 // Set ChipSat LED high for debugging
You can’t perform that action at this time.
0 commit comments