diff --git a/include/LoadCells.h b/include/LoadCells.h index 02dcc09..318f512 100644 --- a/include/LoadCells.h +++ b/include/LoadCells.h @@ -1,5 +1,6 @@ #include +#pragma once struct LoadCells { HX711 lc0; diff --git a/include/teensy.h b/include/teensy.h index ad34b43..e987d8c 100644 --- a/include/teensy.h +++ b/include/teensy.h @@ -1,3 +1,4 @@ +#include "LoadCells.h" #include "Vehicle.h" #include #include @@ -65,7 +66,7 @@ void initFile() { // File Header dataFile.println( "t,x,y,z,vx,vy,vz,ax,ay,az,yaw,pitch,roll,yawdot,pitchdot,rolldot," - "Servo1,Servo2,thrustFiring,thrust,simResponse,l0,l1,l2,l3"); + "Servo1,Servo2,thrustFiring,thrust,simResponse,lc0,lc1,lc2,lc3"); } void thrustInfo(Vehicle &State) { @@ -115,7 +116,7 @@ void processTVC(Vehicle &State, LoadCells &loadCells) { State.F = sqrt(pow(State.Fx, 2) + pow(State.Fy, 2) + pow(State.Fz, 2)); } -void write2CSV(Vehicle &State, double a, double b, double c, double d) { +void write2CSV(Vehicle &State, LoadCells &loadCells) { dataFile.print(String(State.time, 5)); dataFile.print(","); @@ -167,13 +168,13 @@ void write2CSV(Vehicle &State, double a, double b, double c, double d) { dataFile.print(String(State.stepDuration, 5)); dataFile.print(","); - dataFile.print(String(a, 5)); + dataFile.print(String(loadCells.lc0Val, 5)); dataFile.print(","); - dataFile.print(String(b, 5)); + dataFile.print(String(loadCells.lc1Val, 5)); dataFile.print(","); - dataFile.print(String(c, 5)); + dataFile.print(String(loadCells.lc2Val, 5)); dataFile.print(","); - dataFile.print(String(d, 5)); + dataFile.print(String(loadCells.lc3Val, 5)); dataFile.print("\n"); } diff --git a/src/main.cpp b/src/main.cpp index 5e9abd7..d4828fe 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -121,8 +121,7 @@ void loop() { processTVC(State, loadCells); State.stepDuration = micros() - last; - write2CSV(State, loadCells.lc0Val, loadCells.lc1Val, loadCells.lc2Val, - loadCells.lc3Val); + write2CSV(State, loadCells); // Set "prev" values for next timestep PrevState = State;