Skip to content

Commit

Permalink
Next stage of COBS development, with TPIU channels in COBS frame header
Browse files Browse the repository at this point in the history
  • Loading branch information
mubes committed Sep 2, 2023
1 parent efe6cd3 commit 5b0abe4
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 12 deletions.
10 changes: 8 additions & 2 deletions Src/cobsDecoder.c
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,6 @@ void COBSPump( struct COBSDecoder *t, uint8_t *incoming, int len,
switch ( t->s )
{
case COBS_UNSYNCED: // ----------------------------------------------------------------

/* This case was already dealt with above */
if ( COBS_SYNC_CHAR == *fp )
{
packetRxed( COBS_EV_NEWSYNC, NULL, NULL );
Expand Down Expand Up @@ -154,6 +152,14 @@ void COBSPump( struct COBSDecoder *t, uint8_t *incoming, int len,
}
}

/* Check for frame overflow ... if it's max then error */
if ( COBS_MAX_PACKET_LEN == t->f.len )
{
t->stats.error++;
packetRxed( COBS_EV_ERROR, &t->f, param );
t->s = COBS_IDLE;
}

break;

case COBS_ERROR: // ------------------------------------------------------------------
Expand Down
12 changes: 2 additions & 10 deletions Src/orbuculum.c
Original file line number Diff line number Diff line change
Expand Up @@ -809,7 +809,7 @@ static void _COBSpacketRxed( enum COBSPumpEvent e, struct Frame *p, void *param

{


struct RunTime *r = ( struct RunTime * )param;

struct handlers *h;
Expand All @@ -819,13 +819,6 @@ static void _COBSpacketRxed( enum COBSPumpEvent e, struct Frame *p, void *param
switch ( e )
{
case COBS_EV_RXEDFRAME:
/////////////////////////////////////////////////////////////////////
//// HACK FOR CASE THAT COBS IS JUST TRANSITING RAW TPIU FRAMES /////
TPIUPump2( &r->t, p->d, p->len, _TPIUpacketRxed, r );
_purgeBlock( r );
break;
/////////////////////////////////////////////////////////////////////

if ( p->len > 1 )
{
incomingChannel = p->d[0];
Expand Down Expand Up @@ -855,8 +848,6 @@ static void _COBSpacketRxed( enum COBSPumpEvent e, struct Frame *p, void *param
_purgeBlock( r );
}
}

_purgeBlock( r );
}
}

Expand Down Expand Up @@ -916,6 +907,7 @@ static void _processBlock( struct RunTime *r, ssize_t fillLevel, uint8_t *buffer
{
/* Strip the COBS framing from this input */
COBSPump( &r->c, r->rawBlock[r->rp].buffer, r->rawBlock[r->rp].fillLevel, _COBSpacketRxed, r );
_purgeBlock( r );
}
else if ( r-> options->useTPIU )
{
Expand Down

0 comments on commit 5b0abe4

Please sign in to comment.