upd fix do
This commit is contained in:
26
main.cpp
26
main.cpp
@ -761,6 +761,17 @@ Config parse_args(int argc, char** argv) {
|
||||
cfg.input_buffer_words = std::max<uint32_t>(cfg.input_buffer_words, 16U * 1024U * 1024U);
|
||||
}
|
||||
}
|
||||
if (cfg.do1_toggle_per_frame) {
|
||||
if (!cfg.recv_block_specified) {
|
||||
cfg.recv_block_words = 1024U;
|
||||
}
|
||||
if (!cfg.input_step_specified) {
|
||||
cfg.input_step_words = 1024U;
|
||||
}
|
||||
if (!cfg.input_buffer_specified) {
|
||||
cfg.input_buffer_words = std::max<uint32_t>(cfg.input_buffer_words, 256U * 1024U);
|
||||
}
|
||||
}
|
||||
if (cfg.recv_block_words == 0) {
|
||||
fail("recv_block must be > 0");
|
||||
}
|
||||
@ -1573,6 +1584,7 @@ int run(const Config& cfg) {
|
||||
TickMs last_stats_print = capture_loop_start;
|
||||
TickMs last_live_update = 0;
|
||||
bool do1_next_state_high = false;
|
||||
bool do1_last_queued_high = false;
|
||||
const std::size_t max_pending_dout_words = 1000000U;
|
||||
std::vector<uint32_t> dout_prepare_input;
|
||||
std::vector<uint32_t> dout_send_words;
|
||||
@ -1930,6 +1942,9 @@ int run(const Config& cfg) {
|
||||
|
||||
uint32_t recv_request_words = cfg.recv_block_words;
|
||||
uint32_t recv_timeout_ms = cfg.recv_timeout_ms;
|
||||
if (cfg.do1_toggle_per_frame) {
|
||||
recv_timeout_ms = std::min<uint32_t>(recv_timeout_ms, 1U);
|
||||
}
|
||||
uint32_t ready_words = 0;
|
||||
const int32_t ready_err = api.GetRecvReadyCount(device.hnd, &ready_words);
|
||||
if ((ready_err == X502_ERR_OK) && (ready_words != 0U)) {
|
||||
@ -2150,9 +2165,6 @@ int run(const Config& cfg) {
|
||||
|
||||
if (packet_active && stop_edge) {
|
||||
finish_packet(PacketCloseReason::ExternalStopEdge);
|
||||
if (cfg.do1_toggle_per_frame && (lch == (cfg.channel_count - 1U))) {
|
||||
append_dout_word(false);
|
||||
}
|
||||
if ((cfg.packet_limit != 0U) && (total_completed_packets >= cfg.packet_limit)) {
|
||||
stop_loop_requested = true;
|
||||
}
|
||||
@ -2162,9 +2174,11 @@ int run(const Config& cfg) {
|
||||
if (cfg.do1_toggle_per_frame && (lch == (cfg.channel_count - 1U))) {
|
||||
if (packet_active) {
|
||||
append_dout_word(do1_next_state_high);
|
||||
do1_last_queued_high = do1_next_state_high;
|
||||
do1_next_state_high = !do1_next_state_high;
|
||||
} else {
|
||||
} else if (do1_last_queued_high) {
|
||||
append_dout_word(false);
|
||||
do1_last_queued_high = false;
|
||||
}
|
||||
}
|
||||
|
||||
@ -2238,7 +2252,9 @@ int run(const Config& cfg) {
|
||||
}
|
||||
}
|
||||
|
||||
flush_dout_queue(0U, false);
|
||||
const uint32_t dout_send_timeout_ms =
|
||||
cfg.do1_toggle_per_frame ? std::min<uint32_t>(cfg.recv_timeout_ms, 1U) : 0U;
|
||||
flush_dout_queue(dout_send_timeout_ms, false);
|
||||
flush_tty_frames();
|
||||
|
||||
if (console_stop_requested()) {
|
||||
|
||||
Reference in New Issue
Block a user