Fix time reporting at end of read-file
This commit is contained in:
parent
8d1439da5a
commit
77546c0f2d
2 changed files with 8 additions and 4 deletions
|
@ -287,8 +287,11 @@ int pulse_detect_package(pulse_detect_t *pulse_detect, int16_t const *envelope_d
|
|||
pulse_detect_t *s = pulse_detect;
|
||||
s->ook_high_estimate = max(s->ook_high_estimate, OOK_MIN_HIGH_LEVEL); // Be sure to set initial minimum level
|
||||
|
||||
pulses->start_ago += len;
|
||||
fsk_pulses->start_ago += len;
|
||||
if (s->data_counter == 0) {
|
||||
// age the pulse_data if this is a fresh buffer
|
||||
pulses->start_ago += len;
|
||||
fsk_pulses->start_ago += len;
|
||||
}
|
||||
|
||||
// Process all new samples
|
||||
while(s->data_counter < len) {
|
||||
|
|
|
@ -1646,13 +1646,14 @@ int main(int argc, char **argv) {
|
|||
n_read = fread(test_mode_buf, 1, DEFAULT_BUF_LENGTH, in_file);
|
||||
}
|
||||
if (n_read == 0) break; // sdr_callback() will Segmentation Fault with len=0
|
||||
n_blocks++;
|
||||
demod->sample_file_pos = (float)n_blocks * n_read / cfg.samp_rate / 2 / demod->sample_size;
|
||||
demod->sample_file_pos = ((float)n_blocks * DEFAULT_BUF_LENGTH + n_read) / cfg.samp_rate / 2 / demod->sample_size;
|
||||
n_blocks++; // this assumes n_read == DEFAULT_BUF_LENGTH
|
||||
sdr_callback(test_mode_buf, n_read, demod);
|
||||
} while (n_read != 0 && !cfg.do_exit);
|
||||
|
||||
// Call a last time with cleared samples to ensure EOP detection
|
||||
memset(test_mode_buf, 128, DEFAULT_BUF_LENGTH); // 128 is 0 in unsigned data
|
||||
demod->sample_file_pos = ((float)n_blocks + 1) * DEFAULT_BUF_LENGTH / cfg.samp_rate / 2 / demod->sample_size;
|
||||
sdr_callback(test_mode_buf, DEFAULT_BUF_LENGTH, demod);
|
||||
|
||||
//Always classify a signal at the end of the file
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue