1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2024-12-14 20:20:35 +00:00

Fix more warnings

This commit is contained in:
Carles Fernandez 2017-05-13 19:35:20 +02:00
parent cc392fdde2
commit 495813c969
3 changed files with 93 additions and 89 deletions

View File

@ -23,7 +23,7 @@ void saveoutbuf(rtksvr_t *svr, unsigned char *buff, int n, int index)
{ {
rtksvrlock(svr); rtksvrlock(svr);
n = n<svr->buffsize-svr->nsb[index]?n:svr->buffsize-svr->nsb[index]; n = n < svr->buffsize-svr->nsb[index] ? n : svr->buffsize-svr->nsb[index];
memcpy(svr->sbuf[index]+svr->nsb[index], buff, n); memcpy(svr->sbuf[index]+svr->nsb[index], buff, n);
svr->nsb[index] += n; svr->nsb[index] += n;
@ -40,7 +40,7 @@ void writesol(rtksvr_t *svr, int index)
tracet(4, "writesol: index=%d\n", index); tracet(4, "writesol: index=%d\n", index);
for (i = 0; i<2; i++) for (i = 0; i < 2; i++)
{ {
/* output solution */ /* output solution */
n = outsols(buff, &svr->rtk.sol, svr->rtk.rb, svr->solopt+i); n = outsols(buff, &svr->rtk.sol, svr->rtk.rb, svr->solopt+i);
@ -63,7 +63,7 @@ void writesol(rtksvr_t *svr, int index)
strwrite(svr->moni, buff, n); strwrite(svr->moni, buff, n);
} }
/* save solution buffer */ /* save solution buffer */
if (svr->nsol<MAXSOLBUF) if (svr->nsol < MAXSOLBUF)
{ {
rtksvrlock(svr); rtksvrlock(svr);
svr->solbuf[svr->nsol++] = svr->rtk.sol; svr->solbuf[svr->nsol++] = svr->rtk.sol;
@ -76,7 +76,7 @@ void writesol(rtksvr_t *svr, int index)
void updatenav(nav_t *nav) void updatenav(nav_t *nav)
{ {
int i, j; int i, j;
for (i = 0; i<MAXSAT; i++) for (j = 0; j<NFREQ; j++) for (i = 0; i < MAXSAT; i++) for (j = 0; j < NFREQ; j++)
{ {
nav->lam[i][j] = satwavelen(i+1, j, nav); nav->lam[i][j] = satwavelen(i+1, j, nav);
} }
@ -88,18 +88,18 @@ void updatefcn(rtksvr_t *svr)
{ {
int i, j, sat, frq; int i, j, sat, frq;
for (i = 0; i<MAXPRNGLO; i++) for (i = 0; i < MAXPRNGLO; i++)
{ {
sat = satno(SYS_GLO, i+1); sat = satno(SYS_GLO, i+1);
for (j = 0, frq = -999; j<3; j++) for (j = 0, frq = -999; j < 3; j++)
{ {
if (svr->raw[j].nav.geph[i].sat != sat) continue; if (svr->raw[j].nav.geph[i].sat != sat) continue;
frq = svr->raw[j].nav.geph[i].frq; frq = svr->raw[j].nav.geph[i].frq;
} }
if (frq<-7 || frq>6) continue; if (frq < -7 || frq>6) continue;
for (j = 0; j<3; j++) for (j = 0; j < 3; j++)
{ {
if (svr->raw[j].nav.geph[i].sat == sat) continue; if (svr->raw[j].nav.geph[i].sat == sat) continue;
svr->raw[j].nav.geph[i].sat = sat; svr->raw[j].nav.geph[i].sat = sat;
@ -123,9 +123,9 @@ void updatesvr(rtksvr_t *svr, int ret, obs_t *obs, nav_t *nav, int sat,
if (ret == 1) if (ret == 1)
{ /* observation data */ { /* observation data */
if (iobs<MAXOBSBUF) if (iobs < MAXOBSBUF)
{ {
for (i = 0; i<obs->n; i++) for (i = 0; i < obs->n; i++)
{ {
if (svr->rtk.opt.exsats[obs->data[i].sat-1] == 1 || if (svr->rtk.opt.exsats[obs->data[i].sat-1] == 1 ||
!(satsys(obs->data[i].sat, NULL)&svr->rtk.opt.navsys)) continue; !(satsys(obs->data[i].sat, NULL)&svr->rtk.opt.navsys)) continue;
@ -181,13 +181,13 @@ void updatesvr(rtksvr_t *svr, int ret, obs_t *obs, nav_t *nav, int sat,
{ /* sbas message */ { /* sbas message */
if (sbsmsg && (sbssat == sbsmsg->prn || sbssat == 0)) if (sbsmsg && (sbssat == sbsmsg->prn || sbssat == 0))
{ {
if (svr->nsbs<MAXSBSMSG) if (svr->nsbs < MAXSBSMSG)
{ {
svr->sbsmsg[svr->nsbs++] = *sbsmsg; svr->sbsmsg[svr->nsbs++] = *sbsmsg;
} }
else else
{ {
for (i = 0; i<MAXSBSMSG-1; i++) svr->sbsmsg[i] = svr->sbsmsg[i+1]; for (i = 0; i < MAXSBSMSG-1; i++) svr->sbsmsg[i] = svr->sbsmsg[i+1];
svr->sbsmsg[i] = *sbsmsg; svr->sbsmsg[i] = *sbsmsg;
} }
sbsupdatecorr(sbsmsg, &svr->nav); sbsupdatecorr(sbsmsg, &svr->nav);
@ -198,12 +198,12 @@ void updatesvr(rtksvr_t *svr, int ret, obs_t *obs, nav_t *nav, int sat,
{ /* ion/utc parameters */ { /* ion/utc parameters */
if (svr->navsel == index || svr->navsel >= 3) if (svr->navsel == index || svr->navsel >= 3)
{ {
for (i = 0; i<8; i++) svr->nav.ion_gps[i] = nav->ion_gps[i]; for (i = 0; i < 8; i++) svr->nav.ion_gps[i] = nav->ion_gps[i];
for (i = 0; i<4; i++) svr->nav.utc_gps[i] = nav->utc_gps[i]; for (i = 0; i < 4; i++) svr->nav.utc_gps[i] = nav->utc_gps[i];
for (i = 0; i<4; i++) svr->nav.ion_gal[i] = nav->ion_gal[i]; for (i = 0; i < 4; i++) svr->nav.ion_gal[i] = nav->ion_gal[i];
for (i = 0; i<4; i++) svr->nav.utc_gal[i] = nav->utc_gal[i]; for (i = 0; i < 4; i++) svr->nav.utc_gal[i] = nav->utc_gal[i];
for (i = 0; i<8; i++) svr->nav.ion_qzs[i] = nav->ion_qzs[i]; for (i = 0; i < 8; i++) svr->nav.ion_qzs[i] = nav->ion_qzs[i];
for (i = 0; i<4; i++) svr->nav.utc_qzs[i] = nav->utc_qzs[i]; for (i = 0; i < 4; i++) svr->nav.utc_qzs[i] = nav->utc_qzs[i];
svr->nav.leaps = nav->leaps; svr->nav.leaps = nav->leaps;
} }
svr->nmsg[index][2]++; svr->nmsg[index][2]++;
@ -212,7 +212,7 @@ void updatesvr(rtksvr_t *svr, int ret, obs_t *obs, nav_t *nav, int sat,
{ /* antenna postion parameters */ { /* antenna postion parameters */
if (svr->rtk.opt.refpos == 4 && index == 1) if (svr->rtk.opt.refpos == 4 && index == 1)
{ {
for (i = 0; i<3; i++) for (i = 0; i < 3; i++)
{ {
svr->rtk.rb[i] = svr->rtcm[1].sta.pos[i]; svr->rtk.rb[i] = svr->rtcm[1].sta.pos[i];
} }
@ -222,7 +222,7 @@ void updatesvr(rtksvr_t *svr, int ret, obs_t *obs, nav_t *nav, int sat,
{ /* xyz */ { /* xyz */
del[2] = svr->rtcm[1].sta.hgt; del[2] = svr->rtcm[1].sta.hgt;
enu2ecef(pos, del, dr); enu2ecef(pos, del, dr);
for (i = 0; i<3; i++) for (i = 0; i < 3; i++)
{ {
svr->rtk.rb[i] += svr->rtcm[1].sta.del[i]+dr[i]; svr->rtk.rb[i] += svr->rtcm[1].sta.del[i]+dr[i];
} }
@ -230,7 +230,7 @@ void updatesvr(rtksvr_t *svr, int ret, obs_t *obs, nav_t *nav, int sat,
else else
{ /* enu */ { /* enu */
enu2ecef(pos, svr->rtcm[1].sta.del, dr); enu2ecef(pos, svr->rtcm[1].sta.del, dr);
for (i = 0; i<3; i++) for (i = 0; i < 3; i++)
{ {
svr->rtk.rb[i] += dr[i]; svr->rtk.rb[i] += dr[i];
} }
@ -244,7 +244,7 @@ void updatesvr(rtksvr_t *svr, int ret, obs_t *obs, nav_t *nav, int sat,
} }
else if (ret == 10) else if (ret == 10)
{ /* ssr message */ { /* ssr message */
for (i = 0; i<MAXSAT; i++) for (i = 0; i < MAXSAT; i++)
{ {
if (!svr->rtcm[index].ssr[i].update) continue; if (!svr->rtcm[index].ssr[i].update) continue;
svr->rtcm[index].ssr[i].update = 0; svr->rtcm[index].ssr[i].update = 0;
@ -297,7 +297,7 @@ int decoderaw(rtksvr_t *svr, int index)
rtksvrlock(svr); rtksvrlock(svr);
for (i = 0; i<svr->nb[index]; i++) for (i = 0; i < svr->nb[index]; i++)
{ {
/* input rtcm/receiver raw data from stream */ /* input rtcm/receiver raw data from stream */
if (svr->format[index] == STRFMT_RTCM2) if (svr->format[index] == STRFMT_RTCM2)
@ -336,7 +336,7 @@ int decoderaw(rtksvr_t *svr, int index)
/* observation data received */ /* observation data received */
if (ret == 1) if (ret == 1)
{ {
if (fobs<MAXOBSBUF) fobs++; else svr->prcout++; if (fobs < MAXOBSBUF) fobs++; else svr->prcout++;
} }
} }
svr->nb[index] = 0; svr->nb[index] = 0;
@ -450,7 +450,7 @@ void *rtksvrthread(void *arg)
{ {
tick = tickget(); tick = tickget();
for (i = 0; i<3; i++) for (i = 0; i < 3; i++)
{ {
p = svr->buff[i]+svr->nb[i]; q = svr->buff[i]+svr->buffsize; p = svr->buff[i]+svr->nb[i]; q = svr->buff[i]+svr->buffsize;
@ -465,12 +465,12 @@ void *rtksvrthread(void *arg)
/* save peek buffer */ /* save peek buffer */
rtksvrlock(svr); rtksvrlock(svr);
n = n<svr->buffsize-svr->npb[i]?n:svr->buffsize-svr->npb[i]; n = n < svr->buffsize-svr->npb[i] ? n : svr->buffsize-svr->npb[i];
memcpy(svr->pbuf[i]+svr->npb[i], p, n); memcpy(svr->pbuf[i]+svr->npb[i], p, n);
svr->npb[i] += n; svr->npb[i] += n;
rtksvrunlock(svr); rtksvrunlock(svr);
} }
for (i = 0; i<3; i++) for (i = 0; i < 3; i++)
{ {
if (svr->format[i] == STRFMT_SP3 || svr->format[i] == STRFMT_RNXCLK) if (svr->format[i] == STRFMT_SP3 || svr->format[i] == STRFMT_RNXCLK)
{ {
@ -483,14 +483,14 @@ void *rtksvrthread(void *arg)
fobs[i] = decoderaw(svr, i); fobs[i] = decoderaw(svr, i);
} }
} }
for (i = 0; i<fobs[0]; i++) for (i = 0; i < fobs[0]; i++)
{ /* for each rover observation data */ { /* for each rover observation data */
obs.n = 0; obs.n = 0;
for (j = 0; j<svr->obs[0][i].n && obs.n<MAXOBS*2; j++) for (j = 0; j < svr->obs[0][i].n && obs.n < MAXOBS*2; j++)
{ {
obs.data[obs.n++] = svr->obs[0][i].data[j]; obs.data[obs.n++] = svr->obs[0][i].data[j];
} }
for (j = 0; j<svr->obs[1][0].n && obs.n<MAXOBS*2; j++) for (j = 0; j < svr->obs[1][0].n && obs.n < MAXOBS*2; j++)
{ {
obs.data[obs.n++] = svr->obs[1][0].data[j]; obs.data[obs.n++] = svr->obs[1][0].data[j];
} }
@ -543,8 +543,8 @@ void *rtksvrthread(void *arg)
/* sleep until next cycle */ /* sleep until next cycle */
sleepms(svr->cycle-cputime); sleepms(svr->cycle-cputime);
} }
for (i = 0; i<MAXSTRRTK; i++) strclose(svr->stream+i); for (i = 0; i < MAXSTRRTK; i++) strclose(svr->stream+i);
for (i = 0; i<3; i++) for (i = 0; i < 3; i++)
{ {
svr->nb[i] = svr->npb[i] = 0; svr->nb[i] = svr->npb[i] = 0;
free(svr->buff[i]); svr->buff[i] = NULL; free(svr->buff[i]); svr->buff[i] = NULL;
@ -552,7 +552,7 @@ void *rtksvrthread(void *arg)
//free_raw (svr->raw +i); //free_raw (svr->raw +i);
free_rtcm(svr->rtcm+i); free_rtcm(svr->rtcm+i);
} }
for (i = 0; i<2; i++) for (i = 0; i < 2; i++)
{ {
svr->nsb[i] = 0; svr->nsb[i] = 0;
free(svr->sbuf[i]); svr->sbuf[i] = NULL; free(svr->sbuf[i]); svr->sbuf[i] = NULL;
@ -569,51 +569,55 @@ void *rtksvrthread(void *arg)
int rtksvrinit(rtksvr_t *svr) int rtksvrinit(rtksvr_t *svr)
{ {
gtime_t time0 = {0, 0.0}; gtime_t time0 = {0, 0.0};
sol_t sol0 = {{0,0}, {0,0,0,0,0,0}, {0,0,0,0,0,0}, {0,0,0,0,0,0}, '0', '0', '0', 0, 0, 0 }; sol_t sol0 = {{0,0}, {0,0,0,0,0,0}, {0,0,0,0,0,0}, {0,0,0,0,0,0},
eph_t eph0 = {0, -1, -1, 0, 0, 0, 0, 0, {0,0.0}, {0,0.0}, {0,0.0}, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, {0.0}, 0.0, 0.0}; '0', '0', '0', 0, 0, 0 };
geph_t geph0 = {0, -1, 0, 0, 0, 0, {0,0.0}, {0,0.0}, {0.0}, {0.0}, {0.0}, 0.0, 0.0, 0.0}; eph_t eph0 = {0, -1, -1, 0, 0, 0, 0, 0, {0,0.0}, {0,0.0}, {0,0.0},
0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, {0.0}, 0.0, 0.0};
geph_t geph0 = {0, -1, 0, 0, 0, 0, {0,0.0}, {0,0.0}, {0.0}, {0.0}, {0.0},
0.0, 0.0, 0.0};
seph_t seph0 = {0, {0,0.0}, {0,0.0}, 0, 0, {0.0}, {0.0}, {0.0}, 0.0, 0.0}; seph_t seph0 = {0, {0,0.0}, {0,0.0}, 0, 0, {0.0}, {0.0}, {0.0}, 0.0, 0.0};
int i, j; int i, j;
tracet(3, "rtksvrinit:\n"); tracet(3, "rtksvrinit:\n");
svr->state = svr->cycle = svr->nmeacycle = svr->nmeareq = 0; svr->state = svr->cycle = svr->nmeacycle = svr->nmeareq = 0;
for (i = 0; i<3; i++) svr->nmeapos[i] = 0.0; for (i = 0; i < 3; i++) svr->nmeapos[i] = 0.0;
svr->buffsize = 0; svr->buffsize = 0;
for (i = 0; i<3; i++) svr->format[i] = 0; for (i = 0; i < 3; i++) svr->format[i] = 0;
for (i = 0; i<2; i++) svr->solopt[i] = solopt_default; for (i = 0; i < 2; i++) svr->solopt[i] = solopt_default;
svr->navsel = svr->nsbs = svr->nsol = 0; svr->navsel = svr->nsbs = svr->nsol = 0;
rtkinit(&svr->rtk, &prcopt_default); rtkinit(&svr->rtk, &prcopt_default);
for (i = 0; i<3; i++) svr->nb[i] = 0; for (i = 0; i < 3; i++) svr->nb[i] = 0;
for (i = 0; i<2; i++) svr->nsb[i] = 0; for (i = 0; i < 2; i++) svr->nsb[i] = 0;
for (i = 0; i<3; i++) svr->npb[i] = 0; for (i = 0; i < 3; i++) svr->npb[i] = 0;
for (i = 0; i<3; i++) svr->buff[i] = NULL; for (i = 0; i < 3; i++) svr->buff[i] = NULL;
for (i = 0; i<2; i++) svr->sbuf[i] = NULL; for (i = 0; i < 2; i++) svr->sbuf[i] = NULL;
for (i = 0; i<3; i++) svr->pbuf[i] = NULL; for (i = 0; i < 3; i++) svr->pbuf[i] = NULL;
for (i = 0; i<MAXSOLBUF; i++) svr->solbuf[i] = sol0; for (i = 0; i < MAXSOLBUF; i++) svr->solbuf[i] = sol0;
for (i = 0; i<3; i++) for (j = 0; j<10; j++) svr->nmsg[i][j] = 0; for (i = 0; i < 3; i++) for (j = 0; j < 10; j++) svr->nmsg[i][j] = 0;
for (i = 0; i<3; i++) svr->ftime[i] = time0; for (i = 0; i < 3; i++) svr->ftime[i] = time0;
for (i = 0; i<3; i++) svr->files[i][0] = '\0'; for (i = 0; i < 3; i++) svr->files[i][0] = '\0';
svr->moni = NULL; svr->moni = NULL;
svr->tick = 0; svr->tick = 0;
svr->thread = 0; svr->thread = 0;
svr->cputime = svr->prcout = 0; svr->cputime = svr->prcout = 0;
if (!(svr->nav.eph = (eph_t *)malloc(sizeof(eph_t )*MAXSAT *2)) || if (!(svr->nav.eph = (eph_t *)malloc(sizeof(eph_t )*MAXSAT *2)) ||
!(svr->nav.geph = (geph_t *)malloc(sizeof(geph_t)*NSATGLO*2)) || !(svr->nav.geph = (geph_t *)malloc(sizeof(geph_t)*NSATGLO*2)) ||
!(svr->nav.seph = (seph_t *)malloc(sizeof(seph_t)*NSATSBS*2))) !(svr->nav.seph = (seph_t *)malloc(sizeof(seph_t)*NSATSBS*2)))
{ {
tracet(1, "rtksvrinit: malloc error\n"); tracet(1, "rtksvrinit: malloc error\n");
return 0; return 0;
} }
for (i = 0; i<MAXSAT *2; i++) svr->nav.eph [i] = eph0; for (i = 0; i < MAXSAT *2; i++) svr->nav.eph [i] = eph0;
for (i = 0; i<NSATGLO*2; i++) svr->nav.geph[i] = geph0; for (i = 0; i < NSATGLO*2; i++) svr->nav.geph[i] = geph0;
for (i = 0; i<NSATSBS*2; i++) svr->nav.seph[i] = seph0; for (i = 0; i < NSATSBS*2; i++) svr->nav.seph[i] = seph0;
svr->nav.n = MAXSAT *2; svr->nav.n = MAXSAT *2;
svr->nav.ng = NSATGLO*2; svr->nav.ng = NSATGLO*2;
svr->nav.ns = NSATSBS*2; svr->nav.ns = NSATSBS*2;
for (i = 0; i<3; i++) for (j = 0; j<MAXOBSBUF; j++) for (i = 0; i < 3; i++) for (j = 0; j < MAXOBSBUF; j++)
{ {
if (!(svr->obs[i][j].data = (obsd_t *)malloc(sizeof(obsd_t)*MAXOBS))) if (!(svr->obs[i][j].data = (obsd_t *)malloc(sizeof(obsd_t)*MAXOBS)))
{ {
@ -621,12 +625,12 @@ int rtksvrinit(rtksvr_t *svr)
return 0; return 0;
} }
} }
for (i = 0; i<3; i++) for (i = 0; i < 3; i++)
{ {
memset(svr->raw +i, 0, sizeof(raw_t )); memset(svr->raw +i, 0, sizeof(raw_t ));
memset(svr->rtcm+i, 0, sizeof(rtcm_t)); memset(svr->rtcm+i, 0, sizeof(rtcm_t));
} }
for (i = 0; i<MAXSTRRTK; i++) strinit(svr->stream+i); for (i = 0; i < MAXSTRRTK; i++) strinit(svr->stream+i);
initlock(&svr->lock); initlock(&svr->lock);
@ -646,7 +650,7 @@ void rtksvrfree(rtksvr_t *svr)
free(svr->nav.eph ); free(svr->nav.eph );
free(svr->nav.geph); free(svr->nav.geph);
free(svr->nav.seph); free(svr->nav.seph);
for (i = 0; i<3; i++) for (j = 0; j<MAXOBSBUF; j++) for (i = 0; i < 3; i++) for (j = 0; j < MAXOBSBUF; j++)
{ {
free(svr->obs[i][j].data); free(svr->obs[i][j].data);
} }
@ -718,12 +722,12 @@ int rtksvrstart(rtksvr_t *svr, int cycle, int buffsize, int *strs,
if (svr->state) return 0; if (svr->state) return 0;
strinitcom(); strinitcom();
svr->cycle = cycle>1?cycle:1; svr->cycle = cycle > 1 ? cycle : 1;
svr->nmeacycle = nmeacycle>1000?nmeacycle:1000; svr->nmeacycle = nmeacycle > 1000 ? nmeacycle : 1000;
svr->nmeareq = nmeareq; svr->nmeareq = nmeareq;
for (i = 0; i<3; i++) svr->nmeapos[i] = nmeapos[i]; for (i = 0; i < 3; i++) svr->nmeapos[i] = nmeapos[i];
svr->buffsize = buffsize>4096?buffsize:4096; svr->buffsize = buffsize > 4096 ? buffsize : 4096;
for (i = 0; i<3; i++) svr->format[i] = formats[i]; for (i = 0; i < 3; i++) svr->format[i] = formats[i];
svr->navsel = navsel; svr->navsel = navsel;
svr->nsbs = 0; svr->nsbs = 0;
svr->nsol = 0; svr->nsol = 0;
@ -731,7 +735,7 @@ int rtksvrstart(rtksvr_t *svr, int cycle, int buffsize, int *strs,
rtkfree(&svr->rtk); rtkfree(&svr->rtk);
rtkinit(&svr->rtk, prcopt); rtkinit(&svr->rtk, prcopt);
for (i = 0; i<3; i++) for (i = 0; i < 3; i++)
{ /* input/log streams */ { /* input/log streams */
svr->nb[i] = svr->npb[i] = 0; svr->nb[i] = svr->npb[i] = 0;
if (!(svr->buff[i] = (unsigned char *)malloc(buffsize)) || if (!(svr->buff[i] = (unsigned char *)malloc(buffsize)) ||
@ -740,8 +744,8 @@ int rtksvrstart(rtksvr_t *svr, int cycle, int buffsize, int *strs,
tracet(1, "rtksvrstart: malloc error\n"); tracet(1, "rtksvrstart: malloc error\n");
return 0; return 0;
} }
for (j = 0; j<10; j++) svr->nmsg[i][j] = 0; for (j = 0; j < 10; j++) svr->nmsg[i][j] = 0;
for (j = 0; j<MAXOBSBUF; j++) svr->obs[i][j].n = 0; for (j = 0; j < MAXOBSBUF; j++) svr->obs[i][j].n = 0;
/* initialize receiver raw and rtcm control */ /* initialize receiver raw and rtcm control */
//init_raw (svr->raw +i); //init_raw (svr->raw +i);
@ -754,7 +758,7 @@ int rtksvrstart(rtksvr_t *svr, int cycle, int buffsize, int *strs,
/* connect dgps corrections */ /* connect dgps corrections */
svr->rtcm[i].dgps = svr->nav.dgps; svr->rtcm[i].dgps = svr->nav.dgps;
} }
for (i = 0; i<2; i++) for (i = 0; i < 2; i++)
{ /* output peek buffer */ { /* output peek buffer */
if (!(svr->sbuf[i] = (unsigned char *)malloc(buffsize))) if (!(svr->sbuf[i] = (unsigned char *)malloc(buffsize)))
{ {
@ -763,28 +767,28 @@ int rtksvrstart(rtksvr_t *svr, int cycle, int buffsize, int *strs,
} }
} }
/* set solution options */ /* set solution options */
for (i = 0; i<2; i++) for (i = 0; i < 2; i++)
{ {
svr->solopt[i] = solopt[i]; svr->solopt[i] = solopt[i];
} }
/* set base station position */ /* set base station position */
for (i = 0; i<6; i++) for (i = 0; i < 6; i++)
{ {
svr->rtk.rb[i] = i<3?prcopt->rb[i]:0.0; svr->rtk.rb[i] = i < 3 ? prcopt->rb[i] : 0.0;
} }
/* update navigation data */ /* update navigation data */
for (i = 0; i<MAXSAT *2; i++) svr->nav.eph [i].ttr = time0; for (i = 0; i < MAXSAT *2; i++) svr->nav.eph [i].ttr = time0;
for (i = 0; i<NSATGLO*2; i++) svr->nav.geph[i].tof = time0; for (i = 0; i < NSATGLO*2; i++) svr->nav.geph[i].tof = time0;
for (i = 0; i<NSATSBS*2; i++) svr->nav.seph[i].tof = time0; for (i = 0; i < NSATSBS*2; i++) svr->nav.seph[i].tof = time0;
updatenav(&svr->nav); updatenav(&svr->nav);
/* set monitor stream */ /* set monitor stream */
svr->moni = moni; svr->moni = moni;
/* open input streams */ /* open input streams */
for (i = 0; i<8; i++) for (i = 0; i < 8; i++)
{ {
rw = i<3?STR_MODE_R:STR_MODE_W; rw = i < 3 ? STR_MODE_R : STR_MODE_W;
if (strs[i] != STR_FILE) rw |= STR_MODE_W; if (strs[i] != STR_FILE) rw |= STR_MODE_W;
if (!stropen(svr->stream+i, strs[i], rw, paths[i])) if (!stropen(svr->stream+i, strs[i], rw, paths[i]))
{ {
@ -792,11 +796,11 @@ int rtksvrstart(rtksvr_t *svr, int cycle, int buffsize, int *strs,
return 0; return 0;
} }
/* set initial time for rtcm and raw */ /* set initial time for rtcm and raw */
if (i<3) if (i < 3)
{ {
time = utc2gpst(timeget()); time = utc2gpst(timeget());
svr->raw [i].time = strs[i] == STR_FILE?strgettime(svr->stream+i):time; svr->raw [i].time = strs[i] == STR_FILE ? strgettime(svr->stream+i) : time;
svr->rtcm[i].time = strs[i] == STR_FILE?strgettime(svr->stream+i):time; svr->rtcm[i].time = strs[i] == STR_FILE ? strgettime(svr->stream+i) : time;
} }
} }
/* sync input streams */ /* sync input streams */
@ -804,19 +808,19 @@ int rtksvrstart(rtksvr_t *svr, int cycle, int buffsize, int *strs,
strsync(svr->stream, svr->stream+2); strsync(svr->stream, svr->stream+2);
/* write start commands to input streams */ /* write start commands to input streams */
for (i = 0; i<3; i++) for (i = 0; i < 3; i++)
{ {
if (cmds[i]) strsendcmd(svr->stream+i, cmds[i]); if (cmds[i]) strsendcmd(svr->stream+i, cmds[i]);
} }
/* write solution header to solution streams */ /* write solution header to solution streams */
for (i = 3; i<5; i++) for (i = 3; i < 5; i++)
{ {
writesolhead(svr->stream+i, svr->solopt+i-3); writesolhead(svr->stream+i, svr->solopt+i-3);
} }
/* create rtk server thread */ /* create rtk server thread */
if (pthread_create(&svr->thread, NULL, rtksvrthread, svr)) if (pthread_create(&svr->thread, NULL, rtksvrthread, svr))
{ {
for (i = 0; i<MAXSTRRTK; i++) strclose(svr->stream+i); for (i = 0; i < MAXSTRRTK; i++) strclose(svr->stream+i);
return 0; return 0;
} }
return 1; return 1;
@ -840,7 +844,7 @@ void rtksvrstop(rtksvr_t *svr, char **cmds)
/* write stop commands to input streams */ /* write stop commands to input streams */
rtksvrlock(svr); rtksvrlock(svr);
for (i = 0; i<3; i++) for (i = 0; i < 3; i++)
{ {
if (cmds[i]) strsendcmd(svr->stream+i, cmds[i]); if (cmds[i]) strsendcmd(svr->stream+i, cmds[i]);
} }
@ -870,7 +874,7 @@ int rtksvropenstr(rtksvr_t *svr, int index, int str, const char *path,
{ {
tracet(3, "rtksvropenstr: index=%d str=%d path=%s\n", index, str, path); tracet(3, "rtksvropenstr: index=%d str=%d path=%s\n", index, str, path);
if (index<3 || index>7 || !svr->state) return 0; if (index < 3 || index > 7 || !svr->state) return 0;
rtksvrlock(svr); rtksvrlock(svr);
@ -909,7 +913,7 @@ void rtksvrclosestr(rtksvr_t *svr, int index)
{ {
tracet(3, "rtksvrclosestr: index=%d\n", index); tracet(3, "rtksvrclosestr: index=%d\n", index);
if (index<3 || index>7 || !svr->state) return; if (index < 3 || index>7 || !svr->state) return;
rtksvrlock(svr); rtksvrlock(svr);
@ -946,12 +950,12 @@ int rtksvrostat(rtksvr_t *svr, int rcv, gtime_t *time, int *sat,
{ {
*time = svr->obs[rcv][0].data[0].time; *time = svr->obs[rcv][0].data[0].time;
} }
for (i = 0; i<ns; i++) for (i = 0; i < ns; i++)
{ {
sat [i] = svr->obs[rcv][0].data[i].sat; sat [i] = svr->obs[rcv][0].data[i].sat;
az [i] = svr->rtk.ssat[sat[i]-1].azel[0]; az [i] = svr->rtk.ssat[sat[i]-1].azel[0];
el [i] = svr->rtk.ssat[sat[i]-1].azel[1]; el [i] = svr->rtk.ssat[sat[i]-1].azel[1];
for (j = 0; j<NFREQ; j++) for (j = 0; j < NFREQ; j++)
{ {
snr[i][j] = (int)(svr->obs[rcv][0].data[i].SNR[j]*0.25); snr[i][j] = (int)(svr->obs[rcv][0].data[i].SNR[j]*0.25);
} }
@ -984,7 +988,7 @@ void rtksvrsstat(rtksvr_t *svr, int *sstat, char *msg)
tracet(4, "rtksvrsstat:\n"); tracet(4, "rtksvrsstat:\n");
rtksvrlock(svr); rtksvrlock(svr);
for (i = 0; i<MAXSTRRTK; i++) for (i = 0; i < MAXSTRRTK; i++)
{ {
sstat[i] = strstat(svr->stream+i, s); sstat[i] = strstat(svr->stream+i, s);
if (*s) p += sprintf(p, "(%d) %s ", i+1, s); if (*s) p += sprintf(p, "(%d) %s ", i+1, s);

View File

@ -492,7 +492,7 @@ int decode_solenu(char *buff, const solopt_t *opt, sol_t *sol)
/* decode gsi f solution -----------------------------------------------------*/ /* decode gsi f solution -----------------------------------------------------*/
int decode_solgsi(char *buff, const solopt_t *opt, sol_t *sol) int decode_solgsi(char *buff, const solopt_t *opt __attribute((unused)), sol_t *sol)
{ {
double val[MAXFIELD]; double val[MAXFIELD];
int i = 0,j; int i = 0,j;

View File

@ -158,7 +158,7 @@ void closeserial(serial_t *serial)
/* read serial ---------------------------------------------------------------*/ /* read serial ---------------------------------------------------------------*/
int readserial(serial_t *serial, unsigned char *buff, int n, char *msg) int readserial(serial_t *serial, unsigned char *buff, int n, char *msg __attribute__((unused)))
{ {
int nr; int nr;
tracet(4, "readserial: dev=%d n=%d\n", serial->dev, n); tracet(4, "readserial: dev=%d n=%d\n", serial->dev, n);
@ -170,7 +170,7 @@ int readserial(serial_t *serial, unsigned char *buff, int n, char *msg)
/* write serial --------------------------------------------------------------*/ /* write serial --------------------------------------------------------------*/
int writeserial(serial_t *serial, unsigned char *buff, int n, char *msg) int writeserial(serial_t *serial, unsigned char *buff, int n, char *msg __attribute__((unused)))
{ {
int ns; int ns;
tracet(3, "writeserial: dev=%d n=%d\n", serial->dev, n); tracet(3, "writeserial: dev=%d n=%d\n", serial->dev, n);