mirror of
https://github.com/svpcom/wfb-ng.git
synced 2025-02-15 21:43:49 -04:00
Update modulation schme: use MCS #1 QPSK 1/2 40MHz SGI 30 Mbit/s
This commit is contained in:
parent
99f95405c3
commit
808f030663
4
rx.hpp
4
rx.hpp
@ -72,8 +72,8 @@ typedef struct {
|
||||
} rx_ring_item_t;
|
||||
|
||||
|
||||
#define RX_RING_SIZE 4
|
||||
#define PROC_RING_SIZE 4
|
||||
#define RX_RING_SIZE 40
|
||||
#define PROC_RING_SIZE 40
|
||||
|
||||
static inline int modN(int x, int base)
|
||||
{
|
||||
|
@ -10,7 +10,8 @@ ifconfig $WLAN down
|
||||
iw dev $WLAN set monitor otherbss
|
||||
iw reg set BO
|
||||
ifconfig $WLAN up
|
||||
iwconfig $WLAN channel $CHANNEL5G
|
||||
iw dev $WLAN set bitrates ht-mcs-5 1 sgi-5
|
||||
iw dev $WLAN set channel $CHANNEL5G HT40+
|
||||
done
|
||||
|
||||
./rx $WLANS
|
@ -5,9 +5,10 @@ CHANNEL5G="149"
|
||||
|
||||
echo "Setting $WLAN to channel $CHANNEL5G"
|
||||
ifconfig $WLAN down
|
||||
iw reg set BO
|
||||
iw dev $WLAN set monitor otherbss
|
||||
iw reg set BO
|
||||
ifconfig $WLAN up
|
||||
iwconfig $WLAN channel $CHANNEL5G
|
||||
iw dev $WLAN set bitrates ht-mcs-5 1 sgi-5
|
||||
iw dev $WLAN set channel $CHANNEL5G HT40+
|
||||
|
||||
./tx $WLAN
|
18
tx.cpp
18
tx.cpp
@ -41,9 +41,9 @@ extern "C"
|
||||
#include "tx.hpp"
|
||||
|
||||
|
||||
Transmitter::Transmitter(const char *wlan, int k, int n, uint8_t radio_rate, uint8_t radio_port) : wlan(wlan), fec_k(k), fec_n(n), block_idx(0),
|
||||
fragment_idx(0), seq(0), radio_rate(radio_rate),
|
||||
radio_port(radio_port), max_packet_size(0)
|
||||
Transmitter::Transmitter(const char *wlan, int k, int n, uint8_t radio_port) : wlan(wlan), fec_k(k), fec_n(n), block_idx(0),
|
||||
fragment_idx(0), seq(0),
|
||||
radio_port(radio_port), max_packet_size(0)
|
||||
{
|
||||
char errbuf[PCAP_ERRBUF_SIZE];
|
||||
ppcap = pcap_create(wlan, errbuf);
|
||||
@ -89,7 +89,6 @@ void Transmitter::send_block_fragment(size_t packet_size)
|
||||
block_hdr.fragment_idx = fragment_idx;
|
||||
|
||||
memcpy(p, radiotap_header, sizeof(radiotap_header));
|
||||
p[8] = radio_rate * 2;
|
||||
p += sizeof(radiotap_header);
|
||||
memcpy(p, ieee80211_header, sizeof(ieee80211_header));
|
||||
p[SRC_MAC_LASTBYTE] = radio_port;
|
||||
@ -222,7 +221,7 @@ void mavlink_rx(Transmitter &t, int fd, int agg_latency)
|
||||
int main(int argc, char * const *argv)
|
||||
{
|
||||
int opt;
|
||||
uint8_t k=8, n=12, radio_port=1, radio_rate=54;
|
||||
uint8_t k=8, n=12, radio_port=1;
|
||||
int udp_port=5600;
|
||||
bool mavlink_mode = false;
|
||||
int mavlink_agg_latency = 0;
|
||||
@ -242,17 +241,14 @@ int main(int argc, char * const *argv)
|
||||
case 'u':
|
||||
udp_port = atoi(optarg);
|
||||
break;
|
||||
case 'r':
|
||||
radio_rate = atoi(optarg);
|
||||
break;
|
||||
case 'p':
|
||||
radio_port = atoi(optarg);
|
||||
break;
|
||||
default: /* '?' */
|
||||
show_usage:
|
||||
fprintf(stderr, "Usage: %s [-m mavlink_agg_in_ms] [-k RS_K] [-n RS_N] [-u udp_port] [-r tx_rate] [-p radio_port] interface\n",
|
||||
fprintf(stderr, "Usage: %s [-m mavlink_agg_in_ms] [-k RS_K] [-n RS_N] [-u udp_port] [-p radio_port] interface\n",
|
||||
argv[0]);
|
||||
fprintf(stderr, "Default: k=%d, n=%d, udp_port=%d, tx_rate=%d Mbit/s, radio_port=%d\n", k, n, udp_port, radio_rate, radio_port);
|
||||
fprintf(stderr, "Default: k=%d, n=%d, udp_port=%d, radio_port=%d\n", k, n, udp_port, radio_port);
|
||||
fprintf(stderr, "Radio MTU: %lu\n", MAX_PAYLOAD_SIZE);
|
||||
exit(1);
|
||||
}
|
||||
@ -265,7 +261,7 @@ int main(int argc, char * const *argv)
|
||||
try
|
||||
{
|
||||
int fd = open_udp_socket_for_rx(udp_port);
|
||||
Transmitter t(argv[optind], k, n, radio_rate, radio_port);
|
||||
Transmitter t(argv[optind], k, n, radio_port);
|
||||
|
||||
if (mavlink_mode)
|
||||
{
|
||||
|
3
tx.hpp
3
tx.hpp
@ -24,7 +24,7 @@ using namespace std;
|
||||
class Transmitter
|
||||
{
|
||||
public:
|
||||
Transmitter(const char* wlan, int k, int m, uint8_t radio_rate, uint8_t radio_port);
|
||||
Transmitter(const char* wlan, int k, int m, uint8_t radio_port);
|
||||
~Transmitter();
|
||||
void send_packet(const uint8_t *buf, size_t size);
|
||||
|
||||
@ -38,7 +38,6 @@ private:
|
||||
uint8_t block_idx;
|
||||
uint8_t fragment_idx;
|
||||
uint32_t seq;
|
||||
uint8_t radio_rate;
|
||||
uint8_t radio_port;
|
||||
uint8_t** block;
|
||||
size_t max_packet_size;
|
||||
|
@ -51,13 +51,28 @@ string string_format( const std::string& format, Args ... args )
|
||||
|
||||
/* this is the template radiotap header we send packets out with */
|
||||
|
||||
|
||||
#define IEEE80211_RADIOTAP_MCS_HAVE_BW 0x01
|
||||
#define IEEE80211_RADIOTAP_MCS_HAVE_MCS 0x02
|
||||
#define IEEE80211_RADIOTAP_MCS_HAVE_GI 0x04
|
||||
#define IEEE80211_RADIOTAP_MCS_HAVE_FMT 0x08
|
||||
|
||||
#define IEEE80211_RADIOTAP_MCS_BW_20 0
|
||||
#define IEEE80211_RADIOTAP_MCS_BW_40 1
|
||||
#define IEEE80211_RADIOTAP_MCS_BW_20L 2
|
||||
#define IEEE80211_RADIOTAP_MCS_BW_20U 3
|
||||
#define IEEE80211_RADIOTAP_MCS_SGI 0x04
|
||||
#define IEEE80211_RADIOTAP_MCS_FMT_GF 0x08
|
||||
|
||||
#define MCS_KNOWN (IEEE80211_RADIOTAP_MCS_HAVE_MCS | IEEE80211_RADIOTAP_MCS_HAVE_BW | IEEE80211_RADIOTAP_MCS_HAVE_GI) // | IEEE80211_RADIOTAP_MCS_HAVE_FMT)
|
||||
#define MCS_FLAGS (IEEE80211_RADIOTAP_MCS_BW_40 | IEEE80211_RADIOTAP_MCS_SGI) // | IEEE80211_RADIOTAP_MCS_FMT_GF)
|
||||
|
||||
static const uint8_t radiotap_header[] = {
|
||||
0x00, 0x00, // <-- radiotap version
|
||||
0x0c, 0x00, // <- radiotap header lengt
|
||||
0x04, 0x80, 0x00, 0x00, // <-- radiotap present flags
|
||||
0x00, // Rate, offset 0x8
|
||||
0x00,
|
||||
0x18, 0x00
|
||||
0x0d, 0x00, // <- radiotap header length
|
||||
0x00, 0x80, 0x08, 0x00, // <-- radiotap present flags: RADIOTAP_TX_FLAGS + RADIOTAP_MCS
|
||||
0x08, 0x00, // RADIOTAP_F_TX_NOACK
|
||||
MCS_KNOWN , MCS_FLAGS, 0x01 // MCS default is #1 -- QPSK 1/2 40MHz SGI -- 30 Mbit/s
|
||||
};
|
||||
|
||||
//the last byte of the mac address is recycled as a port number
|
||||
|
Loading…
Reference in New Issue
Block a user