Skip to content

Commit

Permalink
feat: Adds english output to FLOG dump
Browse files Browse the repository at this point in the history
  • Loading branch information
ntlhui committed Nov 1, 2024
1 parent e2cc59c commit a3a5f7a
Showing 1 changed file with 18 additions and 4 deletions.
22 changes: 18 additions & 4 deletions src/cli/flog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ void FLOG_AddError(FLOG_CODE_e errorCode, FLOG_VALUE_TYPE parameter)
void FLOG_DisplayLog(void)
{
uint32_t i;
const FLOG_Entry_t *pEntry;
if (!FLOG_IsInitialized())
{
SF_OSAL_printf("Fault Log not initialized!" __NL__);
Expand All @@ -147,10 +148,23 @@ void FLOG_DisplayLog(void)

for (; i < flogData.numEntries; i++)
{
SF_OSAL_printf("%8d %32s, parameter: 0x%08" FLOG_PARAM_FMT __NL__,
flogData.flogEntries[i & (FLOG_NUM_ENTRIES - 1)].timestamp_ms,
FLOG_FindMessage((FLOG_CODE_e)flogData.flogEntries[i & (FLOG_NUM_ENTRIES - 1)].errorCode),
flogData.flogEntries[i & (FLOG_NUM_ENTRIES - 1)].param);
pEntry = &flogData.flogEntries[i & (FLOG_NUM_ENTRIES - 1)];
switch (pEntry->errorCode)
{
case FLOG_SYS_START:
SF_OSAL_printf("%8d System Started at %s" __NL__,
pEntry->timestamp_ms,
Time.format((time32_t)pEntry->param).c_str());
break;
default:
SF_OSAL_printf(
"%8d %32s, parameter: 0x%08" FLOG_PARAM_FMT __NL__,
flogData.flogEntries[i & (FLOG_NUM_ENTRIES - 1)].timestamp_ms,
FLOG_FindMessage(
(FLOG_CODE_e)flogData.flogEntries[i & (FLOG_NUM_ENTRIES - 1)].errorCode),
flogData.flogEntries[i & (FLOG_NUM_ENTRIES - 1)].param);
break;
}
}
SF_OSAL_printf(__NL__);
}
Expand Down

0 comments on commit a3a5f7a

Please sign in to comment.