diff --git a/fakeradio.c b/fakeradio.c index 8095635e..5aef5fdf 100644 --- a/fakeradio.c +++ b/fakeradio.c @@ -372,14 +372,16 @@ int transfer_bytes(struct radio_state *radios) bcopy(&t->txbuffer[bytes], t->txbuffer, t->txb_len - bytes); t->txb_len-=bytes; - if (bytes==0 || --t->tx_count<=0){ - // swap who's turn it is to transmit - transmitter = receiver; - r->tx_count=6; - } // set the wait time for the next transmission - // minimum 20 bit preamble, 1 byte sync, 1 byte length, 2 byte tdm + turn around air-time - next_transmit_time = gettime_ms() + (bytes+8+10)/chars_per_ms; + next_transmit_time = gettime_ms() + 5 + bytes/chars_per_ms; + + if (bytes==0 || --t->tx_count<=0){ + // swap who's turn it is to transmit after sending 3 packets or running out of data. + transmitter = receiver; + r->tx_count=3; + // add Tx->Rx change time (it's about 40ms between receiving empty packets) + next_transmit_time+=15; + } return bytes; } diff --git a/tests/rhizomeprotocol b/tests/rhizomeprotocol index ff9a58f3..750d91a5 100755 --- a/tests/rhizomeprotocol +++ b/tests/rhizomeprotocol @@ -720,7 +720,7 @@ start_radio_instance() { doc_SimulatedRadio="MDP Transfer over simulated radio link (~90% packet arrival)" setup_SimulatedRadio() { setup_common - $servald_build_root/fakeradio 6 0.9 > "$SERVALD_VAR/radioout" 2> "$SERVALD_VAR/radioerr" & + $servald_build_root/fakeradio 4 0.9 > "$SERVALD_VAR/radioout" 2> "$SERVALD_VAR/radioerr" & FAKERADIO_PID=$! sleep 5 local END1=`head "$SERVALD_VAR/radioout" -n 1` @@ -748,7 +748,7 @@ teardown_SimulatedRadio() { doc_SimulatedRadio2="MDP Transfer over simulated radio link (~50% packet arrival)" setup_SimulatedRadio2() { setup_common - $servald_build_root/fakeradio 6 0.5 > "$SERVALD_VAR/radioout" 2> "$SERVALD_VAR/radioerr" & + $servald_build_root/fakeradio 4 0.5 > "$SERVALD_VAR/radioout" 2> "$SERVALD_VAR/radioerr" & FAKERADIO_PID=$! sleep 1 local END1=`head "$SERVALD_VAR/radioout" -n 1` diff --git a/tests/routing b/tests/routing index 5a14c026..1871a262 100755 --- a/tests/routing +++ b/tests/routing @@ -285,7 +285,6 @@ setup_simulate_extender() { set debug.mavlink on \ set interfaces.1.type CATEAR \ set interfaces.1.mdp.tick_ms 5000 \ - set interfaces.1.mdp.packet_interval 5000 \ set interfaces.1.socket_type STREAM \ set interfaces.1.encapsulation SINGLE \ set interfaces.1.point_to_point on