diff --git a/main.cpp b/main.cpp index 7c1e869..f8816f3 100644 --- a/main.cpp +++ b/main.cpp @@ -1420,6 +1420,8 @@ int run(const Config& cfg) { std::unique_ptr tty_writer; const bool tty_di1_group_average = cfg.tty_path.has_value() && cfg.di1_group_average; const bool fast_tty_avg_stream_mode = tty_di1_group_average; + const uint16_t tty_packet_start_marker = + (cfg.profile == CaptureProfile::Amplitude) ? 0x001AU : 0x000AU; if (cfg.tty_path) { const uint64_t typical_tty_batch_frames = (static_cast(read_capacity_words) + 1U) / 2U; const uint64_t typical_tty_batch_bytes = typical_tty_batch_frames * sizeof(uint16_t) * 4U; @@ -1431,7 +1433,7 @@ int run(const Config& cfg) { tty_ring_capacity_bytes = static_cast(tty_ring_bytes_u64); tty_writer = std::make_unique(*cfg.tty_path, tty_ring_capacity_bytes); if (!tty_di1_group_average) { - tty_writer->emit_packet_start(); + tty_writer->emit_packet_start(tty_packet_start_marker); } } std::unique_ptr writer; @@ -1587,7 +1589,7 @@ int run(const Config& cfg) { }; auto append_tty_packet_start = [&]() { - append_tty_frame(0x000A, 0xFFFF, 0xFFFF, 0xFFFF); + append_tty_frame(tty_packet_start_marker, 0xFFFF, 0xFFFF, 0xFFFF); }; auto append_tty_group_step = [&]() { diff --git a/tty_protocol_writer.cpp b/tty_protocol_writer.cpp index 405f319..72caf1a 100644 --- a/tty_protocol_writer.cpp +++ b/tty_protocol_writer.cpp @@ -22,7 +22,9 @@ TtyProtocolWriter::TtyProtocolWriter(std::string path, std::size_t ring_capacity TtyProtocolWriter::~TtyProtocolWriter() = default; -void TtyProtocolWriter::emit_packet_start() {} +void TtyProtocolWriter::emit_packet_start(uint16_t marker) { + (void) marker; +} void TtyProtocolWriter::emit_step(uint16_t index, int16_t ch1_avg, int16_t ch2_avg) { (void) index; @@ -227,8 +229,8 @@ TtyProtocolWriter::~TtyProtocolWriter() { close_fd_if_open(impl_->fd); } -void TtyProtocolWriter::emit_packet_start() { - enqueue_frame(0x000A, 0xFFFF, 0xFFFF, 0xFFFF); +void TtyProtocolWriter::emit_packet_start(uint16_t marker) { + enqueue_frame(marker, 0xFFFF, 0xFFFF, 0xFFFF); } void TtyProtocolWriter::emit_step(uint16_t index, int16_t ch1_avg, int16_t ch2_avg) { diff --git a/tty_protocol_writer.h b/tty_protocol_writer.h index 55cf616..c97e92b 100644 --- a/tty_protocol_writer.h +++ b/tty_protocol_writer.h @@ -21,7 +21,7 @@ public: TtyProtocolWriter(TtyProtocolWriter&& other) noexcept = delete; TtyProtocolWriter& operator=(TtyProtocolWriter&& other) noexcept = delete; - void emit_packet_start(); + void emit_packet_start(uint16_t marker = 0x000A); void emit_step(uint16_t index, int16_t ch1_avg, int16_t ch2_avg); void enqueue_encoded_frames(const uint16_t* words, std::size_t frame_count); StatsSnapshot stats() const;