Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
57 commits
Select commit Hold shift + click to select a range
6c52682
firmware: app: libs: Import libconops to project
c-porto Mar 12, 2025
dd15022
firmware: app: tasks: startup: Remove hibernation event and add last_…
c-porto Mar 21, 2025
18f4c38
firmware: app: tasks: mission_manager: Refactor Mission Manager to us…
c-porto Mar 22, 2025
5ddf27b
firmware: app: Refactor tasks and utils to use new Mission Manager #364
c-porto Mar 24, 2025
68a3d46
firmware: app: structs: obdh_data: Add parameter to control automatic…
c-porto Mar 31, 2025
52511da
firmware: app: tasks: mission_manager: Update conops transition details
c-porto Mar 31, 2025
9dc0295
firmware: app: tasks: process_tc: Update Mission Manager notification…
c-porto Mar 31, 2025
4021131
firmware: app: tasks: mode_check: Update mode tests for new mission m…
c-porto Mar 31, 2025
68bbd85
firmware: app: Add error codes for TC Feedback
c-porto Mar 31, 2025
df7f80a
firmware: app: utils: mem_mng: Add initialization for manual experime…
c-porto Mar 31, 2025
07ec462
firmware: Add option to log OBDH parameters on startup
c-porto Mar 31, 2025
fa35a47
firmware: app: tasks: housekeeping: Make commission timeout notificat…
c-porto Mar 31, 2025
7335d9d
firmware: app: tasks: read_edc: Save latest received PTT packet to st…
c-porto Mar 31, 2025
c3582ff
firmware: Change TC `Get Payload Data` to `Get Subsystem Table`
c-porto Mar 31, 2025
a367b7f
firmware: app: libs: Update libconops to v0.2.0
c-porto Apr 12, 2025
e6e0b0b
firmware: Initial version of scheduled TC task
c-porto Apr 12, 2025
28714c5
firmware: app: Add function to reset TC Queue
c-porto Apr 12, 2025
fa81f9b
firmware: app: structs: obdh_data: Change general telemetry flag default
c-porto Apr 19, 2025
2037918
firmware: app: tasks: startup: Fix logs and bad FRAM crc NOR memory c…
c-porto Apr 19, 2025
ac7c19a
firmware: app: tasks: housekeeping: Fix EPS beacon state update
c-porto Apr 19, 2025
765196f
firmware: app: tasks: mission_manager: Fix EPS beacon state change an…
c-porto Apr 19, 2025
ef1489a
firmware: app: tasks: mission_manager: Fix payload control on mode tr…
c-porto Apr 19, 2025
dca0473
firmware: app: tasks: read_eps: Add battery level check for FDIR rela…
c-porto Apr 19, 2025
83bdd0e
firmware: app: tasks: mode_check: Fix mode test for commission mode e…
c-porto Apr 19, 2025
aea7eec
firmware: app: tasks: process_tc: Add support for scheduled TCs
c-porto Apr 20, 2025
7f3b59b
firmware: app: utils: mem_mng: Add functions to store/load the TC Que…
c-porto Apr 20, 2025
cb345db
firmware: app: structs: obdh_data: Add parameter to reset TC Queue
c-porto Apr 20, 2025
8283647
firmware: Add 'Schedule TC' telecommand
c-porto Apr 20, 2025
f3493af
firmware: app: tasks: sched_tc: Finish implementation for sched_tc task
c-porto Apr 20, 2025
ced2488
firmware: app: Add routine to store TC Queue on FRAM #366
c-porto Apr 21, 2025
755bc34
firmware: app: tasks: Add new flag to signal that FRAM initialization…
c-porto Apr 21, 2025
c92e524
firmware: app: tasks: Fix Mission Manager notification #365
c-porto Apr 21, 2025
775e251
firmware: app: tasks: Update `Schedule TC` telecommand to expect a ca…
c-porto Apr 21, 2025
e61e72d
firmware: app: Add TC queue related parameters to OBDH data
c-porto Apr 21, 2025
e9d8500
firmware: app: tasks: mode_check: Fix mode check tests and delays
c-porto Apr 30, 2025
65b9fd6
firmware: app: tasks: mission_manager: Fix payload control for EXP mo…
c-porto Apr 30, 2025
04b7d05
firmware: devices: ttc: Update allowed consecutive decoding fails
c-porto May 19, 2025
36c2bfa
firmware: app: utils: mem_mng: Fix NOR memory corruption condition fo…
c-porto May 19, 2025
d2eceb9
firmware: app: tasks: read_sensors: Change log messages for sensor re…
c-porto May 19, 2025
e857165
firmware: app: tasks: read_eps: Add more retries for EPS communication
c-porto May 19, 2025
d86cc2a
firmware: app: tasks: read_edc: Increase initial delay after startup
c-porto May 19, 2025
98788b2
firmware: app: tasks: process_tc: Add retries for external module com…
c-porto May 19, 2025
e30d16d
firmware: app: tasks: housekeeping: Add delays between different hous…
c-porto May 19, 2025
1b97a14
firmware: app: tasks: antenna_deployment: Add log messages for initia…
c-porto May 19, 2025
ee3f5f2
firmware: app: tasks: housekeeping: Fix hibernation timeout on Deploy…
c-porto May 23, 2025
b363ca6
firmware: app: tasks: read_edc: Add log message for active EDC ID
c-porto May 23, 2025
a56a9ed
firmware: app: tasks: mission_manager: Add transitions for deployment…
c-porto May 23, 2025
86a24c9
firmware: drivers: sl_ttc2: Remove log message for CRC mismatch
c-porto May 23, 2025
51e2931
firmware: app: tasks: mission_manager: Fix EPS beacon flag update on …
c-porto May 23, 2025
5c9fc83
firmware: app: tasks: Save system time to FRAM before reset
c-porto Jun 5, 2025
33f2eb4
firmware: app: tasks: process_tc: Fix EDC 2 payload ID
c-porto Jul 23, 2025
e8f3d55
firmware: drivers: sl_ttc2: Add delay between transactions with TTC
c-porto Jul 23, 2025
bbc1f9e
firmware: config: Enable General Telemetry task by default
c-porto Jul 23, 2025
1967e00
firmware: devices: payload: Fix log level for EDC commands
c-porto Aug 11, 2025
69c111c
firmware: Update Main EDC struct to `edc_telemetry_t`
c-porto Aug 11, 2025
41a1370
firmware: app: tasks: read_eps: Fix notification for battery level
c-porto Aug 25, 2025
80c05c6
firmware: app: tasks: process_tc: Increase task stack size to accomod…
c-porto Aug 25, 2025
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
3 changes: 2 additions & 1 deletion firmware/.cproject
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
<listOptionValue builtIn="false" value="${PROJECT_ROOT}/config"/>
<listOptionValue builtIn="false" value="${PROJECT_ROOT}/freertos/portable/CCS/MSP430X"/>
<listOptionValue builtIn="false" value="${PROJECT_ROOT}/app/libs/libpredict/include"/>
<listOptionValue builtIn="false" value="${PROJECT_ROOT}/app/libs/libconops/include"/>
</option>
<option id="com.ti.ccstudio.buildDefinitions.MSP430_21.6.compilerID.ADVICE__POWER.314342449" superClass="com.ti.ccstudio.buildDefinitions.MSP430_21.6.compilerID.ADVICE__POWER" value="all" valueType="string"/>
<option id="com.ti.ccstudio.buildDefinitions.MSP430_21.6.compilerID.DEBUGGING_MODEL.1696363353" superClass="com.ti.ccstudio.buildDefinitions.MSP430_21.6.compilerID.DEBUGGING_MODEL" value="com.ti.ccstudio.buildDefinitions.MSP430_21.6.compilerID.DEBUGGING_MODEL.SYMDEBUG__DWARF" valueType="enumerated"/>
Expand Down Expand Up @@ -201,4 +202,4 @@
</storageModule>
<storageModule moduleId="scannerConfiguration"/>
<storageModule moduleId="org.eclipse.cdt.make.core.buildtargets"/>
</cproject>
</cproject>
21 changes: 21 additions & 0 deletions firmware/app/libs/libconops/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2024 Carlos Augusto Porto Freitas

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
43 changes: 43 additions & 0 deletions firmware/app/libs/libconops/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
libconops
=========

A simple library to facilitate the mission control and planning.

.. _building-sec:

Building
--------

Currently, the library supports both CMake and Meson. How to compile the library using them can be seen below.

Meson
~~~~~
To build the library with Meson, run the following command in the repo's root::

meson setup build
meson compile -C build

CMake
~~~~~
To build the library with CMake, run the following command in the repo's root::

mkdir build && cd build
cmake ..
make

Tests
-----

To run the library unit tests, assuming that the commands from `Building <#building>`_ were used, run the following commands.

CMake builds
~~~~~~~~~~~~
Run in the build directory::

ctest --output-on-failure

Meson builds
~~~~~~~~~~~~
Run in the repo's root::

meson test -C build --print-errorlogs
77 changes: 77 additions & 0 deletions firmware/app/libs/libconops/include/conops/conops.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
#ifndef CONOPS_H_
#define CONOPS_H_

#ifdef __cplusplus
extern "C" {
#endif

#include <stdint.h>

/* Library ERRNO meanings */
#define ERRNO_CONOPS_INVALID_ARG 1
#define ERRNO_CONOPS_NO_TRANSITION_TABLE 2
#define ERRNO_CONOPS_INSUFFICIENT_BUFFER_SIZE 3
#define ERRNO_CONOPS_INVALID_STATE 4
#define ERRNO_CONOPS_INVALID_EV_ID 5
#define ERRNO_CONOPS_NO_MAPPER_FUNCTION 6
#define ERRNO_CONOPS_MAPPING_ERROR 7
#define ERRNO_CONOPS_INVALID_TRANSITION 8

/* Library FSM default config */
#define CONOPS_DEFAULT_N_STATES 256U
#define CONOPS_DEFAULT_MAX_EV_ID UINT16_MAX
#define CONOPS_DEFAULT_INIT_STATE 0U
#define CONOPS_DEFAULT_EV_NAME_SIZE 12U
#define CONOPS_DEFAULT_CALLBACK_IGNORE_SRC 0x5443

/* Foward declarations */
struct conops_fsm;
struct conops_event;

typedef int (*conops_transition_handler_t)(struct conops_fsm *ctx, const struct conops_event *ev,
const uint16_t transition_to);

typedef int32_t (*conops_event_mapper_t)(const struct conops_fsm *ctx,
const struct conops_event *ev);

typedef void (*conops_event_callback_t)(struct conops_fsm *ctx, const struct conops_event *ev);

typedef int (*conops_init_callback_t)(struct conops_fsm *ctx);

struct conops_fsm_config {
uint16_t n_states;
uint16_t max_ev_id;
uint16_t init_state;
};

struct conops_fsm {
struct conops_fsm_config conf;
uint16_t state;
uint16_t last_valid_ev_id;
const void *transition_table;
void *user_data;
conops_event_mapper_t ev_mapper_fn;
};

struct conops_event {
uint16_t src;
uint16_t ev_id;
char ev_name[CONOPS_DEFAULT_EV_NAME_SIZE];
conops_event_callback_t callback;
};

int conops_fsm_init(struct conops_fsm *fsm, const void *transition_table, const uint16_t n_states,
const uint16_t max_ev_id, const uint16_t init_state,
conops_init_callback_t callback);

int conops_fsm_process_event(struct conops_fsm *fsm, const struct conops_event *ev);

int conops_register_mapper(struct conops_fsm *fsm, conops_event_mapper_t mapper);

int conops_register_fsm_user_data(struct conops_fsm *fsm, void *user_data);

#ifdef __cplusplus
}
#endif

#endif
48 changes: 48 additions & 0 deletions firmware/app/libs/libconops/include/conops/util/cmd_queue.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
#ifndef CONOPS_CMD_QUEUE_H
#define CONOPS_CMD_QUEUE_H

#ifdef __cplusplus
extern "C" {
#endif

#include <stdint.h>
#include <stdbool.h>

#define PAYLOAD_SIZE 20U
#define CMD_QUEUE_CAPACITY 10U

typedef void (*cmd_queue_lock_t)(void *lock);
typedef void (*cmd_queue_unlock_t)(void *lock);

struct conops_cmd {
uint32_t timestamp;
uint8_t payload[PAYLOAD_SIZE];
};

struct conops_cmd_queue {
struct conops_cmd buffer[CMD_QUEUE_CAPACITY];
uint16_t size;
void *lock;
cmd_queue_lock_t queue_lock;
cmd_queue_unlock_t queue_unlock;
};

void cmd_queue_init(struct conops_cmd_queue *queue, void *lock, cmd_queue_lock_t queue_lock,
cmd_queue_unlock_t queue_unlock);

int cmd_queue_dequeue(struct conops_cmd_queue *queue, uint32_t current_time,
struct conops_cmd *out);

int cmd_queue_enqueue(struct conops_cmd_queue *queue, const struct conops_cmd *cmd);

void cmd_queue_reset(struct conops_cmd_queue *queue);

bool cmd_queue_is_empty(const struct conops_cmd_queue *queue);

void heapify_cmd_buffer(struct conops_cmd *buffer, uint16_t size);

#ifdef __cplusplus
}
#endif

#endif
94 changes: 94 additions & 0 deletions firmware/app/libs/libconops/src/conops.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
#include <conops/conops.h>
#include <string.h>

int conops_fsm_init(struct conops_fsm *fsm, const void *transition_table, const uint16_t n_states,
const uint16_t max_ev_id, const uint16_t init_state,
conops_init_callback_t callback)
{
if (!fsm || !transition_table)
return -ERRNO_CONOPS_INVALID_ARG;

if (init_state >= n_states)
return -ERRNO_CONOPS_INVALID_STATE;

fsm->ev_mapper_fn = NULL;
fsm->user_data = NULL;
fsm->transition_table = transition_table;
fsm->conf.n_states = n_states;
fsm->conf.max_ev_id = (max_ev_id != 0) ? max_ev_id : CONOPS_DEFAULT_MAX_EV_ID;
fsm->conf.init_state = init_state;
fsm->state = init_state;

if (callback) {
return callback(fsm);
}

return 0;
}

int conops_fsm_process_event(struct conops_fsm *fsm, const struct conops_event *ev)
{
int err = 0;

if (!fsm || !ev)
return -ERRNO_CONOPS_INVALID_ARG;

if (!fsm->transition_table)
return -ERRNO_CONOPS_NO_TRANSITION_TABLE;

if (ev->ev_id > fsm->conf.max_ev_id)
return -ERRNO_CONOPS_INVALID_EV_ID;

if (!fsm->ev_mapper_fn)
return -ERRNO_CONOPS_NO_MAPPER_FUNCTION;

int32_t transition_to = fsm->ev_mapper_fn(fsm, ev);

if (transition_to < 0)
return -ERRNO_CONOPS_MAPPING_ERROR;

const conops_transition_handler_t(*table)[fsm->conf.n_states] =
(const conops_transition_handler_t(*)[fsm->conf.n_states])fsm->transition_table;

conops_transition_handler_t handler = table[fsm->state][transition_to];

if (transition_to == fsm->state)
goto ev_callback_run;

if (handler) {
err = handler(fsm, ev, transition_to);

if (err < 0)
return err;
} else {
return -ERRNO_CONOPS_INVALID_TRANSITION;
}

ev_callback_run:
if (ev->callback)
ev->callback(fsm, ev);

fsm->last_valid_ev_id = ev->ev_id;

return 0;
}

int conops_register_mapper(struct conops_fsm *fsm, conops_event_mapper_t mapper)
{
if (!fsm || !mapper)
return -ERRNO_CONOPS_INVALID_ARG;

fsm->ev_mapper_fn = mapper;

return 0;
}

int conops_register_fsm_user_data(struct conops_fsm *fsm, void *user_data)
{
if (!fsm || !user_data)
return -ERRNO_CONOPS_INVALID_ARG;

fsm->user_data = user_data;

return 0;
}
Loading