Skip to content

Commit

Permalink
Fix #146, Support scheduled uplink check
Browse files Browse the repository at this point in the history
  • Loading branch information
skliper committed Nov 15, 2023
1 parent 6e55bb4 commit d17cb04
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 4 deletions.
5 changes: 3 additions & 2 deletions config/default_ci_lab_msgids.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,9 @@
#ifndef CI_LAB_MSGIDS_H
#define CI_LAB_MSGIDS_H

#define CI_LAB_CMD_MID 0x1884
#define CI_LAB_SEND_HK_MID 0x1885
#define CI_LAB_CMD_MID 0x1884
#define CI_LAB_SEND_HK_MID 0x1885
#define CI_LAB_READ_UPLINK_MID 0x1886

#define CI_LAB_HK_TLM_MID 0x0884

Expand Down
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 d17cb04

Please sign in to comment.