-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
firmware: app: tasks: param_server: Adding OBDH communication handling …
- Loading branch information
1 parent
a9f1c2d
commit 93b0a54
Showing
2 changed files
with
78 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,7 +26,7 @@ | |
* \author Gabriel Mariano Marcelino <[email protected]> | ||
* \author André M. P. de Mattos <[email protected]> | ||
* | ||
* \version 0.2.6 | ||
* \version 0.2.8 | ||
* | ||
* \date 2021/07/24 | ||
* | ||
|
@@ -66,46 +66,91 @@ void vTaskParamServer(void *pvParameters) | |
/* Process interrupt from UART ISR. */ | ||
if ( (ulNotifiedValue & NOTIFICATION_VALUE_FROM_I2C_ISR) != 0) | ||
{ | ||
/* TO DO. */ | ||
if (obdh_decode(&adr, &val, &cmd)) | ||
{ | ||
sys_log_print_event_from_module(SYS_LOG_INFO, TASK_PARAM_SERVER_NAME, "OBDH command received: "); | ||
sys_log_print_msg("cmd="); | ||
sys_log_print_int(cmd); | ||
sys_log_new_line(); | ||
|
||
switch(cmd) | ||
{ | ||
case OBDH_COMMAND_WRITE: | ||
if (eps_buffer_write(adr, &val) != 0) | ||
{ | ||
sys_log_print_event_from_module(SYS_LOG_ERROR, TASK_PARAM_SERVER_NAME, "OBDH write command has failed to complete!"); | ||
sys_log_new_line(); | ||
} | ||
break; | ||
case OBDH_COMMAND_READ: | ||
if (eps_buffer_read(adr, &val) != 0) | ||
{ | ||
sys_log_print_event_from_module(SYS_LOG_ERROR, TASK_PARAM_SERVER_NAME, "OBDH read command has failed to complete (buffer)!"); | ||
sys_log_new_line(); | ||
} | ||
else | ||
{ | ||
if (obdh_answer(adr, val) != 0) | ||
{ | ||
sys_log_print_event_from_module(SYS_LOG_ERROR, TASK_PARAM_SERVER_NAME, "OBDH read command has failed to complete (answer)!"); | ||
sys_log_new_line(); | ||
} | ||
} | ||
break; | ||
default: | ||
break; | ||
} | ||
} | ||
else | ||
{ | ||
sys_log_print_event_from_module(SYS_LOG_ERROR, TASK_PARAM_SERVER_NAME, "The received OBDH command was corrupted!"); | ||
sys_log_new_line(); | ||
} | ||
} | ||
|
||
/* Process interrupt from UART ISR. */ | ||
if ( (ulNotifiedValue & NOTIFICATION_VALUE_FROM_UART_ISR) != 0) | ||
{ | ||
ttc_decode(&adr, &val, &cmd); | ||
|
||
sys_log_print_event_from_module(SYS_LOG_INFO, TASK_PARAM_SERVER_NAME, "TTC command received: "); | ||
sys_log_print_msg("cmd="); | ||
sys_log_print_int(cmd); | ||
sys_log_new_line(); | ||
|
||
switch(cmd) | ||
if (ttc_decode(&adr, &val, &cmd)) | ||
{ | ||
case TTC_COMMAND_WRITE: | ||
if (eps_buffer_write(adr, &val) != 0) | ||
{ | ||
sys_log_print_event_from_module(SYS_LOG_ERROR, TASK_PARAM_SERVER_NAME, "TTC write command has failed to complete!"); | ||
sys_log_new_line(); | ||
} | ||
break; | ||
case TTC_COMMAND_READ: | ||
if (eps_buffer_read(adr, &val) != 0) | ||
{ | ||
sys_log_print_event_from_module(SYS_LOG_ERROR, TASK_PARAM_SERVER_NAME, "TTC read command has failed to complete!"); | ||
sys_log_new_line(); | ||
} | ||
else | ||
{ | ||
if (ttc_answer(adr, val) != 0) | ||
sys_log_print_event_from_module(SYS_LOG_INFO, TASK_PARAM_SERVER_NAME, "TTC command received: "); | ||
sys_log_print_msg("cmd="); | ||
sys_log_print_int(cmd); | ||
sys_log_new_line(); | ||
|
||
switch(cmd) | ||
{ | ||
case TTC_COMMAND_WRITE: | ||
if (eps_buffer_write(adr, &val) != 0) | ||
{ | ||
sys_log_print_event_from_module(SYS_LOG_ERROR, TASK_PARAM_SERVER_NAME, "TTC read command has failed to complete!"); | ||
sys_log_print_event_from_module(SYS_LOG_ERROR, TASK_PARAM_SERVER_NAME, "TTC write command has failed to complete!"); | ||
sys_log_new_line(); | ||
} | ||
} | ||
break; | ||
default: | ||
break; | ||
break; | ||
case TTC_COMMAND_READ: | ||
if (eps_buffer_read(adr, &val) != 0) | ||
{ | ||
sys_log_print_event_from_module(SYS_LOG_ERROR, TASK_PARAM_SERVER_NAME, "TTC read command has failed to complete (buffer)!"); | ||
sys_log_new_line(); | ||
} | ||
else | ||
{ | ||
if (ttc_answer(adr, val) != 0) | ||
{ | ||
sys_log_print_event_from_module(SYS_LOG_ERROR, TASK_PARAM_SERVER_NAME, "TTC read command has failed to complete (answer)!"); | ||
sys_log_new_line(); | ||
} | ||
} | ||
break; | ||
default: | ||
break; | ||
} | ||
} | ||
else | ||
{ | ||
sys_log_print_event_from_module(SYS_LOG_ERROR, TASK_PARAM_SERVER_NAME, "The received TTC command was corrupted!"); | ||
sys_log_new_line(); | ||
} | ||
} | ||
} | ||
else | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,7 +25,7 @@ | |
* | ||
* \author Gabriel Mariano Marcelino <[email protected]> | ||
* | ||
* \version 0.2.7 | ||
* \version 0.2.8 | ||
* | ||
* \date 2020/10/21 | ||
* | ||
|
@@ -36,7 +36,7 @@ | |
#ifndef VERSION_H_ | ||
#define VERSION_H_ | ||
|
||
#define FIRMWARE_VERSION "0.2.7" | ||
#define FIRMWARE_VERSION "0.2.8" | ||
|
||
#define FIRMWARE_STATUS "Development" | ||
|
||
|