Skip to content

Commit

Permalink
Make coast ascent main flight state until launch detect works
Browse files Browse the repository at this point in the history
  • Loading branch information
bf2799 committed Jun 18, 2021
1 parent 3731f16 commit 7764635
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
17 changes: 12 additions & 5 deletions H750VBT6-flight-board-v0/System/States/state_coast_ascent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,28 @@

void CoastAscentState::init() {
// Empty
data_log_assign_flight(); // TEMP: will be replaced in pre-flight
}

EndCondition_t CoastAscentState::run() {
// Collect, filter, log, and transmit all data
// Collect, filter, log, and log all data
HM_ReadSensorData();
SensorData_t* sensorData = HM_GetSensorData();
applyFilterData(sensorData);
FilterData_t* filterData = getFilteredData();
data_log_write(sensorData, filterData, this->getID());
transmitData(sensorData, filterData, this->getID());

// Only transmit at 1/100th rate
if (this->getRunCounter() % 100 == 0)
transmitData(sensorData, filterData, this->getID());

this->incrementRunCounter();

// TEMP: Comment out apogee detection so this state runs the whole flight
// Detect apogee if z velocity becomes negative
if (filterData->vel_z < 0) {
return EndCondition_t::Apogee;
}
// if (filterData->vel_z < 0) {
// return EndCondition_t::Apogee;
// }
return EndCondition_t::NoChange;
}

Expand Down
2 changes: 1 addition & 1 deletion H750VBT6-flight-board-v0/System/scheduler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ Scheduler::StateId Scheduler::getNextState(EndCondition_t endCondition) {
case StateId::CliMain:
switch(endCondition) {
case EndCondition_t::UsbDisconnect:
return StateId::PreFlight;
return StateId::CoastAscent; // TEMP: Will be PreFlight once launch detect works
default:
break;
}
Expand Down

0 comments on commit 7764635

Please sign in to comment.