From 86630133e42592b045823903a5db9618e9576a1c Mon Sep 17 00:00:00 2001 From: michael-west Date: Thu, 16 Jun 2016 10:17:24 -0700 Subject: Octoclock: Fix off by one errors in uart code --- host/lib/usrp_clock/octoclock/octoclock_uart.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'host/lib/usrp_clock/octoclock') diff --git a/host/lib/usrp_clock/octoclock/octoclock_uart.cpp b/host/lib/usrp_clock/octoclock/octoclock_uart.cpp index f366bac30..4d02aad3b 100644 --- a/host/lib/usrp_clock/octoclock/octoclock_uart.cpp +++ b/host/lib/usrp_clock/octoclock/octoclock_uart.cpp @@ -137,7 +137,7 @@ namespace uhd{ //We may have wrapped around locally if(_state.pos == 0) _state.num_wraps++; } - _state.pos = (_state.pos+1) % _poolsize; + if (_cache[_state.pos] == '\n') _state.pos = (_state.pos+1) % _poolsize; //We may have wrapped around locally if(_state.pos == 0) _state.num_wraps++; } @@ -145,7 +145,7 @@ namespace uhd{ } char octoclock_uart_iface::_getchar(){ - if(LOCAL_STATE_AHEAD){ + if(STATES_EQUAL or LOCAL_STATE_AHEAD){ return 0; } -- cgit v1.2.3