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
35 changes: 20 additions & 15 deletions app/qtapp/rtknavi_qt/navimain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ MainWindow::MainWindow(QWidget *parent)
satellitesAzimuth[i][j] = satellitesElevation[i][j] = 0.0;
for (int k = 0; k < NFREQ; k++) {
validSatellites[i][j][k] = 0;
satellitesSNR[i][j][k] = 0;
satellitesSNR[i][j][k] = 0.0;
}
}

Expand Down Expand Up @@ -1664,7 +1664,8 @@ void MainWindow::drawSolutionPlot(QLabel *plot, int type, int freq)

int w = buffer.size().width() - 2;
int h = buffer.height() - 2;
int i, j, x, sat[2][MAXSAT], ns[2], snr[2][MAXSAT][NFREQ], vsat[2][MAXSAT][NFREQ];
int i, j, x, sat[2][MAXSAT], ns[2], vsat[2][MAXSAT][NFREQ];
double snr[2][MAXSAT][NFREQ];
int topMargin = QFontMetrics(optDialog->panelFont).height()*3/2;
double az[2][MAXSAT], el[2][MAXSAT], rr[3], pos[3];

Expand Down Expand Up @@ -1698,7 +1699,7 @@ void MainWindow::drawSolutionPlot(QLabel *plot, int type, int freq)
for (j = 0; j < numSatellites[i]; j++) {
for (int k = 0; k < NFREQ; k++) {
validSatellites[i][j][k] = 0;
satellitesSNR[i][j][k] = 0;
satellitesSNR[i][j][k] = 0.0;
}
}
}
Expand Down Expand Up @@ -1780,17 +1781,17 @@ void MainWindow::updatePlot()
}
}
// snr color ----------------------------------------------------------------
QColor MainWindow::snrColor(int snr)
QColor MainWindow::snrColor(double snr)
{
QColor color[] = {Qt::darkGreen, Color::Orange, Color::Fuchsia, Qt::blue, Qt::red, Qt::darkGray};
uint32_t r1, g1, b1;
QColor c1, c2;
double a;
int i;

if (snr < 25) return color[5];
if (snr < 27) return color[4];
if (snr > 47) return color[0];
if (snr < 25.0) return color[5];
if (snr < 27.0) return color[4];
if (snr > 47.0) return color[0];
a = (snr - 27.5) / 5.0;
i = static_cast<int>(a);
a -= i;
Expand All @@ -1812,7 +1813,8 @@ void MainWindow::drawSnr(QPainter &c, int w, int h, int x0, int y0,
QColor(128, 128, 128)
};
static const QColor color_sys[] = {Qt::darkGreen, Color::Orange, Color::Fuchsia, Qt::blue, Qt::red, Color::Teal, Qt::darkGray};
int i, j, snrIdx, sysIdx, numSystems, x1, y1, height, offset, topMargin, bottomMargin, hh, barDistance, barWidth, snr[NFREQ + 1], sysMask[7] = {0};
int i, j, snrIdx, sysIdx, numSystems, x1, y1, height, offset, topMargin, bottomMargin, hh, barDistance, barWidth, sysMask[7] = {0};
double snr[NFREQ + 1];
char id[8], sys[] = "GREJCS", *q;

trace(4, "drawSnr: w=%d h=%d x0=%d y0=%d index=%d freq=%d\n", w, h, x0, y0, index, freq);
Expand All @@ -1828,7 +1830,7 @@ void MainWindow::drawSnr(QPainter &c, int w, int h, int x0, int y0,
for (snr[0] = MINSNR + 10; snr[0] < MAXSNR; snr[0] += 10) {
y1 = y0 + hh - (snr[0] - MINSNR) * hh / (MAXSNR - MINSNR);
c.drawLine(x0 + 2, y1, x0 + w - 20, y1);
drawText(c, x0 + w - 4, y1, QLocale().toString(snr[0]), Qt::darkGray, 2, 0);
drawText(c, x0 + w - 4, y1, QString::number(qRound(snr[0])), Qt::darkGray, 2, 0);
}

// draw outer box
Expand All @@ -1846,15 +1848,16 @@ void MainWindow::drawSnr(QPainter &c, int w, int h, int x0, int y0,
satno2id(satellites[index][i], id);
sysIdx = (q = strchr(sys, id[0])) ? (int)(q - sys) : 6;

for (j = snr[0] = 0; j < NFREQ; j++) {
snr[0] = 0.0;
for (j = 0; j < NFREQ; j++) {
snr[j + 1] = satellitesSNR[index][i][j];
if ((freq && freq == j + 1) || ((!freq || freq > NFREQ) && snr[j + 1] > snr[0]))
snr[0] = snr[j + 1]; // store max snr
}
for (j = 0; j < NFREQ + 2; j++) {
snrIdx = j < NFREQ + 1 ? j : 0;
offset = j < NFREQ + 1 ? 0 : 2;
if (snr[snrIdx] > 0) height = (snr[snrIdx] - MINSNR) * hh / (MAXSNR - MINSNR);
if (snr[snrIdx] > 0) height = (int)round((snr[snrIdx] - MINSNR) * hh / (MAXSNR - MINSNR));
else height = offset;
height = height > y1 - 2 ? y1 - 2 : (height < 0 ? 0 : height); // limit bar from going negative or too high

Expand Down Expand Up @@ -1896,7 +1899,8 @@ void MainWindow::drawSatellites(QPainter &c, int w, int h, int x0, int y0,
QColor color_text;
QPoint p(w / 2, h / 2);
double r = qMin(w * 0.95, h * 0.95) / 2, azel[MAXSAT * 2], dop[4];
int i, j, k, sysIdx, radius, x[MAXSAT], y[MAXSAT], snr[NFREQ + 1], nsats = 0;
int i, j, k, sysIdx, radius, x[MAXSAT], y[MAXSAT], nsats = 0;
double snr[NFREQ + 1];
char id[8], sys[] = "GREJCIS", *q;

trace(4, "drawSatellites: w=%d h=%d index=%d freq=%d\n", w, h, index, freq);
Expand All @@ -1906,7 +1910,8 @@ void MainWindow::drawSatellites(QPainter &c, int w, int h, int x0, int y0,
// draw satellites
for (i = 0, k = numSatellites[index] - 1; i < numSatellites[index] && i < MAXSAT; i++, k--) {
if (satellitesElevation[index][k] <= 0.0) continue;
for (j = snr[0] = 0; j < NFREQ; j++) {
snr[0] = 0.0;
for (j = 0; j < NFREQ; j++) {
snr[j + 1] = satellitesSNR[index][k][j];
if ((freq && freq == j + 1) || ((!freq || freq > NFREQ) && snr[j + 1] > snr[0])) {
snr[0] = snr[j + 1]; // max snr
Expand All @@ -1915,7 +1920,7 @@ void MainWindow::drawSatellites(QPainter &c, int w, int h, int x0, int y0,
int anyValidSatFreq = 0;
for (int fi = 0; fi < NFREQ; fi++)
if (validSatellites[index][k][fi]) { anyValidSatFreq = 1; break; }
if (anyValidSatFreq && (freq > NFREQ || snr[freq] > 0)) {
if (anyValidSatFreq && (freq > NFREQ || snr[freq] > 0.0)) {
azel[nsats * 2] = satellitesAzimuth[index][k];
azel[nsats * 2 + 1] = satellitesElevation[index][k];
nsats++;
Expand All @@ -1930,7 +1935,7 @@ void MainWindow::drawSatellites(QPainter &c, int w, int h, int x0, int y0,
(freq < NFREQ + 1 ? snrColor(snr[freq]) : color_sys[sysIdx]));
c.setPen(Qt::darkGray);
color_text = Qt::white;
if (freq < NFREQ + 1 && snr[freq] <= 0) {
if (freq < NFREQ + 1 && snr[freq] <= 0.0) {
c.setPen(Color::Silver);
color_text = Color::Silver;
}
Expand Down
5 changes: 3 additions & 2 deletions app/qtapp/rtknavi_qt/navimain.h
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ public slots:
void showFrequenciesDialog();
void showMaskDialog();
void showKeyDialog();
QColor snrColor(int snr);
QColor snrColor(double snr);

public:
OptDialog *optDialog;
Expand All @@ -160,7 +160,8 @@ public slots:
int monitorPortOpen;

int solutionsCurrent, solutionsStart, solutionsEnd, numSatellites[2], solutionCurrentStatus;
int satellites[2][MAXSAT], satellitesSNR[2][MAXSAT][NFREQ], validSatellites[2][MAXSAT][NFREQ];
int satellites[2][MAXSAT], validSatellites[2][MAXSAT][NFREQ];
double satellitesSNR[2][MAXSAT][NFREQ];
double satellitesAzimuth[2][MAXSAT], satellitesElevation[2][MAXSAT];
gtime_t *timeStamps;
int *solutionStatus, *numValidSatellites;
Expand Down
31 changes: 18 additions & 13 deletions app/winapp/rtknavi/navimain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ __fastcall TMainForm::TMainForm(TComponent* Owner)
Sat[i][j]=0;
Az[i][j]=El[i][j]=0.0;
for (int k=0;k<NFREQ;k++) {
Snr[i][j][k]=0;
Snr[i][j][k]=0.0;
Vsat[i][j][k]=0;
}
}
Expand Down Expand Up @@ -1669,7 +1669,8 @@ void __fastcall TMainForm::DrawPlot(TImage *plot, int type, int freq)
TCanvas *c=plot->Canvas;
TLabel *label[]={Plabel1,Plabel2,Plabel3,Pos1,Pos2,Pos3};
int w=plot->Parent->Width-2,h=plot->Parent->Height-2;
int i,j,x,sat[2][MAXSAT],ns[2],snr[2][MAXSAT][NFREQ],vsat[2][MAXSAT][NFREQ];
int i,j,x,sat[2][MAXSAT],ns[2],vsat[2][MAXSAT][NFREQ];
double snr[2][MAXSAT][NFREQ];
int tm=PanelFont->Size*3/2;
char name[16];
double az[2][MAXSAT],el[2][MAXSAT],rr[3],rs[6],e[3],pos[3],azel[2];
Expand Down Expand Up @@ -1802,16 +1803,16 @@ void __fastcall TMainForm::UpdatePlot(void)
}
}
// snr color ----------------------------------------------------------------
TColor __fastcall TMainForm::SnrColor(int snr)
TColor __fastcall TMainForm::SnrColor(double snr)
{
TColor color[]={clGreen,CLORANGE,clFuchsia,clBlue,clRed,clGray};
uint32_t c1,c2,r1,r2,g1,g2,b1,b2;
double a;
int i;

if (snr<25) return color[5];
if (snr<27) return color[4];
if (snr>47) return color[0];
if (snr<25.0) return color[5];
if (snr<27.0) return color[4];
if (snr>47.0) return color[0];
a=(snr-27.5)/5.0;
i=(int)a; a-=i;
c1=(uint32_t)color[3-i];
Expand All @@ -1837,7 +1838,8 @@ void __fastcall TMainForm::DrawSnr(TCanvas *c, int w, int h, int x0, int y0,
clGreen,(TColor)0xAAFF,clFuchsia,clBlue,clRed,clTeal,clGray
};
UTF8String s;
int i,j,k,l,n,x1,x2,y1,y2,y3,k1,tm,bm,hh,ww,www,snr[NFREQ+1],mask[7]={0};
int i,j,k,l,n,x1,x2,y1,y2,y3,k1,tm,bm,hh,ww,www,mask[7]={0};
double snr[NFREQ+1];
char id[8],sys[]="GREJCIS",*q;

trace(4,"DrawSnr: w=%d h=%d x0=%d y0=%d index=%d freq=%d\n",w,h,x0,y0,index,freq);
Expand All @@ -1850,7 +1852,7 @@ void __fastcall TMainForm::DrawSnr(TCanvas *c, int w, int h, int x0, int y0,
for (snr[0]=MINSNR+10;snr[0]<MAXSNR;snr[0]+=10) {
y1=y0+hh-(snr[0]-MINSNR)*hh/(MAXSNR-MINSNR);
c->MoveTo(x0+2,y1); c->LineTo(x0+w-2,y1);
DrawText(c,x0+w-4,y1,s.sprintf("%d",snr[0]),clGray,2,0);
DrawText(c,x0+w-4,y1,s.sprintf("%d",(int)round(snr[0])),clGray,2,0);
}
y1=y0+hh;
TRect b(x0+2,y0,x0+w-2,y1);
Expand All @@ -1865,8 +1867,9 @@ void __fastcall TMainForm::DrawSnr(TCanvas *c, int w, int h, int x0, int y0,
x1=x0+i*(w-16)/Nsat[index]+ww/2;
satno2id(Sat[index][i],id);
l=(q=strchr(sys,id[0]))?(int)(q-sys):6;

for (j=snr[0]=0;j<NFREQ;j++) {

snr[0]=0.0;
for (j=0;j<NFREQ;j++) {
snr[j+1]=Snr[index][i][j];
if ((freq&&freq==j+1)||((!freq||freq>NFREQ)&&snr[j+1]>snr[0])) {
snr[0]=snr[j+1];
Expand All @@ -1876,7 +1879,7 @@ void __fastcall TMainForm::DrawSnr(TCanvas *c, int w, int h, int x0, int y0,
k=j<NFREQ+1?j:0;
y3=j<NFREQ+1?0:2;
y2=y1-y3;
if (snr[k]>0) y2-=(snr[k]-MINSNR)*hh/(MAXSNR-MINSNR)-y3;
if (snr[k]>0) y2-=(int)round((snr[k]-MINSNR)*hh/(MAXSNR-MINSNR)-y3);
y2=y2<2?2:(y1<y2?y1:y2);

TRect r1(x1,y1,x1+www,y2);
Expand Down Expand Up @@ -1916,7 +1919,8 @@ void __fastcall TMainForm::DrawSat(TCanvas *c, int w, int h, int x0, int y0,
UTF8String s;
TPoint p(w/2,h/2);
double r=MIN(w*0.95,h*0.95)/2,azel[MAXSAT*2],dop[4];
int i,j,k,l,d,x[MAXSAT],y[MAXSAT],snr[NFREQ+1],ns=0;
int i,j,k,l,d,x[MAXSAT],y[MAXSAT],ns=0;
double snr[NFREQ+1];
char id[8],sys[]="GREJCIS",*q;

trace(4,"DrawSat: w=%d h=%d index=%d freq=%d\n",w,h,index,freq);
Expand All @@ -1925,7 +1929,8 @@ void __fastcall TMainForm::DrawSat(TCanvas *c, int w, int h, int x0, int y0,

for (i=0,k=Nsat[index]-1;i<Nsat[index]&&i<MAXSAT;i++,k--) {
if (El[index][k]<=0.0) continue;
for (j=snr[0]=0;j<NFREQ;j++) {
snr[0]=0;
for (j=0;j<NFREQ;j++) {
snr[j+1]=Snr[index][k][j];
if ((freq&&freq==j+1)||((!freq||freq>NFREQ)&&snr[j+1]>snr[0])) {
snr[0]=snr[j+1]; // max snr
Expand Down
5 changes: 3 additions & 2 deletions app/winapp/rtknavi/navimain.h
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ class TMainForm : public TForm
void __fastcall SaveOpt (void);
void __fastcall SetTrayIcon (int index);
int __fastcall ExecCmd (AnsiString cmd, int show);
TColor __fastcall SnrColor (int snr);
TColor __fastcall SnrColor (double snr);
public:
AnsiString IniFile;

Expand All @@ -254,7 +254,8 @@ class TMainForm : public TForm
int MoniPort,OpenPort,AutoRun;

int PSol,PSolS,PSolE,Nsat[2],SolCurrentStat;
int Sat[2][MAXSAT],Snr[2][MAXSAT][NFREQ],Vsat[2][MAXSAT][NFREQ];
int Sat[2][MAXSAT],Vsat[2][MAXSAT][NFREQ];
double Snr[2][MAXSAT][NFREQ];
double Az[2][MAXSAT],El[2][MAXSAT];
gtime_t *Time;
int *SolStat,*Nvsat;
Expand Down
12 changes: 6 additions & 6 deletions src/rcv/binex.c
Original file line number Diff line number Diff line change
Expand Up @@ -987,16 +987,16 @@ static uint8_t *decode_bnx_7f_05_obs(raw_t *raw, uint8_t *buff, int sat,
}
if (k<0) {
data->P[i]=data->L[i]=0.0;
data->D[i]=data->SNR[i]=0.0;
data->D[i]=data->SNR[i]=0.0f;
data->LLI[i]=0;
data->code[i]=CODE_NONE;
}
else {
freq=code2freq(sys,codes[code[k]],fcn);
data->P[i]=range[k];
data->L[i]=phase[k]*freq/CLIGHT;
data->D[i]=dopp[k];
data->SNR[i]=cnr[k];
data->D[i]=(float)dopp[k];
data->SNR[i]=(float)cnr[k];
data->code[i]=codes[code[k]];
data->LLI[i]=slip[k]?1:0;
mask[k]=1;
Expand All @@ -1008,16 +1008,16 @@ static uint8_t *decode_bnx_7f_05_obs(raw_t *raw, uint8_t *buff, int sat,
}
if (k>=nobs) {
data->P[i]=data->L[i]=0.0;
data->D[i]=data->SNR[i]=0.0;
data->D[i]=data->SNR[i]=0.0f;
data->LLI[i]=0;
data->code[i]=CODE_NONE;
}
else {
freq=code2freq(sys,codes[code[k]],fcn);
data->P[i]=range[k];
data->L[i]=phase[k]*freq/CLIGHT;
data->D[i]=dopp[k];
data->SNR[i]=cnr[k];
data->D[i]=(float)dopp[k];
data->SNR[i]=(float)cnr[k];
data->code[i]=codes[code[k]];
data->LLI[i]=slip[k]?1:0;
mask[k]=1;
Expand Down
2 changes: 1 addition & 1 deletion src/rcv/comnav.c
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,7 @@ static int decode_rangeb(raw_t *raw)
raw->obs.data[index].L [pos]=-adr;
raw->obs.data[index].P [pos]=psr;
raw->obs.data[index].D [pos]=(float)dop;
raw->obs.data[index].SNR[pos]=0.0<=snr&&snr<255.0?snr:0;
raw->obs.data[index].SNR[pos]=0.0<=snr&&snr<255.0?(float)snr:0.0f;
raw->obs.data[index].LLI[pos]=(unsigned char)lli;
raw->obs.data[index].code[pos]=code;
#ifdef RTK_DISABLED
Expand Down
10 changes: 5 additions & 5 deletions src/rcv/crescent.c
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ static int decode_cresraw(raw_t *raw)
raw->obs.data[n].P[0]=pr;
raw->obs.data[n].L[0]=cp*freq/CLIGHT;
raw->obs.data[n].D[0]=-(float)(dop*freq/CLIGHT);
raw->obs.data[n].SNR[0]=snr;
raw->obs.data[n].SNR[0]=(float)snr;
raw->obs.data[n].LLI[0]=(uint8_t)lli;
raw->obs.data[n].code[0]=CODE_L1C;

Expand Down Expand Up @@ -256,13 +256,13 @@ static int decode_cresraw2(raw_t *raw)
raw->obs.data[n].P[j]=pr[j]==0.0?0.0:pr[j]-toff;
raw->obs.data[n].L[j]=cp[j]==0.0?0.0:cp[j]-toff*freq[j]/CLIGHT;
raw->obs.data[n].D[j]=-(float)dop[j];
raw->obs.data[n].SNR[j]=snr[j];
raw->obs.data[n].SNR[j]=(float)snr[j];
raw->obs.data[n].LLI[j]=(uint8_t)lli[j];
raw->obs.data[n].code[j]=j==0?CODE_L1C:CODE_L2P;
}
else {
raw->obs.data[n].L[j]=raw->obs.data[n].P[j]=0.0;
raw->obs.data[n].D[j]=raw->obs.data[n].SNR[j]=0.0;
raw->obs.data[n].D[j]=raw->obs.data[n].SNR[j]=0.0f;
raw->obs.data[n].LLI[j]=0;
raw->obs.data[n].code[j]=CODE_NONE;
}
Expand Down Expand Up @@ -461,13 +461,13 @@ static int decode_cresgloraw(raw_t *raw)
raw->obs.data[n].P[j]=pr[j]==0.0?0.0:pr[j]-toff;
raw->obs.data[n].L[j]=cp[j]==0.0?0.0:cp[j]-toff*freq[j]/CLIGHT;
raw->obs.data[n].D[j]=-(float)dop[j];
raw->obs.data[n].SNR[j]=snr[j];
raw->obs.data[n].SNR[j]=(float)snr[j];
raw->obs.data[n].LLI[j]=(uint8_t)lli[j];
raw->obs.data[n].code[j]=j==0?CODE_L1C:CODE_L2P;
}
else {
raw->obs.data[n].L[j]=raw->obs.data[n].P[j]=0.0;
raw->obs.data[n].D[j]=raw->obs.data[n].SNR[j]=0.0;
raw->obs.data[n].D[j]=raw->obs.data[n].SNR[j]=0.0f;
raw->obs.data[n].LLI[j]=0;
raw->obs.data[n].code[j]=CODE_NONE;
}
Expand Down
6 changes: 3 additions & 3 deletions src/rcv/javad.c
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ static int flushobuf(raw_t *raw)
raw->obuf.data[i].time=time0;
for (j=0;j<NFREQ+NEXOBS;j++) {
raw->obuf.data[i].L[j]=raw->obuf.data[i].P[j]=0.0;
raw->obuf.data[i].D[j]=raw->obuf.data[i].SNR[j]=0.0;
raw->obuf.data[i].D[j]=raw->obuf.data[i].SNR[j]=0.0f;
raw->obuf.data[i].LLI[j]=0;
raw->obuf.data[i].code[j]=CODE_NONE;
}
Expand Down Expand Up @@ -1581,7 +1581,7 @@ static int decode_Ex(raw_t *raw, char sig)

if ((idx=checkpri(sys,code,raw->opt,idx))>=0) {
if (!settag(raw->obuf.data+i,raw->time)) continue;
raw->obuf.data[i].SNR[idx]=cnr;
raw->obuf.data[i].SNR[idx]=(float)cnr;
}
}
return 0;
Expand Down Expand Up @@ -1612,7 +1612,7 @@ static int decode_xE(raw_t *raw, char sig)

if ((idx=checkpri(sys,code,raw->opt,idx))>=0) {
if (!settag(raw->obuf.data+i,raw->time)) continue;
raw->obuf.data[i].SNR[idx]=cnr*0.25;
raw->obuf.data[i].SNR[idx]=(float)(cnr*0.25);
}
}
return 0;
Expand Down
Loading