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

CS_EnableEntryIDEepromCmd reporting the wrong State variable in error event #105

Open
2 tasks done
thnkslprpt opened this issue Nov 30, 2024 · 0 comments · May be fixed by #106
Open
2 tasks done

CS_EnableEntryIDEepromCmd reporting the wrong State variable in error event #105

thnkslprpt opened this issue Nov 30, 2024 · 0 comments · May be fixed by #106

Comments

@thnkslprpt
Copy link
Contributor

thnkslprpt commented Nov 30, 2024

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

thnkslprpt added a commit to thnkslprpt/CS that referenced this issue Nov 30, 2024
thnkslprpt added a commit to thnkslprpt/CS that referenced this issue Nov 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant