CTS-SAT-1-OBC-Firmware
Loading...
Searching...
No Matches
gnss_firehose_storage.c File Reference
#include "gnss_receiver/gnss_firehose_storage.h"
#include "gnss_receiver/gnss_internal_drivers.h"
#include "uart_handler/uart_handler.h"
#include "log/log.h"
#include "littlefs/littlefs_helper.h"
#include "timekeeping/timekeeping.h"
#include "transforms/arrays.h"
#include <stdint.h>
#include <stdio.h>
Include dependency graph for gnss_firehose_storage.c:

Functions

static int8_t GNSS_write_firehose_file_header ()
static int8_t GNSS_write_firehose_file_footer (const char reason_for_stopping[])
 Write the end-of-recording JSON data to the file.
static int8_t GNSS_prepare_to_receive_data (const char output_file_path[])
 Opens a file to store incoming GNSS data.
uint8_t GNSS_enable_firehose_storage_mode (const char output_file_path[])
 Configures the OBC to receive and store all data from the GNSS receiver to a file.
uint8_t GNSS_disable_firehose_storage_mode (const char reason_for_stopping[])
uint8_t GNSS_subtask_store_firehose_data_to_file ()
 Store pending data in the UART_gnss_buffer to the GNSS firehose file.

Variables

uint8_t GNSS_firehose_file_is_open = 0
volatile uint32_t GNSS_firehose_bytes_lost = 0
lfs_file_t GNSS_firehose_file_pointer
uint32_t GNSS_recording_start_uptime_ms = 0
static uint32_t last_gnss_flush_uptime_ms = 0
uint32_t GNSS_firehose_flush_interval_ms = 30000

Function Documentation

◆ GNSS_disable_firehose_storage_mode()

uint8_t GNSS_disable_firehose_storage_mode ( const char reason_for_stopping[])
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GNSS_enable_firehose_storage_mode()

uint8_t GNSS_enable_firehose_storage_mode ( const char output_file_path[])

Configures the OBC to receive and store all data from the GNSS receiver to a file.

Returns
0: Success. Non-zero: Error.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GNSS_prepare_to_receive_data()

int8_t GNSS_prepare_to_receive_data ( const char output_file_path[])
static

Opens a file to store incoming GNSS data.

Returns
0: System successfully prepared for GNSS data, < 0: Error
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GNSS_subtask_store_firehose_data_to_file()

uint8_t GNSS_subtask_store_firehose_data_to_file ( )

Store pending data in the UART_gnss_buffer to the GNSS firehose file.

Returns
0 on success or no-op. Non-zero: Error.
Note
Intended to be called in a periodic background loop, but also can be called from telecommand.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GNSS_write_firehose_file_footer()

int8_t GNSS_write_firehose_file_footer ( const char reason_for_stopping[])
static

Write the end-of-recording JSON data to the file.

Returns
0 on success.
Note
The normal timestamp function is called right before this function, so no need to include timestamps in here.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GNSS_write_firehose_file_header()

int8_t GNSS_write_firehose_file_header ( )
static
Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ GNSS_firehose_bytes_lost

volatile uint32_t GNSS_firehose_bytes_lost = 0

◆ GNSS_firehose_file_is_open

uint8_t GNSS_firehose_file_is_open = 0

◆ GNSS_firehose_file_pointer

lfs_file_t GNSS_firehose_file_pointer

◆ GNSS_firehose_flush_interval_ms

uint32_t GNSS_firehose_flush_interval_ms = 30000

◆ GNSS_recording_start_uptime_ms

uint32_t GNSS_recording_start_uptime_ms = 0

◆ last_gnss_flush_uptime_ms

uint32_t last_gnss_flush_uptime_ms = 0
static