Skip to content

Commit

Permalink
Merge pull request #348 from spacelab-ufsc/ttc_protocol_feature
Browse files Browse the repository at this point in the history
Updates communication protocol for Spacelab TTC 2.0, closes #343.
  • Loading branch information
c-porto authored May 13, 2024
2 parents ad660ba + b46cb11 commit d33435c
Show file tree
Hide file tree
Showing 17 changed files with 806 additions and 543 deletions.
5 changes: 3 additions & 2 deletions firmware/app/tasks/process_tc.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,9 @@
* \brief Process TC task implementation.
*
* \author Gabriel Mariano Marcelino <[email protected]>
* \author Carlos Augusto Porto Freitas <[email protected]>
*
* \version 0.10.13
* \version 0.10.14
*
* \date 2021/07/06
*
Expand Down Expand Up @@ -251,7 +252,7 @@ void vTaskProcessTC(void)
uint8_t pkt[300] = {0};
uint16_t pkt_len = 0;

if (ttc_recv(TTC_1, pkt, &pkt_len) != 0)
if (ttc_recv(TTC_1, pkt, &pkt_len) == 0)
{
switch(pkt[0])
{
Expand Down
9 changes: 5 additions & 4 deletions firmware/app/tasks/process_tc.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* process_tc.h
*
* Copyright (C) 2021, SpaceLab.
* Copyright The OBDH 2.0 Contributors.
*
* This file is part of OBDH 2.0.
*
Expand All @@ -24,8 +24,9 @@
* \brief Process TC task definition.
*
* \author Gabriel Mariano Marcelino <[email protected]>
* \author Carlos Augusto Porto Freitas <[email protected]>
*
* \version 0.7.47
* \version 0.10.14
*
* \date 2021/07/06
*
Expand All @@ -43,8 +44,8 @@
#define TASK_PROCESS_TC_NAME "Process TC" /**< Task name. */
#define TASK_PROCESS_TC_STACK_SIZE 500 /**< Stack size in bytes. */
#define TASK_PROCESS_TC_PRIORITY 4 /**< Task priority. */
#define TASK_PROCESS_TC_PERIOD_MS 5 /**< Task period in milliseconds. */
#define TASK_PROCESS_TC_INITIAL_DELAY_MS 1000 /**< Delay, in milliseconds, before the first execution. */
#define TASK_PROCESS_TC_PERIOD_MS 1000 /**< Task period in milliseconds. */
#define TASK_PROCESS_TC_INITIAL_DELAY_MS 2000 /**< Delay, in milliseconds, before the first execution. */
#define TASK_PROCESS_TC_INIT_TIMEOUT_MS (10*1000) /**< Wait time to initialize the task in milliseconds. */

/**
Expand Down
8 changes: 6 additions & 2 deletions firmware/app/tasks/read_ttc.c
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* read_ttc.c
*
* Copyright (C) 2021, SpaceLab.
* Copyright The OBDH 2.0 Contributors.
*
* This file is part of OBDH 2.0.
*
Expand All @@ -24,8 +24,9 @@
* \brief Read TTC data task implementation.
*
* \author Gabriel Mariano Marcelino <[email protected]>
* \author Carlos Augusto Porto Freitas <[email protected]>
*
* \version 0.8.5
* \version 0.10.14
*
* \date 2021/05/14
*
Expand All @@ -48,6 +49,9 @@ void vTaskReadTTC(void)
/* Wait startup task to finish */
xEventGroupWaitBits(task_startup_status, TASK_STARTUP_DONE, pdFALSE, pdTRUE, pdMS_TO_TICKS(TASK_READ_TTC_INIT_TIMEOUT_MS));

/* Delay before the first cycle */
vTaskDelay(pdMS_TO_TICKS(TASK_READ_TTC_INITIAL_DELAY_MS));

while(1)
{
TickType_t last_cycle = xTaskGetTickCount();
Expand Down
6 changes: 4 additions & 2 deletions firmware/app/tasks/read_ttc.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* read_ttc.h
*
* Copyright (C) 2021, SpaceLab.
* Copyright The OBDH 2.0 Contributors.
*
* This file is part of OBDH 2.0.
*
Expand All @@ -24,8 +24,9 @@
* \brief Read TTC data task definition.
*
* \author Gabriel Mariano Marcelino <[email protected]>
* \author Carlos Augusto Porto Freitas <[email protected]>
*
* \version 0.7.47
* \version 0.10.14
*
* \date 2021/05/14
*
Expand All @@ -44,6 +45,7 @@
#define TASK_READ_TTC_STACK_SIZE 384 /**< Stack size in bytes. */
#define TASK_READ_TTC_PRIORITY 3 /**< Task priority. */
#define TASK_READ_TTC_PERIOD_MS (60000) /**< Task period in milliseconds. */
#define TASK_READ_TTC_INITIAL_DELAY_MS 1000 /**< Delay, in milliseconds, before the first execution. */
#define TASK_READ_TTC_INIT_TIMEOUT_MS 2000 /**< Wait time to initialize the task in milliseconds. */

/**
Expand Down
4 changes: 2 additions & 2 deletions firmware/config/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
*
* \author Gabriel Mariano Marcelino <[email protected]>
*
* \version 0.10.12
* \version 0.10.14
*
* \date 2019/10/26
*
Expand Down Expand Up @@ -123,7 +123,7 @@
#define CONFIG_DATA_ID_ANT 4

/* Ports */
#define CONFIG_SPI_PORT_0_SPEED_BPS 100000UL
#define CONFIG_SPI_PORT_0_SPEED_BPS 1000000UL

/* Antenna */
#define CONFIG_ANTENNA_INDEP_DEPLOY_BURN_TIME_SEC 10U
Expand Down
Loading

0 comments on commit d33435c

Please sign in to comment.