diff --git a/include/teensy.h b/include/teensy.h index 285069b..9b3415b 100644 --- a/include/teensy.h +++ b/include/teensy.h @@ -229,7 +229,21 @@ void thrustInfo(Vehicle &State) { State.burnStart = State.time; State.burnElapsed = 0.0; + // Save load cell values before ignition + double lc_val = State.lc0_processed + State.lc1_processed + + State.lc2_processed + State.lc3_processed; + + // CONTACT + Serial.println("CONTACT"); digitalWrite(pin_igniter, HIGH); + + // Wait for motor to start burning + Serial.println("waiting for motor to start."); + while (lc_val * 1.5 < State.lc0_processed + State.lc1_processed + + State.lc2_processed + State.lc3_processed) { + ; + } + State.thrustFiring = 1; } else if (State.thrustFiring == 1) { diff --git a/src/main.cpp b/src/main.cpp index a11dbac..268e056 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -66,7 +66,7 @@ void loop() { vehicleDynamics(State, PrevState); thrustInfo(State); pidController(State, PrevState); - TVC(State, PrevState); + thrustInfo(State); processTVC(State, yaw, pitch); write2CSV(State);