mirror of
https://github.com/eried/portapack-mayhem.git
synced 2025-02-06 09:55:20 -05:00
Bugfix: POCSAG alphanum messages not showing
Bugfix: Range limit for afsk config
This commit is contained in:
parent
86e3b55a54
commit
04cdafe387
@ -59,8 +59,13 @@ void POCSAGLogger::on_packet(const pocsag::POCSAGPacket& packet, const uint32_t
|
|||||||
log_file.write_entry(packet.timestamp(), entry);
|
log_file.write_entry(packet.timestamp(), entry);
|
||||||
}
|
}
|
||||||
|
|
||||||
void POCSAGLogger::on_decoded(const pocsag::POCSAGPacket& packet, const std::string text) {
|
void POCSAGLogger::on_decoded(
|
||||||
log_file.write_entry(packet.timestamp(), text);
|
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 {
|
namespace ui {
|
||||||
@ -145,15 +150,12 @@ void POCSAGAppView::on_packet(const POCSAGPacketMessage * message) {
|
|||||||
bool eom = false;
|
bool eom = false;
|
||||||
uint32_t codeword;
|
uint32_t codeword;
|
||||||
std::string alphanum_text = "";
|
std::string alphanum_text = "";
|
||||||
std::string output_text = "MSG:";
|
|
||||||
char ascii_char;
|
char ascii_char;
|
||||||
|
|
||||||
if( logger ) logger->on_packet(message->packet, target_frequency());
|
|
||||||
|
|
||||||
for (size_t i = 0; i < 16; i++) {
|
for (size_t i = 0; i < 16; i++) {
|
||||||
codeword = message->packet[i];
|
codeword = message->packet[i];
|
||||||
|
|
||||||
if (codeword & 0x80000000) {
|
if (codeword & 0x80000000U) {
|
||||||
// Message
|
// Message
|
||||||
ascii_data |= ((codeword >> 11) & 0xFFFFF); // 20 bits
|
ascii_data |= ((codeword >> 11) & 0xFFFFF); // 20 bits
|
||||||
ascii_idx += 20;
|
ascii_idx += 20;
|
||||||
@ -185,35 +187,39 @@ void POCSAGAppView::on_packet(const POCSAGPacketMessage * message) {
|
|||||||
alphanum_text += ascii_char;
|
alphanum_text += ascii_char;
|
||||||
}
|
}
|
||||||
ascii_data = ascii_data << 20;
|
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 {
|
} else {
|
||||||
// Address
|
// Address
|
||||||
if (codeword == POCSAG_IDLE) {
|
if (codeword == POCSAG_IDLE) {
|
||||||
eom = true;
|
eom = true;
|
||||||
} else {
|
} else {
|
||||||
function = (codeword >> 11) & 3;
|
if (eom == false) {
|
||||||
address = ((codeword >> 10) & 0x1FFFF8) | ((codeword >> 1) & 7);
|
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 (eom) {
|
||||||
if (address || function) {
|
if ((address != 0) || (function != 0)) {
|
||||||
console.writeln(output_text);
|
if (logger) logger->on_decoded(message->packet, output_text, address, function);
|
||||||
if (logger) logger->on_decoded(message->packet, output_text);
|
|
||||||
console.writeln(to_string_time(message->packet.timestamp()) + " ADDR:" + to_string_hex(address, 6) + " F:" + to_string_dec_uint(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 {
|
} else {
|
||||||
console.writeln(to_string_time(message->packet.timestamp()) + " Tone only ");
|
console.writeln(to_string_time(message->packet.timestamp()) + " Tone only ");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
output_text = "";
|
||||||
ascii_idx = 0;
|
ascii_idx = 0;
|
||||||
ascii_data = 0;
|
ascii_data = 0;
|
||||||
batch_cnt = 0;
|
batch_cnt = 0;
|
||||||
|
@ -42,7 +42,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
void on_packet(const pocsag::POCSAGPacket& packet, const uint32_t frequency);
|
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:
|
private:
|
||||||
LogFile log_file;
|
LogFile log_file;
|
||||||
@ -71,6 +71,7 @@ private:
|
|||||||
uint32_t batch_cnt = 0;
|
uint32_t batch_cnt = 0;
|
||||||
uint32_t address, function;
|
uint32_t address, function;
|
||||||
uint32_t ascii_data, ascii_idx;
|
uint32_t ascii_data, ascii_idx;
|
||||||
|
std::string output_text = "";
|
||||||
|
|
||||||
MessageHandlerRegistration message_handler_packet {
|
MessageHandlerRegistration message_handler_packet {
|
||||||
Message::ID::POCSAGPacket,
|
Message::ID::POCSAGPacket,
|
||||||
|
@ -90,6 +90,7 @@ void POCSAGProcessor::execute(const buffer_c8_t& buffer) {
|
|||||||
rx_state = SYNC;
|
rx_state = SYNC;
|
||||||
frame_counter = 0;
|
frame_counter = 0;
|
||||||
rx_bit = 0;
|
rx_bit = 0;
|
||||||
|
msg_timeout = 0;
|
||||||
} else if (rx_data == POCSAG_IDLE) {
|
} else if (rx_data == POCSAG_IDLE) {
|
||||||
rx_state = WAITING;
|
rx_state = WAITING;
|
||||||
}
|
}
|
||||||
@ -100,29 +101,36 @@ void POCSAGProcessor::execute(const buffer_c8_t& buffer) {
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case SYNC:
|
case SYNC:
|
||||||
rx_bit++;
|
if (msg_timeout < 600) {
|
||||||
if (rx_bit >= 32) {
|
msg_timeout++;
|
||||||
rx_bit = 0;
|
rx_bit++;
|
||||||
|
if (rx_bit >= 32) {
|
||||||
//pocsag_brute_repair(&s->l2.pocsag, &rx_data);
|
rx_bit = 0;
|
||||||
|
|
||||||
packet.set(frame_counter, rx_data);
|
|
||||||
|
|
||||||
if (rx_data == POCSAG_IDLE) {
|
|
||||||
rx_state = WAITING;
|
|
||||||
|
|
||||||
packet.set_timestamp(Timestamp::now());
|
//pocsag_brute_repair(&s->l2.pocsag, &rx_data);
|
||||||
//packet.rate = pocsag::SignalRate::FSK1200;
|
|
||||||
|
|
||||||
const POCSAGPacketMessage message(packet);
|
|
||||||
shared_memory.application_queue.push(message);
|
|
||||||
|
|
||||||
} else {
|
packet.set(frame_counter, rx_data);
|
||||||
if (frame_counter < 15)
|
|
||||||
frame_counter++;
|
if (rx_data == POCSAG_IDLE) {
|
||||||
else
|
//rx_state = WAITING; // DEBUG
|
||||||
rx_state = WAITING;
|
} 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;
|
break;
|
||||||
|
|
||||||
|
@ -78,6 +78,7 @@ private:
|
|||||||
dsp::demodulate::FM demod;
|
dsp::demodulate::FM demod;
|
||||||
|
|
||||||
uint32_t sync_timeout;
|
uint32_t sync_timeout;
|
||||||
|
uint32_t msg_timeout;
|
||||||
|
|
||||||
uint32_t dcd_shreg;
|
uint32_t dcd_shreg;
|
||||||
uint32_t sphase;
|
uint32_t sphase;
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2015 Jared Boone, ShareBrained Technology, Inc.
|
* Copyright (C) 2015 Jared Boone, ShareBrained Technology, Inc.
|
||||||
|
* Copyright (C) 2016 Furrtek
|
||||||
*
|
*
|
||||||
* This file is part of PortaPack.
|
* 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 };
|
constexpr int32_t afsk_bitrate_reset_value { 1200 };
|
||||||
|
|
||||||
using afsk_bw_range_t = range_t<int32_t>;
|
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 };
|
constexpr int32_t afsk_bw_reset_value { 15 };
|
||||||
|
|
||||||
/* struct must pack the same way on M4 and M0 cores. */
|
/* struct must pack the same way on M4 and M0 cores. */
|
||||||
@ -156,7 +157,7 @@ uint32_t afsk_config() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
uint8_t afsk_format() {
|
uint8_t afsk_format() {
|
||||||
return ((data->afsk_config >> 16) & 0xFF);
|
return ((data->afsk_config >> 16) & 3);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t afsk_repeats() {
|
uint8_t afsk_repeats() {
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2015 Jared Boone, ShareBrained Technology, Inc.
|
* Copyright (C) 2015 Jared Boone, ShareBrained Technology, Inc.
|
||||||
|
* Copyright (C) 2016 Furrtek
|
||||||
*
|
*
|
||||||
* This file is part of PortaPack.
|
* This file is part of PortaPack.
|
||||||
*
|
*
|
||||||
|
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user