Skip to content

Commit

Permalink
SM5BSZ Linrad-05.03 rev 1040
Browse files Browse the repository at this point in the history
  • Loading branch information
fventuri committed Jun 2, 2024
1 parent d731b14 commit f3c8f6f
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 28 deletions.
42 changes: 22 additions & 20 deletions baseb_graph.c
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@
#endif

int binshape_points;
int binshape_total;
int reinit_baseb;
int baseband_graph_scro;
int bg_old_x1;
Expand Down Expand Up @@ -1395,14 +1394,14 @@ for(i=0; i<fft3_size; i++)
m=-ja;
ja=0;
}
j=(fft3_size/2-binshape_total)-m;
j=(fft3_size/2-binshape_points)-m;
if(j>0)
{
ja+=j;
m+=j;
}
if(jb > fft3_size)jb=fft3_size;
if(jb-ja > 2*binshape_total+1)jb=ja+2*binshape_total+1;
if(jb-ja > 2*binshape_points+1)jb=ja+2*binshape_points+1;
t1=0;
for(j=ja; j<jb; j++)
{
Expand Down Expand Up @@ -1484,14 +1483,14 @@ for(i=0; i<fft3_size; i++)
m=-ja;
ja=0;
}
j=(fft3_size/2-binshape_total)-m;
j=(fft3_size/2-binshape_points)-m;
if(j>0)
{
ja+=j;
m+=j;
}
if(jb > fft3_size)jb=fft3_size;
if(jb-ja > 2*binshape_total+1)jb=ja+2*binshape_total+1;
if(jb-ja > 2*binshape_points+1)jb=ja+2*binshape_points+1;
t1=0;
for(j=ja; j<jb; j++)
{
Expand Down Expand Up @@ -3499,39 +3498,42 @@ for(i=0; i<=fft3_size/2; i++)
if(bg_binshape[i]<t2)bg_binshape[i]=t2;
}
i=fft3_size/2-1;
k=fft3_size/2+1;
while(i > 0)
{
bg_binshape[i]=sqrt(bg_binshape[i]/bg_binshape[fft3_size/2]);
bg_binshape[k]=bg_binshape[i];
i--;
k++;
}
t2=sqrt(t2/bg_binshape[fft3_size/2]);
bg_binshape[fft3_size/2]=1;
binshape_points=0;
// The binshape function should be steeper the farther out we go.
// At some point rounding errors will flatten it out.
i=fft3_size/2-1;
// Get the -140 dB point
while(i>1 && bg_binshape[i-1] > 1.e-7)
t1=bg_binshape[i+1]/bg_binshape[i];
i--;
get_shape:;
if(bg_binshape[i+1]/bg_binshape[i] > t1)
{
t1=bg_binshape[i+1]/bg_binshape[i];
i--;
binshape_points++;
goto get_shape;
}
if(i > 10)i-=4;
k=fft3_size-i;
bg_binshape[i]=bg_binshape[i+1]/t1;
binshape_points=fft3_size/2-i;
while(i>0)
{
bg_binshape[i]=0;
bg_binshape[k]=0;
i--;
k++;
}
binshape_total=binshape_points;
while(i>0 && bg_binshape[i] > 1.5*t2)
bg_binshape[i]=0;
}
i=fft3_size/2-1;
k=fft3_size/2+1;
while(i > 0)
{
bg_binshape[k]=bg_binshape[i];
i--;
binshape_total++;
k++;
}
i=fft3_size/2-1;
// Now we have the spectral shape of a single FFT bin in
// bg_binshape with the maximum at position fft3_size/2.
// **************************************************************
Expand Down
5 changes: 3 additions & 2 deletions buf.c
Original file line number Diff line number Diff line change
Expand Up @@ -2130,10 +2130,11 @@ fft3_handle=chk_free(fft3_handle);
hires_handle=chk_free(hires_handle);
blanker_handle=chk_free(blanker_handle);
allan_handle=chk_free(allan_handle);
siganal_handle=chk_free(siganal_handle);
afc_handle=chk_free(afc_handle);
baseband_handle=chk_free(baseband_handle);
dx=chk_free(dx);
if(vgf_freq != NULL)free(vgf_freq);
if(vgf_ampl != NULL)free(vgf_ampl);
vgf_freq=chk_free(vgf_freq);
vgf_ampl=chk_free(vgf_ampl);
}

1 change: 1 addition & 0 deletions modesub.c
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,7 @@ afc_handle=NULL;
calmem_handle=NULL;
txmem_handle=NULL;
siganal_handle=NULL;
allan_handle=NULL;
vga_font=NULL;
dx=NULL;
// and that analog io is closed
Expand Down
5 changes: 1 addition & 4 deletions siganal_graph.c
Original file line number Diff line number Diff line change
Expand Up @@ -680,10 +680,7 @@ if(!restart)
resume_thread(THREAD_SCREEN);
return;
}
if(siganal_handle != NULL)
{
siganal_handle=chk_free(siganal_handle);
}
siganal_handle=chk_free(siganal_handle);
init_memalloc(siganalmem, MAX_SIGANAL_ARRAYS);
mem( 1,&sg_fft,sg_siz*4*sizeof(double),0);
mem( 2,&sg_pwr,baseband_size*4*sizeof(float),0);
Expand Down
2 changes: 0 additions & 2 deletions xmain.c
Original file line number Diff line number Diff line change
Expand Up @@ -961,7 +961,6 @@ while(extio_command_flag != EXTIO_COMMAND_KILL_ALL)
extio_command_flag=EXTIO_COMMAND_DONE;
}
kill:;
fprintf(dmp,"\nwait for menu");
pthread_join(thread_identifier_main_menu,0);
skipmenu:;
refresh_screen_flag=FALSE;
Expand Down Expand Up @@ -990,7 +989,6 @@ else
}
#endif
exitmain:;
fprintf(dmp,"\n exitmain");
users_close_devices();
lir_close_serport();
free(vga_font);
Expand Down

0 comments on commit f3c8f6f

Please sign in to comment.