mirror of
https://github.com/portapack-mayhem/mayhem-firmware.git
synced 2026-09-08 15:59:08 +00:00
POCSAG: decoder fixes, serial output, TX polarity cleanup (#3130)
RX: fix address/batch-boundary handling, add numeric continuation, add heuristic type detection toggle, pass inverted polarity flag, stream decoded messages over USB serial. TX: rename phase to polarity (Standard/Inverted), fix function validation (&&→||), fix serial shell payload read (offset tracking, 31-byte cap, preserve msglen). Decoder: remove color escapes from output (plain text for all consumers), guard count_alpha_fill against empty string, keep numeric_len across continuation batches. Serial format: POCSAG <baud> <addr> <func> <pol> <type> "<msg>" hex:<hex> Quote escaping for embedded " and \\ in alpha messages.
This commit is contained in:
@@ -38,14 +38,7 @@ using namespace std;
|
||||
namespace {
|
||||
/* Count of bits that differ between the two values. */
|
||||
uint8_t diff_bit_count(uint32_t left, uint32_t right) {
|
||||
uint32_t diff = left ^ right;
|
||||
uint8_t count = 0;
|
||||
for (size_t i = 0; i < sizeof(diff) * 8; ++i) {
|
||||
if (((diff >> i) & 0x1) == 1)
|
||||
++count;
|
||||
}
|
||||
|
||||
return count;
|
||||
return __builtin_popcount(left ^ right);
|
||||
}
|
||||
} // namespace
|
||||
|
||||
@@ -426,6 +419,7 @@ void POCSAGProcessor::send_packet() {
|
||||
packet.set_flag(pocsag::PacketFlag::NORMAL);
|
||||
packet.set_timestamp(Timestamp::now());
|
||||
packet.set_bitrate(bit_extractor.baud_rate());
|
||||
packet.set_inverted(word_extractor.inverted());
|
||||
packet.set(word_extractor.batch());
|
||||
|
||||
POCSAGPacketMessage message(packet);
|
||||
|
||||
Reference in New Issue
Block a user