fix method tty

This commit is contained in:
awe
2026-04-15 16:53:29 +03:00
parent 8668ff89c1
commit 262c1887c7
3 changed files with 10 additions and 6 deletions

View File

@ -1420,6 +1420,8 @@ int run(const Config& cfg) {
std::unique_ptr<TtyProtocolWriter> 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<uint64_t>(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<std::size_t>(tty_ring_bytes_u64);
tty_writer = std::make_unique<TtyProtocolWriter>(*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<CaptureFileWriter> 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 = [&]() {

View File

@ -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) {

View File

@ -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;