From ff2add9504dbf28710ed26ff2b70097e8922277b Mon Sep 17 00:00:00 2001 From: awe Date: Fri, 10 Apr 2026 21:39:03 +0300 Subject: [PATCH] fix swap chan --- main.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/main.cpp b/main.cpp index f1ab8d5..68a428a 100644 --- a/main.cpp +++ b/main.cpp @@ -1827,6 +1827,9 @@ int run(const Config& cfg) { const uint32_t din_value = pending_din.front(); pending_din.pop_front(); + // Keep ADC logical-channel phase aligned even when samples are skipped outside packet windows. + const uint32_t lch = next_lch; + next_lch = (next_lch + 1U) % cfg.channel_count; const bool di1_level = (din_value & kE502Digital1Mask) != 0U; bool di1_changed = false; @@ -1893,9 +1896,6 @@ int run(const Config& cfg) { tty_group_state.clear_step(); } - const uint32_t lch = next_lch; - next_lch = (next_lch + 1U) % cfg.channel_count; - if (!fast_tty_avg_stream_mode && (cfg.di1_mode == Di1Mode::Trace) && ((cfg.channel_count <= 1U) || (lch == 0U))) {