This commit is contained in:
awe
2026-04-27 20:25:10 +03:00
parent 1eb2505e37
commit d450e3b8b3

View File

@ -1243,6 +1243,7 @@ struct Do1NoiseSubtractState {
void configure(uint32_t history_steps) {
(void) history_steps;
clear_baseline();
reset_packet();
}
@ -1251,11 +1252,14 @@ struct Do1NoiseSubtractState {
step_count = {};
}
void reset_packet() {
clear_step();
void clear_baseline() {
last_high_avg = {};
last_high_valid = {};
high_baseline_pending = false;
}
void reset_packet() {
clear_step();
step_level_initialized = false;
step_di1_high = false;
next_index = 1;
@ -1870,6 +1874,11 @@ int run(const Config& cfg) {
}
if (!tty_do1_noise_state.has_complete_step(cfg.channel_count)) {
if (!tty_do1_noise_state.step_di1_high &&
tty_do1_noise_state.has_pending_high(cfg.channel_count)) {
// Invalidate the HIGH->LOW pair if LOW step is incomplete.
tty_do1_noise_state.consume_pending_high();
}
tty_do1_noise_state.finish_step();
return;
}