Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge pull request from isis_antenna_status_fix #342

Merged
merged 4 commits into from
Oct 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
13 changes: 11 additions & 2 deletions firmware/app/tasks/read_antenna.c
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* read_antenna.c
*
* Copyright (C) 2021, SpaceLab.
* Copyright The OBDH 2.0 Contributors.
*
* This file is part of OBDH 2.0.
*
Expand All @@ -25,7 +25,7 @@
*
* \author Gabriel Mariano Marcelino <[email protected]>
*
* \version 0.8.6
* \version 0.10.9
*
* \date 2021/10/13
*
Expand Down Expand Up @@ -61,6 +61,15 @@ void vTaskReadAntenna(void)
if (antenna_get_data(&sat_data_buf.antenna.data) == 0)
{
sat_data_buf.antenna.timestamp = system_get_time();

sys_log_print_event_from_module(SYS_LOG_INFO, TASK_READ_ANTENNA_NAME, "Temperature: ");
sys_log_print_uint(sat_data_buf.antenna.data.temperature);
sys_log_print_msg(" K");
sys_log_new_line();

sys_log_print_event_from_module(SYS_LOG_INFO, TASK_READ_ANTENNA_NAME, "Status: ");
sys_log_print_hex(sat_data_buf.antenna.data.status.code);
sys_log_new_line();
}
else
{
Expand Down
4 changes: 2 additions & 2 deletions firmware/drivers/isis_antenna/isis_antenna.c
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.8
* \version 0.10.9
*
* \date 2020/02/01
*
Expand Down Expand Up @@ -268,7 +268,7 @@ int isis_antenna_read_deployment_status_code(uint16_t *status)

if (isis_antenna_i2c_read(status_bytes, 2) == 0)
{
status_code = ((uint16_t)status_bytes[0] << 8) | (uint16_t)status_bytes[1];
status_code = ((uint16_t)status_bytes[1] << 8) | (uint16_t)status_bytes[0];

*status = status_code;

Expand Down
1 change: 1 addition & 0 deletions firmware/tests/drivers/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
* TCA4311A
* EDC
* ISIS Antenna
* Payload-X
* SpaceLab EPS 2.0
* MT25Q
* SpaceLab TTC 2.0
32 changes: 16 additions & 16 deletions firmware/tests/drivers/isis_antenna_test.c
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.8
* \version 0.10.9
*
* \date 2021/09/01
*
Expand Down Expand Up @@ -83,7 +83,7 @@ static void isis_antenna_arm_test(void **state)

write_test(&cmd, 1);

uint8_t ans[2] = {0x00, 0x01};
uint8_t ans[2] = {0x01, 0x00};

read_test(ans, 2);

Expand Down Expand Up @@ -161,8 +161,8 @@ static void isis_antenna_read_deployment_status_code_test(void **state)

uint8_t ans[2] = {0};

ans[0] = raw_status >> 8;
ans[1] = raw_status & 0xFF;
ans[0] = raw_status & 0xFF;
ans[1] = raw_status >> 8;

read_test(ans, 2);

Expand All @@ -183,8 +183,8 @@ static void isis_antenna_read_deployment_status_test(void **state)

uint16_t raw_status = generate_random(0, UINT16_MAX);

ans[0] = raw_status >> 8;
ans[1] = raw_status & 0xFF;
ans[0] = raw_status & 0xFF;
ans[1] = raw_status >> 8;

read_test(ans, 2);

Expand Down Expand Up @@ -221,8 +221,8 @@ static void isis_antenna_get_data_test(void **state)

uint16_t raw_status = generate_random(0, UINT16_MAX);

ans[0] = raw_status >> 8;
ans[1] = raw_status & 0xFF;
ans[0] = raw_status & 0xFF;
ans[1] = raw_status >> 8;

read_test(ans, 2);

Expand Down Expand Up @@ -296,8 +296,8 @@ static void isis_antenna_get_antenna_status_test(void **state)

uint16_t raw_status = generate_random(0, UINT16_MAX);

ans[0] = raw_status >> 8;
ans[1] = raw_status & 0xFF;
ans[0] = raw_status & 0xFF;
ans[1] = raw_status >> 8;

read_test(ans, 2);

Expand Down Expand Up @@ -349,8 +349,8 @@ static void isis_antenna_get_antenna_timeout_test(void **state)

uint16_t raw_status = generate_random(0, UINT16_MAX);

ans[0] = raw_status >> 8;
ans[1] = raw_status & 0xFF;
ans[0] = raw_status & 0xFF;
ans[1] = raw_status >> 8;

read_test(ans, 2);

Expand Down Expand Up @@ -402,8 +402,8 @@ static void isis_antenna_get_burning_test(void **state)

uint16_t raw_status = generate_random(0, UINT16_MAX);

ans[0] = raw_status >> 8;
ans[1] = raw_status & 0xFF;
ans[0] = raw_status & 0xFF;
ans[1] = raw_status >> 8;

read_test(ans, 2);

Expand Down Expand Up @@ -439,8 +439,8 @@ static void isis_antenna_get_arming_status_test(void **state)

uint16_t raw_status = generate_random(0, UINT16_MAX);

ans[0] = raw_status >> 8;
ans[1] = raw_status & 0xFF;
ans[0] = raw_status & 0xFF;
ans[1] = raw_status >> 8;

read_test(ans, 2);

Expand Down