Skip to content

Commit

Permalink
Fix nasa#146, Support scheduled uplink check
Browse files Browse the repository at this point in the history
  • Loading branch information
skliper committed Jan 11, 2024
1 parent 1e83c77 commit 9545afa
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 8 deletions.
7 changes: 4 additions & 3 deletions config/default_ci_lab_msgids.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,9 @@
#include "cfe_core_api_base_msgids.h"
#include "ci_lab_topicids.h"

#define CI_LAB_CMD_MID CFE_PLATFORM_CMD_TOPICID_TO_MIDV(CFE_MISSION_CI_LAB_CMD_TOPICID)
#define CI_LAB_SEND_HK_MID CFE_PLATFORM_CMD_TOPICID_TO_MIDV(CFE_MISSION_CI_LAB_SEND_HK_TOPICID)
#define CI_LAB_HK_TLM_MID CFE_PLATFORM_TLM_TOPICID_TO_MIDV(CFE_MISSION_CI_LAB_HK_TLM_TOPICID)
#define CI_LAB_CMD_MID CFE_PLATFORM_CMD_TOPICID_TO_MIDV(CFE_MISSION_CI_LAB_CMD_TOPICID)
#define CI_LAB_SEND_HK_MID CFE_PLATFORM_CMD_TOPICID_TO_MIDV(CFE_MISSION_CI_LAB_SEND_HK_TOPICID)
#define CI_LAB_READ_UPLINK_MID CFE_PLATFORM_CMD_TOPICID_TO_MIDV(CFE_MISSION_CI_LAB_READ_UPLINK_TOPICID)
#define CI_LAB_HK_TLM_MID CFE_PLATFORM_TLM_TOPICID_TO_MIDV(CFE_MISSION_CI_LAB_HK_TLM_TOPICID)

#endif
7 changes: 4 additions & 3 deletions config/default_ci_lab_topicids.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,9 @@
#ifndef CI_LAB_TOPICIDS_H
#define CI_LAB_TOPICIDS_H

#define CFE_MISSION_CI_LAB_CMD_TOPICID 0x84
#define CFE_MISSION_CI_LAB_SEND_HK_TOPICID 0x85
#define CFE_MISSION_CI_LAB_HK_TLM_TOPICID 0x84
#define CFE_MISSION_CI_LAB_CMD_TOPICID 0x84
#define CFE_MISSION_CI_LAB_SEND_HK_TOPICID 0x85
#define CFE_MISSION_CI_LAB_READ_UPLINK_TOPICID 0x86
#define CFE_MISSION_CI_LAB_HK_TLM_TOPICID 0x84

#endif
1 change: 1 addition & 0 deletions fsw/inc/ci_lab_eventids.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
#define CI_LAB_CR_PIPE_ERR_EID 11
#define CI_LAB_SB_SUBSCRIBE_CMD_ERR_EID 12
#define CI_LAB_SB_SUBSCRIBE_HK_ERR_EID 13
#define CI_LAB_SB_SUBSCRIBE_UL_ERR_EID 14
#define CI_LAB_CMD_LEN_ERR_EID 16

#endif
11 changes: 9 additions & 2 deletions fsw/src/ci_lab_app.c
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,8 @@ void CI_LAB_AppMain(void)
CI_LAB_TaskPipe(SBBufPtr);
}

/* Regardless of packet vs timeout, always process uplink queue */
if (CI_LAB_Global.SocketConnected)
/* Regardless of packet vs timeout, always process uplink queue if not scheduled */
if (CI_LAB_Global.SocketConnected && !CI_LAB_Global.Scheduled)
{
CI_LAB_ReadUpLink();
}
Expand Down Expand Up @@ -129,6 +129,13 @@ void CI_LAB_TaskInit(void)
CFE_EVS_SendEvent(CI_LAB_SB_SUBSCRIBE_HK_ERR_EID, CFE_EVS_EventType_ERROR,
"Error subscribing to SB HK Request, RC = 0x%08X", (unsigned int)status);
}

status = CFE_SB_Subscribe(CFE_SB_ValueToMsgId(CI_LAB_READ_UPLINK_MID), CI_LAB_Global.CommandPipe);
if (status != CFE_SUCCESS)
{
CFE_EVS_SendEvent(CI_LAB_SB_SUBSCRIBE_UL_ERR_EID, CFE_EVS_EventType_ERROR,
"Error subscribing to SB Read Uplink Request, RC = 0x%08X", (unsigned int)status);
}
}
else
{
Expand Down
1 change: 1 addition & 0 deletions fsw/src/ci_lab_app.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
typedef struct
{
bool SocketConnected;
bool Scheduled;
CFE_SB_PipeId_t CommandPipe;
osal_id_t SocketID;
OS_SockAddr_t SocketAddress;
Expand Down
5 changes: 5 additions & 0 deletions fsw/src/ci_lab_dispatch.c
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,11 @@ void CI_LAB_TaskPipe(const CFE_SB_Buffer_t *SBBufPtr)
CI_LAB_SendHkCmd((const CI_LAB_SendHkCmd_t *)SBBufPtr);
break;

case CI_LAB_READ_UPLINK_MID:
CI_LAB_Global.Scheduled = true;
CI_LAB_ReadUpLink();
break;

default:
CI_LAB_Global.HkTlm.Payload.CommandErrorCounter++;
CFE_EVS_SendEvent(CI_LAB_MID_ERR_EID, CFE_EVS_EventType_ERROR, "CI: invalid command packet,MID = 0x%x",
Expand Down

0 comments on commit 9545afa

Please sign in to comment.