Skip to content

Commit 90baa25

Browse files
authored
Merge pull request #79 from ISSUIUC/reenable-rx
reenable telem receive
2 parents d405bce + 77ca74e commit 90baa25

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

MIDAS/src/systems.cpp

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,11 +205,20 @@ DECLARE_THREAD(kalman, RocketSystems* arg) {
205205
}
206206

207207
DECLARE_THREAD(telemetry, RocketSystems* arg) {
208+
double launch_time = 0;
209+
208210
while (true) {
209211
arg->tlm.transmit(arg->rocket_data, arg->led);
210212

211213
FSMState current_state = arg->rocket_data.fsm_state.getRecentUnsync();
212-
if (current_state == FSMState(STATE_IDLE) || current_state == FSMState(STATE_SAFE) || current_state == FSMState(STATE_PYRO_TEST)) {
214+
215+
double current_time = pdTICKS_TO_MS(xTaskGetTickCount());
216+
217+
if (current_state == FSMState::STATE_IDLE) {
218+
launch_time = current_time;
219+
}
220+
221+
if (current_state == FSMState(STATE_IDLE) || current_state == FSMState(STATE_SAFE) || current_state == FSMState(STATE_PYRO_TEST) || (current_time - launch_time) > 1800000) {
213222
TelemetryCommand command;
214223
if (arg->tlm.receive(&command, 500)) {
215224
if(command.valid()) {

0 commit comments

Comments
 (0)