-
Notifications
You must be signed in to change notification settings - Fork 33
Open
Description
Checklist
- I reviewed the Contributing Guide.
- I performed a cursory search to see if the bug report is relevant, not redundant, nor in conflict with other tickets.
Describe the bug
State is only used in one event message, and initializing to CS_STATE_UNDEFINED would simplify the if/else before the event is sent.
Code snips
Lines 146 to 216 in f958cc0
| void CS_RecomputeBaselineMemoryCmd(const CS_EntryCmd_t *CmdPtr) | |
| { | |
| /* command verification variables */ | |
| CFE_ES_TaskId_t ChildTaskID = CFE_ES_TASKID_UNDEFINED; | |
| CFE_Status_t Status = CS_ERROR; | |
| uint16 EntryID = 0; | |
| uint16 State = CS_STATE_EMPTY; | |
| EntryID = CmdPtr->Payload.EntryID; | |
| if (CS_AppData.HkPacket.Payload.RecomputeInProgress == false && CS_AppData.HkPacket.Payload.OneShotInProgress == false) | |
| { | |
| /* make sure the entry is a valid number and is defined in the table */ | |
| if ((EntryID < CS_MAX_NUM_MEMORY_TABLE_ENTRIES) && | |
| (CS_AppData.ResMemoryTblPtr[EntryID].State != CS_STATE_EMPTY)) | |
| { | |
| /* There is no child task running right now, we can use it*/ | |
| CS_AppData.HkPacket.Payload.RecomputeInProgress = true; | |
| /* fill in child task variables */ | |
| CS_AppData.ChildTaskTable = CS_MEMORY_TABLE; | |
| CS_AppData.ChildTaskEntryID = EntryID; | |
| CS_AppData.RecomputeEepromMemoryEntryPtr = &CS_AppData.ResMemoryTblPtr[EntryID]; | |
| Status = | |
| CFE_ES_CreateChildTask(&ChildTaskID, CS_RECOMP_MEMORY_TASK_NAME, CS_RecomputeEepromMemoryChildTask, | |
| NULL, CFE_PLATFORM_ES_DEFAULT_STACK_SIZE, CS_CHILD_TASK_PRIORITY, 0); | |
| if (Status == CFE_SUCCESS) | |
| { | |
| CFE_EVS_SendEvent(CS_RECOMPUTE_MEMORY_STARTED_DBG_EID, CFE_EVS_EventType_DEBUG, | |
| "Recompute baseline of Memory Entry ID %d started", EntryID); | |
| CS_AppData.HkPacket.Payload.CmdCounter++; | |
| } | |
| else /* child task creation failed */ | |
| { | |
| CFE_EVS_SendEvent( | |
| CS_RECOMPUTE_MEMORY_CREATE_CHDTASK_ERR_EID, CFE_EVS_EventType_ERROR, | |
| "Recompute baseline of Memory Entry ID %d failed, ES_CreateChildTask returned: 0x%08X", | |
| EntryID, (unsigned int)Status); | |
| CS_AppData.HkPacket.Payload.CmdErrCounter++; | |
| CS_AppData.HkPacket.Payload.RecomputeInProgress = false; | |
| } | |
| } | |
| else | |
| { | |
| if (EntryID >= CS_MAX_NUM_MEMORY_TABLE_ENTRIES) | |
| { | |
| State = CS_STATE_UNDEFINED; | |
| } | |
| else | |
| { | |
| State = CS_AppData.ResMemoryTblPtr[EntryID].State; | |
| } | |
| CFE_EVS_SendEvent( | |
| CS_RECOMPUTE_INVALID_ENTRY_MEMORY_ERR_EID, CFE_EVS_EventType_ERROR, | |
| "Memory recompute baseline of entry failed, Entry ID invalid: %d, State: %d, Max ID: %d", EntryID, | |
| State, (CS_MAX_NUM_MEMORY_TABLE_ENTRIES - 1)); | |
| CS_AppData.HkPacket.Payload.CmdErrCounter++; | |
| } | |
| } | |
| else | |
| { | |
| /*send event that we can't start another task right now */ | |
| CFE_EVS_SendEvent(CS_RECOMPUTE_MEMORY_CHDTASK_ERR_EID, CFE_EVS_EventType_ERROR, | |
| "Recompute baseline of Memory Entry ID %d failed: child task in use", EntryID); | |
| CS_AppData.HkPacket.Payload.CmdErrCounter++; | |
| } | |
| } |
Reporter Info
Avi Weiss @thnkslprpt
Metadata
Metadata
Assignees
Labels
No labels