This commit is contained in:
awe
2026-04-21 20:40:17 +03:00
parent 9b9b7a79ad
commit d36fb23470

View File

@ -763,10 +763,10 @@ Config parse_args(int argc, char** argv) {
} }
if (cfg.do1_toggle_per_frame) { if (cfg.do1_toggle_per_frame) {
if (!cfg.recv_block_specified) { if (!cfg.recv_block_specified) {
cfg.recv_block_words = 1024U; cfg.recv_block_words = 256U;
} }
if (!cfg.input_step_specified) { if (!cfg.input_step_specified) {
cfg.input_step_words = 1024U; cfg.input_step_words = 256U;
} }
if (!cfg.input_buffer_specified) { if (!cfg.input_buffer_specified) {
cfg.input_buffer_words = std::max<uint32_t>(cfg.input_buffer_words, 256U * 1024U); cfg.input_buffer_words = std::max<uint32_t>(cfg.input_buffer_words, 256U * 1024U);
@ -1786,6 +1786,10 @@ int run(const Config& cfg) {
} }
if (cfg.do1_toggle_per_frame) { if (cfg.do1_toggle_per_frame) {
do1_next_state_high = false; do1_next_state_high = false;
append_dout_word(do1_next_state_high);
do1_last_queued_high = do1_next_state_high;
do1_next_state_high = !do1_next_state_high;
flush_dout_queue(0U, false);
} }
packet_active = true; packet_active = true;
}; };
@ -1909,6 +1913,12 @@ int run(const Config& cfg) {
std::cout << "\n"; std::cout << "\n";
} }
if (cfg.do1_toggle_per_frame && do1_last_queued_high) {
append_dout_word(false);
do1_last_queued_high = false;
do1_next_state_high = false;
flush_dout_queue(0U, false);
}
packet_active = false; packet_active = false;
packet_avg_steps = 0; packet_avg_steps = 0;
fast_packet_frames = 0; fast_packet_frames = 0;
@ -1943,7 +1953,7 @@ int run(const Config& cfg) {
uint32_t recv_request_words = cfg.recv_block_words; uint32_t recv_request_words = cfg.recv_block_words;
uint32_t recv_timeout_ms = cfg.recv_timeout_ms; uint32_t recv_timeout_ms = cfg.recv_timeout_ms;
if (cfg.do1_toggle_per_frame) { if (cfg.do1_toggle_per_frame) {
recv_timeout_ms = std::min<uint32_t>(recv_timeout_ms, 1U); recv_timeout_ms = 0U;
} }
uint32_t ready_words = 0; uint32_t ready_words = 0;
const int32_t ready_err = api.GetRecvReadyCount(device.hnd, &ready_words); const int32_t ready_err = api.GetRecvReadyCount(device.hnd, &ready_words);
@ -2176,9 +2186,11 @@ int run(const Config& cfg) {
append_dout_word(do1_next_state_high); append_dout_word(do1_next_state_high);
do1_last_queued_high = do1_next_state_high; do1_last_queued_high = do1_next_state_high;
do1_next_state_high = !do1_next_state_high; do1_next_state_high = !do1_next_state_high;
flush_dout_queue(0U, false);
} else if (do1_last_queued_high) { } else if (do1_last_queued_high) {
append_dout_word(false); append_dout_word(false);
do1_last_queued_high = false; do1_last_queued_high = false;
flush_dout_queue(0U, false);
} }
} }
@ -2252,9 +2264,7 @@ int run(const Config& cfg) {
} }
} }
const uint32_t dout_send_timeout_ms = flush_dout_queue(0U, false);
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(); flush_tty_frames();
if (console_stop_requested()) { if (console_stop_requested()) {