1
0
mirror of https://gitlab.com/lander-team/lander-cpp.git synced 2025-06-15 22:56:53 +00:00

Platformio stuff

This commit is contained in:
Anson Biggs 2021-11-04 02:58:49 +00:00
parent 0d3c0a9d1c
commit 5abdc75c81
7 changed files with 41 additions and 10 deletions

8
.gitignore vendored
View File

@ -1,4 +1,10 @@
*.exe *.exe
*.csv *.csv
output output
public public
.pio
.vscode/.browse.c_cpp.db*
.vscode/c_cpp_properties.json
.vscode/launch.json
.vscode/ipch

View File

@ -13,7 +13,7 @@ build:
stage: build stage: build
script: script:
- mkdir public - 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 - ./public/sim.out
- mv simOut.csv public - mv simOut.csv public
artifacts: artifacts:

View File

@ -2,6 +2,7 @@
"recommendations": [ "recommendations": [
"ms-vscode.cpptools", "ms-vscode.cpptools",
"wayou.vscode-todo-highlight", "wayou.vscode-todo-highlight",
"usernamehw.errorlens" "usernamehw.errorlens",
"platformio.platformio-ide"
] ]
} }

View File

@ -36,6 +36,8 @@ void burnStartTimeCalc(Vehicle &State) {
else if ((i > 3.382) && (i < 3.46)) else if ((i > 3.382) && (i < 3.46))
thrust = -195.78 * i + 675.11; thrust = -195.78 * i + 675.11;
else
thrust = 0;
velocity = (((thrust / mass) + g) * dt) + velocity; velocity = (((thrust / mass) + g) * dt) + velocity;
h = (((thrust / mass) + g) * dt) + h; h = (((thrust / mass) + g) * dt) + h;

View File

@ -2,10 +2,12 @@
#include <Arduino.h> #include <Arduino.h>
void thrustInfo(struct Vehicle &);
void processTVC(struct Vehicle &);
void write2CSV(struct outVector &, struct Vehicle &);
void printSimResults(struct Vehicle &);
double loadCellCalibrate(); double loadCellCalibrate();
void thrustInfo();
void processTVC();
void write2csv();
double loadCellCalibrate() { double loadCellCalibrate() {
// place code to calibrate load cells in here // place code to calibrate load cells in here

20
platformio.ini Normal file
View File

@ -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

View File

@ -11,9 +11,9 @@
#include "Vehicle.h" #include "Vehicle.h"
#include "sim.h" #include "sim.h"
#if defined(_WIN32) || defined(linux) #if defined(NATIVE) || defined(_WIN32)
#include "native.h" #include "native.h"
#elif TEENSY #elif defined(TEENSY)
#include "teensy.h" #include "teensy.h"
#endif #endif
@ -21,14 +21,14 @@ Vehicle State;
Vehicle PrevState; Vehicle PrevState;
outVector stateVector; outVector stateVector;
#if defined(_WIN32) || defined(linux) #if defined(NATIVE) || defined(_WIN32)
void setup() { void setup() {
init_Vehicle(State); init_Vehicle(State);
// Determine when to burn // Determine when to burn
burnStartTimeCalc(State); burnStartTimeCalc(State);
} }
#elif TEENSY #elif defined(TEENSY)
void setup() { void setup() {
init_Vehicle(State); init_Vehicle(State);