mirror of
https://github.com/servalproject/serval-dna.git
synced 2024-12-18 20:57:56 +00:00
Better approximation of TDMA timing
This commit is contained in:
parent
bea9d36411
commit
5ea19ab538
16
fakeradio.c
16
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;
|
||||
}
|
||||
|
||||
|
@ -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`
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user