Skip to content

Commit

Permalink
Firmware: app: tasks: adding Payload-X read task #340
Browse files Browse the repository at this point in the history
  • Loading branch information
miguelboing committed Sep 19, 2023
1 parent 6506e15 commit b6a1d9c
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 6 deletions.
11 changes: 9 additions & 2 deletions firmware/app/tasks/read_px.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ pl_px_buf_t px_buf = {0};
void vTaskReadPX(void)
{
static payload_t pl_px_active = PAYLOAD_X;
px_buf.lenth = PX_PONG_BUF_SIZE;
px_buf.length = PX_PONG_BUF_SIZE;

/* Wait startup task to finish */
xEventGroupWaitBits(task_startup_status, TASK_STARTUP_DONE, pdFALSE, pdTRUE, pdMS_TO_TICKS(TASK_READ_PX_INIT_TIMEOUT_MS));
Expand All @@ -60,18 +60,25 @@ void vTaskReadPX(void)
if (payload_get_data(pl_px_active, PAYLOAD_X_PONG, px_buf.buffer, &px_buf.length) != 0)
{
sys_log_print_event_from_module(SYS_LOG_ERROR, TASK_READ_PX_NAME, "Error reading the ping-pong data!");

uint8_t i = 0;
for(i=0;i<px_buf.length;i++){
sys_log_print_uint(px_buf.buffer[i]);
}

sys_log_new_line();
}
else
{
sys_log_print_event_from_module(SYS_LOG_INFO, TASK_READ_PX_NAME, "Received Payload X packet:");
sys_log_new_line();

/*
uint8_t i = 0;
for(i=0;i<px_buf.length;i++){
sys_log_print_uint(px_buf.buffer[i]);
}

*/
}

vTaskDelayUntil(&last_cycle, pdMS_TO_TICKS(TASK_READ_PX_PERIOD_MS));
Expand Down
2 changes: 1 addition & 1 deletion firmware/app/tasks/read_px.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
*/
typedef struct
{
uint8_t buffer[30];
uint8_t buffer[4];
uint32_t length;
} pl_px_buf_t;

Expand Down
13 changes: 11 additions & 2 deletions firmware/app/tasks/tasks.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
*
* \author Gabriel Mariano Marcelino <gabriel.mm8@gmail.com>
*
* \version 0.10.7
* \version 0.9.18
*
* \date 2019/11/02
*
Expand All @@ -39,7 +39,6 @@
#include <config/config.h>

#include "tasks.h"
#include "antenna_deployment.h"
#include "startup.h"
#include "watchdog_reset.h"
#include "heartbeat.h"
Expand All @@ -53,6 +52,7 @@
#include "read_antenna.h"
#include "data_log.h"
#include "process_tc.h"
#include "read_px.h"

void create_tasks(void)
{
Expand Down Expand Up @@ -185,6 +185,15 @@ void create_tasks(void)
}
#endif /* CONFIG_TASK_ANTENNA_DEPLOYMENT_ENABLED */

#if defined(CONFIG_TASK_PAYLOAD_X_ENABLED) && (CONFIG_TASK_PAYLOAD_X_ENABLED == 1)
xTaskCreate(vTaskReadPX, TASK_READ_PX_NAME, TASK_READ_PX_STACK_SIZE, NULL, TASK_READ_PX_PRIORITY, &xTaskReadPXHandle);

if (xTaskReadPXHandle == NULL)
{
/* Error creating the Read PX task */
}
#endif /* CONFIG_TASK_PAYLOAD_X_ENABLED */

create_event_groups();
}

Expand Down
3 changes: 2 additions & 1 deletion firmware/config/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
#define CONFIG_TASK_DATA_LOG_ENABLED 1
#define CONFIG_TASK_PROCESS_TC_ENABLED 1
#define CONFIG_TASK_ANTENNA_DEPLOYMENT_ENABLED 0
#define CONFIG_TASK_PAYLOAD_X_ENABLED 1

/* Devices */
#define CONFIG_DEV_MEDIA_INT_ENABLED 1
Expand All @@ -63,7 +64,7 @@
#define CONFIG_DEV_EPS_ENABLED 1
#define CONFIG_DEV_PAYLOAD_EDC_ENABLED 1
#define CONFIG_DEV_ANTENNA_ENABLED 1
#define CONFIG_DEV_PAYLOAD_X_ENABLED 1
#define CONFIG_DEV_PAYLOAD_X_ENABLED 1

/* Drivers */
#define CONFIG_DRV_ISIS_ANTENNA_ENABLED 1
Expand Down

0 comments on commit b6a1d9c

Please sign in to comment.