diff --git a/.gitignore b/.gitignore index c601e49..c095636 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,10 @@ *.exe *.csv output -public \ No newline at end of file +public + +.pio +.vscode/.browse.c_cpp.db* +.vscode/c_cpp_properties.json +.vscode/launch.json +.vscode/ipch diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 0d580c4..2a5a6be 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -13,7 +13,7 @@ build: stage: build script: - mkdir public - - g++ ./src/main.cpp -I include -o ./public/sim.out + - g++ ./src/main.cpp -I include -o ./public/sim.out -D NATIVE -Wall - ./public/sim.out - mv simOut.csv public artifacts: diff --git a/.vscode/extensions.json b/.vscode/extensions.json index 986e8c3..78f8c5e 100644 --- a/.vscode/extensions.json +++ b/.vscode/extensions.json @@ -2,6 +2,7 @@ "recommendations": [ "ms-vscode.cpptools", "wayou.vscode-todo-highlight", - "usernamehw.errorlens" + "usernamehw.errorlens", + "platformio.platformio-ide" ] } \ No newline at end of file diff --git a/include/sim.h b/include/sim.h index dd8cec0..0904153 100644 --- a/include/sim.h +++ b/include/sim.h @@ -36,6 +36,8 @@ void burnStartTimeCalc(Vehicle &State) { else if ((i > 3.382) && (i < 3.46)) thrust = -195.78 * i + 675.11; + else + thrust = 0; velocity = (((thrust / mass) + g) * dt) + velocity; h = (((thrust / mass) + g) * dt) + h; diff --git a/include/teensy.h b/include/teensy.h index 8e15ad9..7de4d12 100644 --- a/include/teensy.h +++ b/include/teensy.h @@ -2,10 +2,12 @@ #include +void thrustInfo(struct Vehicle &); +void processTVC(struct Vehicle &); +void write2CSV(struct outVector &, struct Vehicle &); +void printSimResults(struct Vehicle &); + double loadCellCalibrate(); -void thrustInfo(); -void processTVC(); -void write2csv(); double loadCellCalibrate() { // place code to calibrate load cells in here diff --git a/platformio.ini b/platformio.ini new file mode 100644 index 0000000..dcd71dc --- /dev/null +++ b/platformio.ini @@ -0,0 +1,20 @@ +; PlatformIO Project Configuration File +; +; Build options: build flags, source filter +; Upload options: custom upload port, speed and extra flags +; Library options: dependencies, extra library storages +; Advanced options: extra scripting +; +; Please visit documentation for the other options and examples +; https://docs.platformio.org/page/projectconf.html + + +[env:NATIVE] +platform = native +build_flags = -std=c++11 -Wall -O1 -D NATIVE + +[env:teensy41] +platform = teensy +board = teensy41 +framework = arduino +build_flags = -std=c++11 -Wall -O1 -D TEENSY diff --git a/src/main.cpp b/src/main.cpp index cf97135..8eac4da 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -11,9 +11,9 @@ #include "Vehicle.h" #include "sim.h" -#if defined(_WIN32) || defined(linux) +#if defined(NATIVE) || defined(_WIN32) #include "native.h" -#elif TEENSY +#elif defined(TEENSY) #include "teensy.h" #endif @@ -21,14 +21,14 @@ Vehicle State; Vehicle PrevState; outVector stateVector; -#if defined(_WIN32) || defined(linux) +#if defined(NATIVE) || defined(_WIN32) void setup() { init_Vehicle(State); // Determine when to burn burnStartTimeCalc(State); } -#elif TEENSY +#elif defined(TEENSY) void setup() { init_Vehicle(State);