Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions TARS/src/mcu_main/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -297,8 +297,9 @@ static THD_FUNCTION(dataLogger_THD, arg) {
#ifdef THREAD_DEBUG
Serial.println("Data Logging thread entrance");
#endif

sd_logger.update();
if (datalog_is_running) {
sd_logger.update();
}

chThdSleepMilliseconds(6);
}
Expand Down
10 changes: 9 additions & 1 deletion TARS/src/mcu_main/telemetry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ void Telemetry::handleCommand(const telemetry_command &cmd) {
return;
}
last_command_id = (int16_t)cmd.cmd_id;

/*
* Write frequency to SD card to save
* between runs
Expand All @@ -130,6 +130,14 @@ void Telemetry::handleCommand(const telemetry_command &cmd) {
}
Serial.println("[DEBUG]: Got abort");
}

if (cmd.command == START_LOGGING) {
datalog_is_running = true;
}

if (cmd.command == STOP_LOGGING) {
datalog_is_running = false;
}
}

// #define TLM_DEBUG
Expand Down
4 changes: 3 additions & 1 deletion TARS/src/mcu_main/telemetry.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ struct TelemetryPacket {
};

// Commands transmitted from ground station to rocket
enum CommandType { SET_FREQ, SET_CALLSIGN, ABORT, TEST_FLAPS, EMPTY };
enum CommandType { SET_FREQ, SET_CALLSIGN, ABORT, TEST_FLAPS, EMPTY, START_LOGGING, STOP_LOGGING };

struct telemetry_command {
CommandType command;
Expand All @@ -90,6 +90,8 @@ struct command_handler_struct {
class Telemetry {
public:
bool abort = false;
bool datalog_is_running = false;


Telemetry();

Expand Down
4 changes: 4 additions & 0 deletions ground/src/feather/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,10 @@ void SerialInput(const char* key, const char* value) {
return;
} else if (strcmp(key, "FLAP") == 0) {
command.command = CommandType::TEST_FLAP;
} else if (strcmp(key, "START_LOGGING") == 0) {
command.command = CommandType::START_LOGGING;
} else if (strcmp(key, "STOP_LOGGING") == 0) {
command.command = CommandType::STOP_LOGGING;
} else {
SerialError();
return;
Expand Down