1
0
mirror of https://gitlab.com/lander-team/lander-cpp.git synced 2025-06-16 07:06:51 +00:00

Update to load cell calibration and initialize lc

This commit is contained in:
Matthew Robinaugh 2021-11-10 14:36:31 -07:00
parent 541d7f4281
commit 1ec624cc55
2 changed files with 11 additions and 6 deletions

View File

@ -25,8 +25,7 @@ void init_LoadCells(LoadCells &loadCells) {
const int lc_data_2 = 2; const int lc_data_2 = 2;
const int lc_data_3 = 3; const int lc_data_3 = 3;
Serial.begin(9600); // Begin serial connection Serial.begin(9600);
pinMode(LED_BUILTIN, OUTPUT); // Configure LED pin
// Configure clock pin with high impedance to protect pin (if this doesn't // Configure clock pin with high impedance to protect pin (if this doesn't
// work, change to OUTPUT) // work, change to OUTPUT)
pinMode(lc_clock, INPUT); pinMode(lc_clock, INPUT);
@ -36,6 +35,11 @@ void init_LoadCells(LoadCells &loadCells) {
pinMode(lc_data_2, INPUT); pinMode(lc_data_2, INPUT);
pinMode(lc_data_3, INPUT); pinMode(lc_data_3, INPUT);
loadcell_0.begin(lc_data_0, lc_clock);
loadcell_1.begin(lc_data_1, lc_clock);
loadcell_2.begin(lc_data_2, lc_clock);
loadcell_3.begin(lc_data_3, lc_clock);
loadCells.lc0Calibration = loadCellCalibrate(loadcell_0); loadCells.lc0Calibration = loadCellCalibrate(loadcell_0);
loadCells.lc1Calibration = loadCellCalibrate(loadcell_1); loadCells.lc1Calibration = loadCellCalibrate(loadcell_1);
loadCells.lc2Calibration = loadCellCalibrate(loadcell_2); loadCells.lc2Calibration = loadCellCalibrate(loadcell_2);

View File

@ -1,13 +1,14 @@
#include "Vehicle.h" #include "Vehicle.h"
#include "LoadCells.h"
void thrustInfo(struct Vehicle &); void thrustInfo(struct Vehicle &);
void processTVC(struct Vehicle &); void processTVC(struct LoadCells &);
void write2CSV(struct outVector &, struct Vehicle &); void write2CSV(struct outVector &, struct Vehicle &);
void printSimResults(struct Vehicle &); void printSimResults(struct Vehicle &);
double loadCellCalibrate(struct LoadCells &); double loadCellCalibrate(HX711 loadCell);
double loadCellCalibrate(LoadCells &loadCells) { double loadCellCalibrate(HX711 loadCell) {
// place code to calibrate load cells in here // place code to calibrate load cells in here
double loadTotal = 0.0; double loadTotal = 0.0;
for (double t = 0; t == 10; ++t) { for (double t = 0; t == 10; ++t) {
@ -59,7 +60,7 @@ void thrustInfo(Vehicle &State) {
} }
} }
void processTVC(Vehicle &State) { void processTVC(LoadCells &loadCells) {
if (State.time == 0) { if (State.time == 0) {
Serial.println("WARNING: processTVC not implemented for TEENSY"); Serial.println("WARNING: processTVC not implemented for TEENSY");
} }