Skip to content

Commit

Permalink
Avg Power
Browse files Browse the repository at this point in the history
  • Loading branch information
Dale Ranta committed Jul 24, 2023
1 parent 57d3325 commit b38f851
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 5 deletions.
Binary file removed .DS_Store
Binary file not shown.
2 changes: 1 addition & 1 deletion MainSource/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ static void control_cb(int control);

static void control_cb2(int control);

char *ProgramVersion=(char *)"SdrGlut-1162";
char *ProgramVersion=(char *)"SdrGlut-1164";

extern "C" struct Scene *sceneRoot(void);

Expand Down
11 changes: 7 additions & 4 deletions Radio/Radio.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -947,19 +947,22 @@ int Radio::updateLine()
welch(real,imag,&length);

amin = 0.0;
amax = 0.0;
int nn=0;
for(int n=10;n<length-10;++n){
v=(real[n]*real[n]+imag[n]*imag[n]);
if(v > 0.0)v=10*log10(v)+5;
double mag=(1.0-lineAlpha)*magnitude[length-n-1]+v*lineAlpha;
amin += mag;
amax += v;
++nn;
}

amin /= nn;

amax /= nn;

double shift=-90-amin;
rx->shiftGlobal = amin;
rx->shiftGlobal = amax;
if(rx->aminGlobal3 == 0.0)rx->aminGlobal3=shift;
rx->aminGlobal3 = 0.9*rx->aminGlobal3+0.1*shift;
// shift=rx->aminGlobal3;
Expand Down Expand Up @@ -1787,9 +1790,9 @@ static void displayc(void)
char value[256];

if(images->rx->mute){
msprintf(value,sizeof(value),"Frequency: %010ld Hz Center Frequency: %010ld Hz Power: %.0f db Shift: %.1f db MUTE",f,fc,images->rx->meterMax,fs);
msprintf(value,sizeof(value),"Frequency: %010ld Hz Center Frequency: %010ld Hz Power: %.0f db Avg: %.0f db MUTE",f,fc,images->rx->meterMax,fs);
}else{
msprintf(value,sizeof(value),"Frequency: %010ld Hz Center Frequency: %010ld Hz Power: %.0f db Shift: %.1f db ",f,fc,images->rx->meterMax,fs);
msprintf(value,sizeof(value),"Frequency: %010ld Hz Center Frequency: %010ld Hz Power: %.0f db Avg: %.0f db ",f,fc,images->rx->meterMax,fs);
}

DrawString(20, (int)scene->yResolution-15, value);
Expand Down
Binary file not shown.

0 comments on commit b38f851

Please sign in to comment.