|
CTS-SAT-1-OBC-Firmware
|
#include "rtos_tasks/rtos_background_upkeep.h"#include "log/log.h"#include "config/configuration.h"#include "timekeeping/timekeeping.h"#include "rtos_tasks/rtos_task_helpers.h"#include "transforms/arrays.h"#include "main.h"#include "rtos_tasks/rtos_tasks_rx_telecommands.h"#include "comms_drivers/rf_antenna_switch.h"#include "comms_drivers/comms_tx.h"#include "log/lazy_file_log_sink.h"#include "eps_drivers/eps_power_management.h"#include "eps_drivers/eps_time.h"#include "eps_drivers/eps_commands.h"#include "gnss_receiver/gnss_firehose_storage.h"#include "littlefs/littlefs_helper.h"#include "stm32/stm32_reboot_reason.h"#include "adcs_drivers/adcs_commands.h"#include "transforms/number_comparisons.h"#include "telecommand_exec/agenda_from_file.h"#include "cmsis_os.h"#include <inttypes.h>#include <stdint.h>#include <stdio.h>
Functions | |
| static void | subtask_disable_adcs_if_eps_enters_safety_mode (void) |
| static void | subtask_monitor_eps_power (void) |
| static void | subtask_reset_system_after_very_long_uptime (void) |
| If the system exceeds a very long uptime, reset the system. | |
| static void | subtask_reset_system_after_no_recent_uplinks (void) |
| If the system has not received an uplink in a very long time, reset the system. | |
| static void | subtask_update_rf_switch (void) |
| Update the RF switch state based on the current mode. | |
| static void | subtask_send_beacon (void) |
| static void | subtask_sync_obc_time_based_on_eps_time (void) |
| static void | subtask_write_boot_time_to_lfs (void) |
| A minute after bootup, append a JSONL line to LFS_BOOT_LOG_FILE_NAME with the latest boot timestamp. | |
| static void | subtask_enqueue_tcmds_from_agenda_file (void) |
| Enqueue telecommands from the TCMD_active_agenda_filename file. | |
| void | TASK_background_upkeep (void *argument) |
Variables | |
| static const char * | LFS_BOOT_LOG_FILE_NAME = "obc_boot_log.jsonl" |
| uint32_t | STM32_system_reset_interval_sec = 604800 |
| If the system uptime exceeds this value, the system will reset (reboot). | |
| uint32_t | STM32_system_reset_no_uplink_interval_sec = 216000 |
| If the duration since an AX100 uplink telecommand exceeds this value, the system will reset (reboot). | |
| uint32_t | EPS_monitor_safety_adcs_interval_ms = 20000 |
| Check whether the EPS is in safety mode. If it's in safety mode, disable all EPS power channels. | |
| uint32_t | EPS_time_sync_period_sec = 600 |
| How frequently to set the OBC time based on the EPS time if the time divergence is >2 seconds. | |
| uint32_t | EPS_max_time_deviation_for_sync_ms = 2000 |
| If the OBC time and EPS time differ by more than this value, the OBC time will be set based on the EPS time. | |
| uint32_t | COMMS_beacon_interval_ms = 20000 |
| Interval between basic beacon packets, in ms. | |
| static const uint32_t | COMMS_beacon_interval_ms_default_value = 20000 |
| uint32_t | TCMD_enqueue_from_agenda_file_interval_ms = 45000 |
| Interval between enqueuing telecommands from the agenda file, in ms. | |
| uint32_t | TCMD_enqueue_grace_period_ms = 15000 |
| When enqueuing telecommands from a file, gracefully handle time resync values <= this value. | |
| uint32_t | COMMS_total_beacon_count_since_boot = 0 |
| static uint32_t | EPS_monitor_last_uptime_ms = 0 |
| static uint32_t | monitor_eps_to_control_adcs_last_checked_uptime_ms = 0 |
| static uint32_t | last_beacon_send_time_ms = 0 |
| static uint32_t | uptime_of_last_eps_time_sync_ms = 0 |
|
static |


|
static |
Enqueue telecommands from the TCMD_active_agenda_filename file.
| <br> |
On each run, enqueue telecommands from the agenda file.


|
static |


|
static |
If the system has not received an uplink in a very long time, reset the system.
| <br> |


|
static |
If the system exceeds a very long uptime, reset the system.
| <br> |


|
static |


|
static |
Periodically check the OBC time against the EPS time, and then set the OBC time based on the EPS time if they diverge by more than 2000ms (or as configured). We make an assumption here that the EPS's time is going to be more reliable/accurate than the OBC's time, since the EPS uses a high-quality RTC.


|
static |
Update the RF switch state based on the current mode.


|
static |
A minute after bootup, append a JSONL line to LFS_BOOT_LOG_FILE_NAME with the latest boot timestamp.


| void TASK_background_upkeep | ( | void * | argument | ) |


| uint32_t COMMS_beacon_interval_ms = 20000 |
Interval between basic beacon packets, in ms.
|
static |
| uint32_t COMMS_total_beacon_count_since_boot = 0 |
| uint32_t EPS_max_time_deviation_for_sync_ms = 2000 |
If the OBC time and EPS time differ by more than this value, the OBC time will be set based on the EPS time.
|
static |
| uint32_t EPS_monitor_safety_adcs_interval_ms = 20000 |
Check whether the EPS is in safety mode. If it's in safety mode, disable all EPS power channels.
| uint32_t EPS_time_sync_period_sec = 600 |
How frequently to set the OBC time based on the EPS time if the time divergence is >2 seconds.
|
static |
|
static |
|
static |
| uint32_t STM32_system_reset_interval_sec = 604800 |
If the system uptime exceeds this value, the system will reset (reboot).
| uint32_t STM32_system_reset_no_uplink_interval_sec = 216000 |
If the duration since an AX100 uplink telecommand exceeds this value, the system will reset (reboot).
| uint32_t TCMD_enqueue_from_agenda_file_interval_ms = 45000 |
Interval between enqueuing telecommands from the agenda file, in ms.
| uint32_t TCMD_enqueue_grace_period_ms = 15000 |
When enqueuing telecommands from a file, gracefully handle time resync values <= this value.
|
static |