Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
6a4a37a
obc: mission ops: add common modules and modes
angelazheng96 Jan 30, 2026
e358443
obc: mission ops: add idle mode of operation
angelazheng96 Jan 30, 2026
3d5b6f0
obc: mission ops: add imaging mode of operation
angelazheng96 Jan 30, 2026
7399d04
obc: mission ops: add downlinking mode of operation
angelazheng96 Jan 30, 2026
ea5c450
obc: mission ops: add safety mode of operation
angelazheng96 Jan 30, 2026
3ad7a13
obc: mission ops: add firmware update mode of operation
angelazheng96 Jan 30, 2026
298264e
obc: mission ops: remove main file
angelazheng96 Jan 30, 2026
8b81fbe
obc: mission ops: allow both obc and pay update
angelazheng96 Jan 31, 2026
6dbaa95
obc: mission ops: add finch prefix to common module
angelazheng96 Jan 31, 2026
86f6c3e
obc: mission ops: add prefixes to downlinking functions
angelazheng96 Jan 31, 2026
82b3220
obc: mission ops: reinstate main file
angelazheng96 Jan 31, 2026
75bfaf3
obc: mission ops: set placeholder types to uint8_t*
angelazheng96 Jan 31, 2026
29eb160
obc: mission ops: label downlinking and error data as constant
angelazheng96 Jan 31, 2026
e9f9095
obc: mission ops: remove multiple log module registrations
angelazheng96 Jan 31, 2026
d47d8b2
obc: mission ops: add error handling to downlinking function
angelazheng96 Jan 31, 2026
b77a2b9
obc: adding init
jpmedinagl Jan 31, 2026
99c2322
obc: mission ops: update adcs in firmware update
angelazheng96 Feb 7, 2026
8e602ac
obc: adding idle schedule
jpmedinagl Feb 7, 2026
3ca5eb1
Merge branch 'mission-ops-moos' of https://github.com/utat-ss/finch-f…
jpmedinagl Feb 7, 2026
2f1d9ee
obc: draft: implement command handling functions
angelazheng96 Feb 7, 2026
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
85 changes: 85 additions & 0 deletions apps/obc/src/common.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
/*
* Copyright (c) 2025 The FINCH CubeSat Project Flight Software Contributors
*
* SPDX-License-Identifier: Apache-2.0
*/

/**
* @file common.c
* @brief Source for Definitions Common Across Modules
*/

#include "common.h"
#include <stdbool.h>
#include <zephyr/logging/log.h>

LOG_MODULE_REGISTER(finch_common);

/**
* @brief Enter specified ADCS control mode
*/
void cmd_adcs_mode(mode_adcs mode, uint8_t* orbit_info, float current_time, uint8_t* tle)
{
switch (mode) {
case MODE_ADCS_SAFE:
LOG_INF("Setting ADCS to Safe mode");
// Setting ADCS to Safe mode
break;

case MODE_ADCS_DETUMBLING:
LOG_INF("Setting ADCS to Detumbling mode");
// Set ADCS to Detumbling mode
break;

case MODE_ADCS_SUN_POINTING:
LOG_INF("Setting ADCS to Sun Pointing mode");
// Set ADCS to Sun Pointing mode
break;

case MODE_ADCS_FINE_POINTING:
LOG_INF("Setting ADCS to Fine Pointing mode");
// Set ADCS to Fine Pointing mode
break;

case MODE_ADCS_LVLH:
LOG_INF("Setting ADCS to LVLH mode");
// Set ADCS to LVLH mode
break;

case MODE_ADCS_TRACKING:
LOG_INF("Setting ADCS to Tracking mode");
// Set ADCS to Tracking mode
break;

case MODE_ADCS_OFF:
LOG_INF("Setting ADCS to Off mode");
// Set ADCS to Off mode
break;

default:
LOG_WRN("Unknown ADCS control mode");
break;
}
}

/**
* @brief Enter specified PAY control mode
*/
void cmd_pay_mode(mode_pay mode)
{
switch (mode) {
case MODE_PAY_OFF:
LOG_INF("Setting PAY to Off mode");
// Set PAY to Off mode
break;

case MODE_PAY_ON:
LOG_INF("Setting PAY to On mode");
// Set PAY to On mode
break;

default:
LOG_WRN("Unknown PAY control mode");
break;
}
}
74 changes: 74 additions & 0 deletions apps/obc/src/common.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
/*
* Copyright (c) 2025 The FINCH CubeSat Project Flight Software Contributors
*
* SPDX-License-Identifier: Apache-2.0
*/

/**
* @file common.h
* @brief Header for Definitions Common Across Modules
*/

#ifndef FINCH_COMMON_H
#define FINCH_COMMON_H

/**
* @brief System modules
*/
typedef enum system_module {
MODULE_OPERATOR,
MODULE_MCC_GS,
MODULE_RF,
MODULE_OBC,
MODULE_ADCS,
MODULE_PAY
} system_module;

/**
* @brief Modes of operation
*/
typedef enum mode_op {
MODE_OP_IDLE,
MODE_OP_IMAGING,
MODE_OP_DOWNLINKING,
MODE_OP_SAFETY,
MODE_OP_FIRMWARE_UPDATE
} mode_op;

/**
* @brief ADCS control modes
*/
typedef enum mode_adcs {
MODE_ADCS_SAFE,
MODE_ADCS_DETUMBLING,
MODE_ADCS_SUN_POINTING,
MODE_ADCS_FINE_POINTING,
MODE_ADCS_LVLH,
MODE_ADCS_TRACKING,
MODE_ADCS_OFF
} mode_adcs;

/**
* @brief PAY control mode
*/
typedef enum mode_pay {
MODE_PAY_OFF,
MODE_PAY_ON
} mode_pay;

/**
* @brief Enter specified mode of operation
*/
// void enter_mode_op(mode_op mode);

/**
* @brief Enter specified ADCS control mode
*/
void cmd_adcs_mode(mode_adcs mode, uint8_t* orbit_info, float current_time, uint8_t* tle);

/**
* @brief Enter specified PAY control mode
*/
void cmd_pay_mode(mode_pay mode);

#endif
85 changes: 85 additions & 0 deletions apps/obc/src/downlinking.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
/*
* Copyright (c) 2025 The FINCH CubeSat Project Flight Software Contributors
*
* SPDX-License-Identifier: Apache-2.0
*/

/**
* @file downlinking.c
* @brief Downlinking Command Sequence Implementation
*/

#include "common.h"
#include "downlinking.h"
#include <stdbool.h>
#include <zephyr/logging/log.h>

LOG_MODULE_REGISTER(downlinking);

/**
* @brief Main loop for Downlinking command sequence
*/
mode_op downlinking_command_sequence(void)
{
cmd_adcs_mode(MODE_ADCS_FINE_POINTING, 0, 0.0, 0); // Placeholder values for orbit_info, current_time and tle

downlink_type dl_type = downlinking_prepare_rf();
uint8_t* downlink_data;

if (dl_type == DOWNLINK_TELEMETRY)
{
downlink_data = downlinking_get_telemetry_data();
}

else if (dl_type == DOWNLINK_IMAGE)
{
downlink_data = downlinking_get_image_data();
}

int ret = downlinking_downlink_rf(downlink_data);

// Error handling - to be implemented
if (ret < 0)
{
return ret;
}

return MODE_OP_IDLE;
}

/**
* @brief Prepare RF for downlinking
*/
downlink_type downlinking_prepare_rf(void)
{
// Implement RF downlink preparation
// Return type of downlinking
return NULL;
}

/**
* @brief Get telemetry data for downlinking
*/
uint8_t* downlinking_get_telemetry_data(void)
{
// Get telemetry data
return NULL;
}

/**
* @brief Get image data for downlinking
*/
uint8_t* downlinking_get_image_data(void)
{
// Get image data
return NULL;
}

/**
* @brief Downlink data to RF
*/
int downlinking_downlink_rf(const uint8_t* downlink_data)
{
// Implement downlinking data to RF
return 0;
}
50 changes: 50 additions & 0 deletions apps/obc/src/downlinking.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
/*
* Copyright (c) 2025 The FINCH CubeSat Project Flight Software Contributors
*
* SPDX-License-Identifier: Apache-2.0
*/

/**
* @file downlinking.h
* @brief Header for Downlinking Command Sequence Implementation
*/

#ifndef DOWNLINKING_H
#define DOWNLINKING_H

#include "common.h"

/**
* @brief Downlink types
*/
typedef enum downlink_type {
DOWNLINK_TELEMETRY,
DOWNLINK_IMAGE
} downlink_type;

/**
* @brief Main loop for Downlinking command sequence
*/
mode_op downlinking_command_sequence(void);

/**
* @brief Prepare RF for downlinking
*/
downlink_type downlinking_prepare_rf(void);

/**
* @brief Get telemetry data for downlinking
*/
uint8_t* downlinking_get_telemetry_data(void);

/**
* @brief Get image data for downlinking
*/
uint8_t* downlinking_get_image_data(void);

/**
* @brief Downlink data to RF
*/
int downlinking_downlink_rf(const uint8_t* downlink_data);

#endif
81 changes: 81 additions & 0 deletions apps/obc/src/firmware-update.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
/*
* Copyright (c) 2025 The FINCH CubeSat Project Flight Software Contributors
*
* SPDX-License-Identifier: Apache-2.0
*/

/**
* @file firmware-update.c
* @brief Firmware Update Command Sequence Implementation
*/

#include "common.h"
#include "firmware-update.h"
#include <stdbool.h>
#include <zephyr/logging/log.h>

LOG_MODULE_REGISTER(firmware_update);

/**
* @brief Main loop for Firmware Update command sequence
*/
mode_op firmware_update_command_sequence(void)
{
// RUN BELOW IN PARALLEL

// Parallel block 1
cmd_adcs_mode(MODE_ADCS_FINE_POINTING, 0, 0.0, 0); // Placeholder values for orbit_info, current_time and tle

// Parallel block 2
if (cmd_obc_available_update())
{
cmd_obc_update();
// Transmit update feedback to RF
}

if (cmd_pay_available_update())
{
cmd_pay_update();
// Transmit update feedback to RF
}

// END PARALLEL

return MODE_OP_IDLE;
}

/**
* @brief Polls for available OBC firmware upate
*/
int cmd_obc_available_update(void)
{
// Implement check for OBC firmware update
return 0;
}

/**
* @brief Polls for available PAY firmware upate
*/
int cmd_pay_available_update(void)
{
// Implement check for PAY firmware update
return 0;
}

/**
* @brief Executes OBC firmware update
*/
int cmd_obc_update(void)
{
// Implement OBC firmware update
return 0;
}

/**
* @brief Executes PAY firmware update
*/
int cmd_pay_update(void)
{
// Implement PAY firmware update
return 0;
}
Loading
Loading