This commit is contained in:
awe
2026-05-29 18:30:18 +03:00
parent cbb6572f29
commit 5d8db44ef0
2 changed files with 22 additions and 10 deletions

View File

@ -3061,13 +3061,16 @@ int run(const Config& cfg) {
!tty_do1_pair_state.pending_ch1_di8_high && !di8_level;
if (pair_di1_matches && pair_di2_matches) {
if (!both_di8_high && !both_di8_normal) {
++packet_di8_mixed; // mixed DI8 pair -- discard
} else {
if (both_di8_high) {
tty_di8_state.add_sample(0U, tty_do1_pair_state.pending_ch1_raw);
tty_di8_state.add_sample(1U, adc_raw_value);
++packet_di8_samples_accumulated;
++packet_di8_both_high;
} else if (both_di8_normal) {
} else {
++packet_di8_both_normal;
}
// DO1 transition detection (ALL non-mixed pairs).
if (!tty_do1_pair_state.run_initialized) {
tty_do1_pair_state.start_run(di1_level);
} else if (tty_do1_pair_state.run_di1_high != di1_level) {
@ -3076,11 +3079,20 @@ int run(const Config& cfg) {
tty_do1_pair_state.start_run(di1_level);
}
// DI8=HIGH accumulation AFTER transition check so emitted
// di8_ref_step belongs to the completed run, not the new one.
if (both_di8_high) {
tty_di8_state.add_sample(0U, tty_do1_pair_state.pending_ch1_raw);
tty_di8_state.add_sample(1U, adc_raw_value);
++packet_di8_samples_accumulated;
}
// Pair subtraction includes ALL non-mixed pairs (both
// DI8=HIGH and DI8=LOW) so DO1 transitions stay visible
// even when DO8 and DO1 phases are perfectly aligned.
tty_do1_pair_state.add_pair_sample(di2_level,
tty_do1_pair_state.pending_ch1_raw,
adc_raw_value);
} else {
++packet_di8_mixed; // mixed DI8 pair -- discard
}
}
}

View File

@ -30,6 +30,6 @@ exec "$BIN" \
do1_toggle_per_frame \
do1_pair_subtract_avg \
do8_freq_ref \
do8_cycle_period:8 \
do8_cycle_period:4 \
"tty:${TTY_PATH}" \
"$@"