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

Fix #50, Mark end of valid MsgId subscriptions #51

Merged
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
3 changes: 3 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
cmake_minimum_required(VERSION 2.6.4)
project(CFS_TO_LAB C)

# Include source directory for table use
include_directories(fsw/src)

include_directories(fsw/mission_inc)
include_directories(fsw/platform_inc)
include_directories(${ci_lab_MISSION_DIR}/fsw/platform_inc)
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ To send telemtry to the "ground" or UDP/IP port, edit the subscription table in
- Fix for a clean build with OMIT_DEPRECATED
- Minor updates (see <https://github.com/nasa/to_lab/pull/26>)

### _**OFFICIAL RELEASE: 2.3.0**_
### _**OFFICIAL RELEASE: 2.3.0 - Aquila**_

- Minor updates (see <https://github.com/nasa/to_lab/pull/13>)

Expand Down
9 changes: 8 additions & 1 deletion fsw/src/to_lab_app.c
Original file line number Diff line number Diff line change
Expand Up @@ -227,9 +227,16 @@ int TO_LAB_init(void)
/* Subscriptions for TLM pipe*/
for (i = 0; (i < (sizeof(TO_LAB_Subs->Subs) / sizeof(TO_LAB_Subs->Subs[0]))); i++)
{
if (CFE_SB_IsValidMsgId(TO_LAB_Subs->Subs[i].Stream))
if (CFE_SB_MsgId_Equal(TO_LAB_Subs->Subs[i].Stream, TO_UNUSED))
{
/* Only process until MsgId TO_UNUSED is found*/
break;
}
else if (CFE_SB_IsValidMsgId(TO_LAB_Subs->Subs[i].Stream))
{
status = CFE_SB_SubscribeEx(TO_LAB_Subs->Subs[i].Stream, TO_LAB_Global.Tlm_pipe, TO_LAB_Subs->Subs[i].Flags,
TO_LAB_Subs->Subs[i].BufLimit);
}

if (status != CFE_SUCCESS)
CFE_EVS_SendEvent(TO_SUBSCRIBE_ERR_EID, CFE_EVS_EventType_ERROR,
Expand Down
6 changes: 5 additions & 1 deletion fsw/tables/to_lab_sub.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
#include "cfe_tbl_filedef.h" /* Required to obtain the CFE_TBL_FILEDEF macro definition */

#include "to_lab_sub_table.h"
#include "to_lab_app.h"

/*
** Add the proper include file for the message IDs below
Expand Down Expand Up @@ -86,7 +87,10 @@ TO_LAB_Subs_t TO_LAB_Subs =
#endif

{CFE_SB_MSGID_WRAP_VALUE(CFE_ES_APP_TLM_MID), {0, 0}, 4},
{CFE_SB_MSGID_WRAP_VALUE(CFE_ES_MEMSTATS_TLM_MID), {0, 0}, 4}
{CFE_SB_MSGID_WRAP_VALUE(CFE_ES_MEMSTATS_TLM_MID), {0, 0}, 4},

/* TO_UNUSED entry to mark the end of valid MsgIds */
{TO_UNUSED, {0, 0}, 0}
}
};

Expand Down