Skip to content

CS_EnableEntryIDEepromCmd reporting the wrong State variable in error event #105

@thnkslprpt

Description

@thnkslprpt

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
It seems like the error event (CS_ENABLE_EEPROM_DEF_EMPTY_DBG_EID) in CS_EnableEntryIDEepromCmd probably wants the CS_AppData.DefEepromTblPtr[EntryID] State, not the local function State variable, which is intended for use in the CS_ENABLE_EEPROM_INVALID_ENTRY_ERR_EID event message.

Code snips

CS/fsw/src/cs_eeprom_cmds.c

Lines 223 to 276 in f958cc0

void CS_EnableEntryIDEepromCmd(const CS_EntryCmd_t *CmdPtr)
{
/* command verification variables */
CS_Res_EepromMemory_Table_Entry_t *ResultsEntry = NULL;
uint16 EntryID = 0;
uint16 State = CS_STATE_EMPTY;
if (CS_CheckRecomputeOneshot() == false)
{
EntryID = CmdPtr->Payload.EntryID;
if ((EntryID < CS_MAX_NUM_EEPROM_TABLE_ENTRIES) &&
(CS_AppData.ResEepromTblPtr[EntryID].State != CS_STATE_EMPTY))
{
ResultsEntry = &CS_AppData.ResEepromTblPtr[EntryID];
ResultsEntry->State = CS_STATE_ENABLED;
CFE_EVS_SendEvent(CS_ENABLE_EEPROM_ENTRY_INF_EID, CFE_EVS_EventType_INFORMATION,
"Checksumming of EEPROM Entry ID %d is Enabled", EntryID);
if (CS_AppData.DefEepromTblPtr[EntryID].State != CS_STATE_EMPTY)
{
CS_AppData.DefEepromTblPtr[EntryID].State = CS_STATE_ENABLED;
CS_ResetTablesTblResultEntry(CS_AppData.EepResTablesTblPtr);
CFE_TBL_Modified(CS_AppData.DefEepromTableHandle);
}
else
{
CFE_EVS_SendEvent(CS_ENABLE_EEPROM_DEF_EMPTY_DBG_EID, CFE_EVS_EventType_DEBUG,
"CS unable to update EEPROM definition table for entry %d, State: %d", EntryID,
State);
}
CS_AppData.HkPacket.Payload.CmdCounter++;
}
else
{
if (EntryID >= CS_MAX_NUM_EEPROM_TABLE_ENTRIES)
{
State = CS_STATE_UNDEFINED;
}
else
{
State = CS_AppData.ResEepromTblPtr[EntryID].State;
}
CFE_EVS_SendEvent(CS_ENABLE_EEPROM_INVALID_ENTRY_ERR_EID, CFE_EVS_EventType_ERROR,
"Enable EEPROM entry failed, invalid Entry ID: %d, State: %d, Max ID: %d", EntryID,
State, (CS_MAX_NUM_EEPROM_TABLE_ENTRIES - 1));
CS_AppData.HkPacket.Payload.CmdErrCounter++;
}
} /* end InProgress if */
}

Expected behavior
Use the correct State in the error event.

Reporter Info
Avi Weiss   @thnkslprpt

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions