Commit 7009f9cd authored by Manolis Surligas's avatar Manolis Surligas

Fix small issues

parent d973f753
......@@ -38,21 +38,25 @@ namespace gr {
void
multi_format_msg_sink_impl::msg_handler (pmt::pmt_t msg)
{
uint8_t *su;
std::string s((const char *)pmt::blob_data(msg), pmt::blob_length(msg));
switch(d_format){
case 0:
std::cout << "Received text sequence:" << s << " " << std::endl;
break;
case 1:
//for(size_t i=0; i< pmt::blob_length(msg); i++)
for (size_t i = 0; i < s.length(); ++i)
printf("0x%02x ",s[i]);
std::cout<<std::endl;
su = (uint8_t *)pmt::blob_data(msg);
for (size_t i = 0; i < pmt::blob_length (msg); i++) {
printf ("0x%02x ", su[i]);
}
std::cout << std::endl;
break;
case 2:
for(size_t i=0; i< pmt::blob_length(msg); i++)
std::cout<< std::bitset<8>(((uint8_t*)pmt::blob_data(msg))[i]);
std::cout<<std::endl;
su = (uint8_t *)pmt::blob_data(msg);
for (size_t i = 0; i < pmt::blob_length (msg); i++) {
std::cout << "0b" << std::bitset<8> (su[i]) << " ";
}
std::cout << std::endl;
break;
default:
printf("Invalid format");
......
......@@ -302,6 +302,7 @@ namespace gr
if (d_encoded == 0) {
/* Reset the buffer */
memset(d_ax25_pdu, 0, 2 * d_max_pdu_len * 8);
memset(d_pdu_encoded, 0, d_max_pdu_len * 8 * sizeof(float));
pdu = delete_head_blocking (pmt::mp ("pdu"));
d_pdu_len = pmt::blob_length (pdu);
......@@ -334,7 +335,7 @@ namespace gr
* the address field (if exists) and the payload. Length and CRC fields
* are NOT included.
*/
d_pdu[d_preamble_len + d_sync_word_len] = (uint8_t) encoded_len/8;
d_pdu[d_preamble_len + d_sync_word_len] = (uint8_t) (encoded_len/8);
/* If it is necessary calculate and append the CRC */
if (d_append_crc) {
......@@ -356,17 +357,17 @@ namespace gr
map_msb_first (d_pdu_encoded, (d_preamble_len + d_sync_word_len + 1) * 8);
/* NRZ encode the AX.25 part of the FSK frame */
for(i = 0; i < encoded_len; i++){
for(i = 0; i < encoded_len - extra_bits; i++){
d_pdu_encoded[i + (d_preamble_len + d_sync_word_len + 1)*8]
= (d_ax25_pdu[i] * 2.0f) - 1.0f;
}
/* Reset the settling trailing samples */
memset (d_pdu_encoded + d_pdu_len * 8, 0,
memset (&d_pdu_encoded[d_pdu_len * 8], 0,
d_settling_samples * sizeof(float));
/* The new frame now has a bigger size of course*/
d_pdu_len += d_settling_samples / 8;
d_pdu_len += d_settling_samples/8;
/* Start of burst */
add_sob (nitems_written (0));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment