From fd208be4d01ac748783288a50da966d5dc09ddc1 Mon Sep 17 00:00:00 2001 From: Chris Kuethe Date: Sun, 20 Jul 2008 22:55:32 +0000 Subject: change various PI macros to GPS_PI --- garmin.c | 2 +- geoid.c | 2 +- gps.h | 2 +- navcom.c | 12 ++++++------ sirfmon.c | 22 ++++++++++------------ 5 files changed, 19 insertions(+), 21 deletions(-) diff --git a/garmin.c b/garmin.c index c4a0634c..ddea7c4e 100644 --- a/garmin.c +++ b/garmin.c @@ -368,7 +368,7 @@ gps_mask_t PrintSERPacket(struct gps_device_t *session, unsigned char pkt_id track = atan2(pvt->lon_vel, pvt->lat_vel); if (track < 0) { - track += 2 * PI; + track += 2 * GPS_PI; } session->gpsdata.fix.track = radtodeg(track); diff --git a/geoid.c b/geoid.c index 20e9bdb7..e77a40b3 100644 --- a/geoid.c +++ b/geoid.c @@ -117,7 +117,7 @@ void ecef_to_wgs84fix(struct gps_data_t *gpsdata, heading = atan2(fix_minuz(veast), fix_minuz(vnorth)); /*@ +evalorder @*/ if (heading < 0) - heading += 2 * PI; + heading += 2 * GPS_PI; gpsdata->fix.track = heading * RAD_2_DEG; } diff --git a/gps.h b/gps.h index 23f031d5..5d861f7c 100644 --- a/gps.h +++ b/gps.h @@ -610,7 +610,7 @@ extern double wgs84_separation(double, double); /* miles and knots are both the international standard versions of the units */ /* angle conversion multipliers */ -#define PI 3.1415926535897932384626433832795029 +#define GPS_PI 3.1415926535897932384626433832795029 #define RAD_2_DEG 57.2957795130823208767981548141051703 #define DEG_2_RAD 0.0174532925199432957692369076848861271 diff --git a/navcom.c b/navcom.c index 572ef13b..000cdc9e 100644 --- a/navcom.c +++ b/navcom.c @@ -523,7 +523,7 @@ static gps_mask_t handle_0xb1(struct gps_device_t *session) track = atan2(vel_east, vel_north); if (track < 0) - track += 2 * PI; + track += 2 * GPS_PI; session->gpsdata.fix.track = track * RAD_2_DEG; /*@ -evalorder @*/ session->gpsdata.fix.speed = sqrt(pow(vel_east,2) + pow(vel_north,2)) * VEL_RES; @@ -709,21 +709,21 @@ static gps_mask_t handle_0x81(struct gps_device_t *session) prn, toc*SF_TOC, time_str, ((double)af0)*SF_AF0, ((double)af1)*SF_AF1, ((double)af2)*SF_AF2); gpsd_report(LOG_IO, "Navcom: IODE (!AODE): %u Crs: %19.12e, Delta n: %19.12e, M0: %19.12e\n", - iode, (double)crs*SF_CRS, (double)delta_n*SF_DELTA_N*M_PI, (double)m0*SF_M0*M_PI); + iode, (double)crs*SF_CRS, (double)delta_n*SF_DELTA_N*GPS_PI, (double)m0*SF_M0*GPS_PI); gpsd_report(LOG_IO, "Navcom: Cuc: %19.12e, Eccentricity: %19.12e, Cus: %19.12e, A^1/2: %19.12e\n", (double)cuc*SF_CUC, (double)e*SF_E, (double)cus*SF_CUS, (double)sqrt_a*SF_SQRT_A); gpsd_report(LOG_IO, "Navcom: TOE: %u, Cic: %19.12e, Omega %19.12e, Cis: %19.12e\n", - toe*SF_TOE, (double)cic*SF_CIC, (double)Omega0*SF_OMEGA0*M_PI, + toe*SF_TOE, (double)cic*SF_CIC, (double)Omega0*SF_OMEGA0*GPS_PI, (double)cis*SF_CIS); gpsd_report(LOG_IO, "Navcom: i0: %19.12e, Crc: %19.12e, omega: %19.12e, Omega dot: %19.12e\n", - (double)i0*SF_I0*M_PI, (double)crc*SF_CRC, (double)omega*SF_OMEGA*M_PI, - (double)Omegadot*SF_OMEGADOT*M_PI); + (double)i0*SF_I0*GPS_PI, (double)crc*SF_CRC, (double)omega*SF_OMEGA*GPS_PI, + (double)Omegadot*SF_OMEGADOT*GPS_PI); gpsd_report(LOG_IO, "Navcom: IDOT: %19.12e, Codes on L2: 0x%x, GPS Week: %u, L2 P data flag: %x\n", - (double)idot*SF_IDOT*M_PI, cl2, week-(week%1024)+wn, l2pd); + (double)idot*SF_IDOT*GPS_PI, cl2, week-(week%1024)+wn, l2pd); gpsd_report(LOG_IO, "Navcom: SV accuracy: 0x%x, SV health: 0x%x, TGD: %f, IODC (!AODC): %u\n", ura, svh, (double)tgd*SF_TGD, iodc); diff --git a/sirfmon.c b/sirfmon.c index 010db00b..56ffccfb 100644 --- a/sirfmon.c +++ b/sirfmon.c @@ -47,7 +47,7 @@ #else #include #endif /* HAVE_NCURSES_H */ -#include "gps.h" /* for DEFAULT_GPSD_PORT; brings in PI as well */ +#include "gps.h" /* for DEFAULT_GPSD_PORT; brings in GPS_PI as well */ #define PUT_ORIGIN -4 #include "bits.h" @@ -72,8 +72,6 @@ extern int netlib_connectsock(const char *, const char *, const char *); #define END1 0xb0 #define END2 0xb3 -#define RAD2DEG (180.0/PI) - /* how many characters to look at when trying to find baud rate lock */ #define SNIFF_RETRIES 1200 @@ -200,13 +198,13 @@ static void decode_ecef(double x, double y, double z, double lambda,p,theta,phi,n,h,vnorth,veast,vup,speed,heading; lambda = atan2(y,x); - /*@ -evalorder @*/ + /*@ -evalorder @*/ p = sqrt(pow(x,2) + pow(y,2)); theta = atan2(z*a,p*b); phi = atan2(z + e_2*b*pow(sin(theta),3),p - e2*a*pow(cos(theta),3)); n = a / sqrt(1.0 - e2*pow(sin(phi),2)); h = p / cos(phi) - n; - h -= wgs84_separation((double)(RAD2DEG*phi),(double)(RAD2DEG*lambda)); + h -= wgs84_separation((double)(RAD_2_DEG*phi),(double)(RAD_2_DEG*lambda)); vnorth = -vx*sin(phi)*cos(lambda)-vy*sin(phi)*sin(lambda)+vz*cos(phi); veast = -vx*sin(lambda)+vy*cos(lambda); vup = vx*cos(phi)*cos(lambda)+vy*cos(phi)*sin(lambda)+vz*sin(phi); @@ -214,11 +212,11 @@ static void decode_ecef(double x, double y, double z, heading = atan2(veast,vnorth); /*@ +evalorder @*/ if (heading < 0) - heading += 2 * PI; + heading += 2 * GPS_PI; (void)wmove(mid2win, 1,40); - (void)wprintw(mid2win, "%9.5f %9.5f",(double)(RAD2DEG*phi), - (double)(RAD2DEG*lambda)); + (void)wprintw(mid2win, "%9.5f %9.5f",(double)(RAD_2_DEG*phi), + (double)(RAD_2_DEG*lambda)); (void)mvwaddch(mid2win, 1, 49, ACS_DEGREE); (void)mvwaddch(mid2win, 1, 59, ACS_DEGREE); (void)wmove(mid2win, 1,61); @@ -230,7 +228,7 @@ static void decode_ecef(double x, double y, double z, (void)wprintw(mid2win, "%8.1f",vup); (void)wmove(mid2win, 3,54); - (void)wprintw(mid2win, "%5.1f",(double)(RAD2DEG*heading)); + (void)wprintw(mid2win, "%5.1f",(double)(RAD_2_DEG*heading)); (void)mvwaddch(mid2win, 3, 59, ACS_DEGREE); (void)wmove(mid2win, 3,61); (void)wprintw(mid2win, "%8.1f",speed); @@ -486,8 +484,8 @@ static void decode_sirf(unsigned char buf[], int len) case 0x62: attrset(A_BOLD); move(2,40); - printw("%9.5f %9.5f",(double)(RAD2DEG*1e8*getbesl(buf, 1)), - (double)(RAD2DEG*1e8*getbesl(buf, 5))); + printw("%9.5f %9.5f",(double)(RAD_2_DEG*1e8*getbesl(buf, 1)), + (double)(RAD_2_DEG*1e8*getbesl(buf, 5))); move(2,63); printw("%8d",getbesl(buf, 9)/1000); @@ -497,7 +495,7 @@ static void decode_sirf(unsigned char buf[], int len) move(4,54); if (getbeul(buf, 13) > 50) { - double heading = RAD2DEG*1e8*getbesl(buf, 21); + double heading = RAD_2_DEG*1e8*getbesl(buf, 21); if (heading < 0) heading += 360; printw("%5.1f",heading); -- cgit v1.2.1