Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion src/algo.c
Original file line number Diff line number Diff line change
Expand Up @@ -898,15 +898,20 @@ static void compute_cal(struct calibration_data *cd)
void process(struct processing_buffers *p, int bph, double la, int light)
{
prepare_data(p, !light);

p->ready = !compute_period(p,bph);
if(p->ready && p->period >= p->sample_rate / 2) {
/* Limit to 20% greater when period is known, or 500 ms when guessing period */
const int min_bph = bph ? bph : TYP_BPH;
const int max_period = (int)(1.2 * 3600 * 2) * p->sample_rate / min_bph;
if(p->ready && p->period >= max_period) {
debug("Detected period too long\n");
p->ready = 0;
}
if(!p->ready) {
debug("abort after compute_period()\n");
return;
}

prepare_waveform(p);
p->ready = !compute_parameters(p);
if(!p->ready) {
Expand Down
3 changes: 2 additions & 1 deletion src/tg.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,8 @@
#define PAPERSTRIP_ZOOM_CAL 100
#define PAPERSTRIP_MARGIN .2

#define MIN_BPH 12000
#define MIN_BPH 8100
#define TYP_BPH 12000
#define MAX_BPH 72000
#define DEFAULT_BPH 21600
#define MIN_LA 10 // deg
Expand Down