From 4d758ddd132738a94872d1e1cee689b1107fb667 Mon Sep 17 00:00:00 2001 From: Dave Marples Date: Tue, 3 Sep 2024 21:50:33 +0100 Subject: [PATCH] Add protocol error count information to status line --- Inc/cobs.h | 4 ++++ Inc/oflow.h | 9 ++++++++- Src/orbuculum.c | 3 ++- 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/Inc/cobs.h b/Inc/cobs.h index ee52e904..2b0827f7 100644 --- a/Inc/cobs.h +++ b/Inc/cobs.h @@ -62,6 +62,10 @@ void COBSPump( struct COBS *t, const uint8_t *incoming, int len, void ( *packetRxed )( struct Frame *p, void *param ), void *param ); void COBSDelete( struct COBS *t ); +static inline int COBSGetErrors( struct COBS *t ) +{ + return t ? t->error : 0; +} struct COBS *COBSInit( struct COBS *t ); // ==================================================================================================== #ifdef __cplusplus diff --git a/Inc/oflow.h b/Inc/oflow.h index 8554e4bc..a299ebc3 100644 --- a/Inc/oflow.h +++ b/Inc/oflow.h @@ -62,7 +62,14 @@ void OFLOWEncode( const uint8_t channel, const uint64_t tstamp, const uint8_t *i void OFLOWPump( struct OFLOW *t, const uint8_t *incoming, int len, void ( *packetRxed )( struct OFLOWFrame *p, void *param ), void *param ); - +static inline uint64_t OFLOWGetErrors( struct OFLOW *t ) +{ + return t ? t->perror : ( uint64_t ) -1; +} +static inline uint64_t OFLOWGetCOBSErrors( struct OFLOW *t ) +{ + return t ? COBSGetErrors( &t->c ) : -1; +} void OFLOWDelete( struct OFLOW *t ); struct OFLOW *OFLOWInit( struct OFLOW *t ); // ==================================================================================================== diff --git a/Src/orbuculum.c b/Src/orbuculum.c index 329f19e1..34a1ee95 100644 --- a/Src/orbuculum.c +++ b/Src/orbuculum.c @@ -72,7 +72,7 @@ /* Number of potential tags */ #define NUM_TAGS (256) -#define LAST_TAG_SEEN_TIME_NS (500L*1000L*1000L) +#define LAST_TAG_SEEN_TIME_NS (2*1000L*1000L*1000L) /* Record of transferred data per tag */ struct TagDataCount @@ -784,6 +784,7 @@ void _checkInterval( void *params ) genericsPrintf( "(" C_DATA " %3d%% " C_RESET "full)", ( fullPercent > 100 ) ? 100 : fullPercent ); } + genericsReport( V_INFO, "Ce=%d Oe=%d", OFLOWGetCOBSErrors( &_r.oflow ), OFLOWGetErrors( &_r.oflow ) ); genericsPrintf( " " C_RESET C_CLR_LN EOL ); }