cleanup
This commit is contained in:
@@ -55,19 +55,13 @@ air_modes_preamble::air_modes_preamble(int channel_rate, float threshold_db) :
|
|||||||
set_history(d_check_width);
|
set_history(d_check_width);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int early_late(const float *data) {
|
|
||||||
if(data[-1] > data[0]) return -1;
|
|
||||||
else if(data[1] > data[0]) return 1;
|
|
||||||
else return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void integrate_and_dump(float *out, const float *in, int chips, int samps_per_chip) {
|
static void integrate_and_dump(float *out, const float *in, int chips, int samps_per_chip) {
|
||||||
for(int i=0; i<chips; i++) {
|
for(int i=0; i<chips; i++) {
|
||||||
float acc = 0;
|
float acc = 0;
|
||||||
for(int j=0; j<samps_per_chip; j++) {
|
for(int j=0; j<samps_per_chip; j++) {
|
||||||
acc += in[i*samps_per_chip+j];
|
acc += in[i*samps_per_chip+j];
|
||||||
}
|
}
|
||||||
out[i] = acc/samps_per_chip;
|
out[i] = acc;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -94,10 +88,10 @@ int air_modes_preamble::general_work(int noutput_items,
|
|||||||
float *out = (float *) output_items[0];
|
float *out = (float *) output_items[0];
|
||||||
|
|
||||||
//fixme move into .h
|
//fixme move into .h
|
||||||
const int pulse_offsets[4] = {0,
|
const int pulse_offsets[4] = { 0,
|
||||||
int(1.0 * d_samples_per_symbol),
|
int(2 * d_samples_per_chip),
|
||||||
int(3.5 * d_samples_per_symbol),
|
int(7 * d_samples_per_chip),
|
||||||
int(4.5 * d_samples_per_symbol)
|
int(9 * d_samples_per_chip)
|
||||||
};
|
};
|
||||||
|
|
||||||
uint64_t abs_out_sample_cnt = nitems_written(0);
|
uint64_t abs_out_sample_cnt = nitems_written(0);
|
||||||
@@ -137,7 +131,7 @@ int air_modes_preamble::general_work(int noutput_items,
|
|||||||
|
|
||||||
//be sure we've got enough room in the input buffer to copy out a whole packet
|
//be sure we've got enough room in the input buffer to copy out a whole packet
|
||||||
if(ninputs-i < 240*d_samples_per_chip) {
|
if(ninputs-i < 240*d_samples_per_chip) {
|
||||||
consume_each(i);
|
consume_each(i-1);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -157,10 +151,13 @@ int air_modes_preamble::general_work(int noutput_items,
|
|||||||
pmt::pmt_from_double((double) space_threshold),
|
pmt::pmt_from_double((double) space_threshold),
|
||||||
d_me //block src id
|
d_me //block src id
|
||||||
);
|
);
|
||||||
|
//std::cout << "PREAMBLE" << std::endl;
|
||||||
|
|
||||||
//produce only one output per work call
|
//produce only one output per work call
|
||||||
|
//we consume a short packet length, while generating a long one
|
||||||
|
//that way we don't miss two short pkts in the span of one long one
|
||||||
consume_each(i+240*d_samples_per_chip);
|
consume_each(i+240*d_samples_per_chip);
|
||||||
return 240; //fixme debug should be 240
|
return 240;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -55,11 +55,12 @@ air_modes_slicer::air_modes_slicer(int channel_rate, gr_msg_queue_sptr queue) :
|
|||||||
d_samples_per_symbol = d_samples_per_chip * 2;
|
d_samples_per_symbol = d_samples_per_chip * 2;
|
||||||
d_check_width = 120 * d_samples_per_symbol; //how far you will have to look ahead
|
d_check_width = 120 * d_samples_per_symbol; //how far you will have to look ahead
|
||||||
d_queue = queue;
|
d_queue = queue;
|
||||||
d_secs_per_sample = 1.0 / channel_rate;
|
d_secs_per_sample = 1.0 / d_chip_rate;
|
||||||
|
|
||||||
set_output_multiple(1+d_check_width * 2); //how do you specify buffer size for sinks?
|
set_output_multiple(1+d_check_width * 2); //how do you specify buffer size for sinks?
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//FIXME i'm sure this exists in gr
|
||||||
static bool pmtcompare(pmt::pmt_t x, pmt::pmt_t y)
|
static bool pmtcompare(pmt::pmt_t x, pmt::pmt_t y)
|
||||||
{
|
{
|
||||||
uint64_t t_x, t_y;
|
uint64_t t_x, t_y;
|
||||||
@@ -158,12 +159,9 @@ int air_modes_slicer::work(int noutput_items,
|
|||||||
slice_result_t slice_result = slicer(in[i+j*2], in[i+j*2+1], rx_packet.reference_level);
|
slice_result_t slice_result = slicer(in[i+j*2], in[i+j*2+1], rx_packet.reference_level);
|
||||||
if(slice_result.decision) pkt_hdr += 1 << (4-j);
|
if(slice_result.decision) pkt_hdr += 1 << (4-j);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(pkt_hdr == 17) rx_packet.type = Long_Packet;
|
if(pkt_hdr == 17) rx_packet.type = Long_Packet;
|
||||||
else rx_packet.type = Short_Packet;
|
else rx_packet.type = Short_Packet;
|
||||||
|
int packet_length = (rx_packet.type == framer_packet_type(Short_Packet)) ? 56 : 112;
|
||||||
int packet_length;
|
|
||||||
packet_length = (rx_packet.type == framer_packet_type(Short_Packet)) ? 56 : 112;
|
|
||||||
|
|
||||||
//it's slice time!
|
//it's slice time!
|
||||||
//TODO: don't repeat your work here, you already have the first 5 bits
|
//TODO: don't repeat your work here, you already have the first 5 bits
|
||||||
@@ -227,7 +225,7 @@ int air_modes_slicer::work(int noutput_items,
|
|||||||
//that's a pretty dang low threshold so i don't think we'll drop many legit packets
|
//that's a pretty dang low threshold so i don't think we'll drop many legit packets
|
||||||
|
|
||||||
if(rx_packet.type == Short_Packet && rx_packet.message_type != 11 && rx_packet.numlowconf != 0) continue;
|
if(rx_packet.type == Short_Packet && rx_packet.message_type != 11 && rx_packet.numlowconf != 0) continue;
|
||||||
if(rx_packet.type == Short_Packet && rx_packet.message_type == 11 && rx_packet.numlowconf >= 10) continue;
|
if(rx_packet.message_type == 11 && rx_packet.numlowconf >= 10) continue;
|
||||||
|
|
||||||
|
|
||||||
//if(rx_packet.numlowconf >= 24) continue; //don't even try, this is the maximum number of errors ECC could possibly correct
|
//if(rx_packet.numlowconf >= 24) continue; //don't even try, this is the maximum number of errors ECC could possibly correct
|
||||||
|
|||||||
Reference in New Issue
Block a user