Skip to content

Commit

Permalink
Pretty printing enhancements, and add 'bind' option to udev
Browse files Browse the repository at this point in the history
  • Loading branch information
mubes committed Aug 13, 2024
1 parent 7005376 commit e372f5a
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
24 changes: 12 additions & 12 deletions Src/orbuculum.c
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@

/* Number of potential tags */
#define NUM_TAGS (256)
#define LAST_TAG_SEEN_TIME_NS (5L*1000*1000*1000)
#define LAST_TAG_SEEN_TIME_NS (2L*1000*1000*1000)

/* Record of transferred data per tag */
struct TagDataCount
Expand Down Expand Up @@ -689,14 +689,12 @@ void _checkInterval( void *params )
{
r->lastInterval = tnow;

/* Grab the interval and scale to 1 second */
snapInterval = r->intervalRawBytes * 1000 / r->options->intervalReportTime;

snapInterval *= 8;
/* Grab the interval and scale to bits per 1 second */
snapInterval = r->intervalRawBytes * 8000L / r->options->intervalReportTime;

if ( r->conn )
{
genericsPrintf( C_CLR_LN C_DATA );
genericsPrintf( C_PREV_LN C_DATA );

if ( snapInterval / 1000000 )
{
Expand Down Expand Up @@ -730,18 +728,17 @@ void _checkInterval( void *params )
{
if ( !r->tagCount[i].hasHandler )
{
genericsPrintf( C_NOCHAN" (%d:" "%2d%%) " C_RESET, i, w / 10 );
genericsPrintf( C_NOCHAN" [%d:" "%3d%%] " C_RESET, i, w / 10 );
}
else
{
genericsPrintf( " %d:" C_DATA"%2d%% " C_RESET, i, w / 10 );
genericsPrintf( " %d:" C_DATA"%3d%% " C_RESET, i, w / 10 );
}
}

r->tagCount[i].intervalData = 0;
}

/* Because we are still rxing data there can be some error here, we should really fix this with a mutex */
w = ( totalPct < 1000 ) ? 1000 - totalPct : 0;
genericsPrintf( " Waste:" C_DATA "%2d.%01d%% " C_RESET, w / 10, w % 10 );
}
Expand All @@ -753,7 +750,7 @@ void _checkInterval( void *params )
genericsPrintf( "(" C_DATA " %3d%% " C_RESET "full)", ( fullPercent > 100 ) ? 100 : fullPercent );
}

genericsPrintf( " " C_RESET C_CLR_LN EOL C_PREV_LN );
genericsPrintf( " " C_RESET C_CLR_LN EOL );
}

r->intervalRawBytes = 0;
Expand Down Expand Up @@ -992,10 +989,10 @@ static void _handleBlock( struct RunTime *r, ssize_t fillLevel, uint8_t *buffer
_processNonOTAGBlock( r, fillLevel, buffer );
}

r->intervalRawBytes += fillLevel;

/* Send the block to clients, but only send OTAG if it wasn't OTAG already */
_purgeBlock( r, !r->usingOTAG );

r->intervalRawBytes += fillLevel;
}

// ====================================================================================================
Expand Down Expand Up @@ -1579,6 +1576,9 @@ int main( int argc, char *argv[] )
}
}

/* Blank line for tidyness' sake */
genericsPrintf( EOL );

if ( ( _r.options->nwserverPort ) || ( _r.options->port ) || ( _r.options->file ) )
{
if ( _r.options->nwserverPort )
Expand Down
2 changes: 1 addition & 1 deletion Support/60-orbcode.rules
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Copy this to /etc/udev/rules.d
# use "udevadm control --reload" if needed

ACTION!="add|change", GOTO="orb_rules_end"
ACTION!="add|change|bind", GOTO="orb_rules_end"
SUBSYSTEM!="usb|tty|hidraw", GOTO="orb_rules_end"

# Orbrace mini in bootloader mode
Expand Down

0 comments on commit e372f5a

Please sign in to comment.