Bugfix: POCSAG alphanum messages not showing

Bugfix: Range limit for afsk config
This commit is contained in:
furrtek 2016-08-24 14:44:57 +02:00
parent 86e3b55a54
commit 04cdafe387
7 changed files with 62 additions and 44 deletions

View File

@ -59,8 +59,13 @@ void POCSAGLogger::on_packet(const pocsag::POCSAGPacket& packet, const uint32_t
log_file.write_entry(packet.timestamp(), entry);
}
void POCSAGLogger::on_decoded(const pocsag::POCSAGPacket& packet, const std::string text) {
log_file.write_entry(packet.timestamp(), text);
void POCSAGLogger::on_decoded(
const pocsag::POCSAGPacket& packet,
const std::string text,
const uint32_t address,
const uint32_t function) {
log_file.write_entry(packet.timestamp(), to_string_hex(address, 8) + "(" + to_string_dec_uint(function) + "): " + text);
}
namespace ui {
@ -145,15 +150,12 @@ void POCSAGAppView::on_packet(const POCSAGPacketMessage * message) {
bool eom = false;
uint32_t codeword;
std::string alphanum_text = "";
std::string output_text = "MSG:";
char ascii_char;
if( logger ) logger->on_packet(message->packet, target_frequency());
for (size_t i = 0; i < 16; i++) {
codeword = message->packet[i];
if (codeword & 0x80000000) {
if (codeword & 0x80000000U) {
// Message
ascii_data |= ((codeword >> 11) & 0xFFFFF); // 20 bits
ascii_idx += 20;
@ -185,35 +187,39 @@ void POCSAGAppView::on_packet(const POCSAGPacketMessage * message) {
alphanum_text += ascii_char;
}
ascii_data = ascii_data << 20;
// Todo: same code in ui_lcr, make function in string_format !
for(const auto c : alphanum_text) {
if ((c < 32) || (c > 126))
output_text += "[" + to_string_dec_uint(c) + "]";
else
output_text += c;
}
} else {
// Address
if (codeword == POCSAG_IDLE) {
eom = true;
} else {
function = (codeword >> 11) & 3;
address = ((codeword >> 10) & 0x1FFFF8) | ((codeword >> 1) & 7);
if (eom == false) {
function = (codeword >> 11) & 3;
address = ((codeword >> 10) & 0x1FFFF8) | ((codeword >> 1) & 7);
}
}
}
}
if( logger ) logger->on_packet(message->packet, target_frequency());
// Todo: same code in ui_lcr, make function in string_format !
for(const auto c : alphanum_text) {
if ((c < 32) || (c > 126))
output_text += "[" + to_string_dec_uint(c) + "]";
else
output_text += c;
}
if (eom) {
if (address || function) {
console.writeln(output_text);
if (logger) logger->on_decoded(message->packet, output_text);
if ((address != 0) || (function != 0)) {
if (logger) logger->on_decoded(message->packet, output_text, address, function);
console.writeln(to_string_time(message->packet.timestamp()) + " ADDR:" + to_string_hex(address, 6) + " F:" + to_string_dec_uint(function) + " ");
if (output_text != "") console.writeln("MSG:" + output_text);
} else {
console.writeln(to_string_time(message->packet.timestamp()) + " Tone only ");
}
output_text = "";
ascii_idx = 0;
ascii_data = 0;
batch_cnt = 0;

View File

@ -42,7 +42,7 @@ public:
}
void on_packet(const pocsag::POCSAGPacket& packet, const uint32_t frequency);
void on_decoded(const pocsag::POCSAGPacket& packet, const std::string text);
void on_decoded(const pocsag::POCSAGPacket& packet, const std::string text, const uint32_t address, const uint32_t function);
private:
LogFile log_file;
@ -71,6 +71,7 @@ private:
uint32_t batch_cnt = 0;
uint32_t address, function;
uint32_t ascii_data, ascii_idx;
std::string output_text = "";
MessageHandlerRegistration message_handler_packet {
Message::ID::POCSAGPacket,

View File

@ -90,6 +90,7 @@ void POCSAGProcessor::execute(const buffer_c8_t& buffer) {
rx_state = SYNC;
frame_counter = 0;
rx_bit = 0;
msg_timeout = 0;
} else if (rx_data == POCSAG_IDLE) {
rx_state = WAITING;
}
@ -100,29 +101,36 @@ void POCSAGProcessor::execute(const buffer_c8_t& buffer) {
break;
case SYNC:
rx_bit++;
if (rx_bit >= 32) {
rx_bit = 0;
//pocsag_brute_repair(&s->l2.pocsag, &rx_data);
packet.set(frame_counter, rx_data);
if (rx_data == POCSAG_IDLE) {
rx_state = WAITING;
if (msg_timeout < 600) {
msg_timeout++;
rx_bit++;
if (rx_bit >= 32) {
rx_bit = 0;
packet.set_timestamp(Timestamp::now());
//packet.rate = pocsag::SignalRate::FSK1200;
const POCSAGPacketMessage message(packet);
shared_memory.application_queue.push(message);
//pocsag_brute_repair(&s->l2.pocsag, &rx_data);
} else {
if (frame_counter < 15)
frame_counter++;
else
rx_state = WAITING;
packet.set(frame_counter, rx_data);
if (rx_data == POCSAG_IDLE) {
//rx_state = WAITING; // DEBUG
} else {
if (frame_counter < 15) {
frame_counter++;
} else {
// DEBUG
packet.set_timestamp(Timestamp::now());
const POCSAGPacketMessage message(packet);
shared_memory.application_queue.push(message);
rx_state = WAITING;
}
}
}
} else {
// DEBUG
packet.set_timestamp(Timestamp::now());
const POCSAGPacketMessage message(packet);
shared_memory.application_queue.push(message);
rx_state = WAITING; // Abort
}
break;

View File

@ -78,6 +78,7 @@ private:
dsp::demodulate::FM demod;
uint32_t sync_timeout;
uint32_t msg_timeout;
uint32_t dcd_shreg;
uint32_t sphase;

View File

@ -1,5 +1,6 @@
/*
* Copyright (C) 2015 Jared Boone, ShareBrained Technology, Inc.
* Copyright (C) 2016 Furrtek
*
* This file is part of PortaPack.
*
@ -52,7 +53,7 @@ constexpr afsk_bitrate_range_t afsk_bitrate_range { 600, 9600 };
constexpr int32_t afsk_bitrate_reset_value { 1200 };
using afsk_bw_range_t = range_t<int32_t>;
constexpr afsk_bw_range_t afsk_bw_range { 1, 40 };
constexpr afsk_bw_range_t afsk_bw_range { 1, 50 };
constexpr int32_t afsk_bw_reset_value { 15 };
/* struct must pack the same way on M4 and M0 cores. */
@ -156,7 +157,7 @@ uint32_t afsk_config() {
}
uint8_t afsk_format() {
return ((data->afsk_config >> 16) & 0xFF);
return ((data->afsk_config >> 16) & 3);
}
uint8_t afsk_repeats() {

View File

@ -1,5 +1,6 @@
/*
* Copyright (C) 2015 Jared Boone, ShareBrained Technology, Inc.
* Copyright (C) 2016 Furrtek
*
* This file is part of PortaPack.
*

Binary file not shown.