/Designs/skrysohledac1/SW/gps.c
25,7 → 25,6
#define NMEA_LINESIZE 60
 
#define MAXGC 4
 
struct geocache
{
float lat;
35,10 → 34,10
 
struct geocache const gc[MAXGC] =
{
{49*60+15.5740,14*60+42.3310,"GCCISTI"}, // Testovaci souradnice: cisticka
{49*60+12.4452,14*60+18.9079,"GCKOMET"}, // Testovaci souradnice: kometa
{49*60+12.4452,14*60+18.9079,"GCXXX3"},
{49*60+12.4452,14*60+18.9079,"GCXXX4"}
{49*60+15.5740,14*60+42.3310,"DOMA"}, // Testovaci souradnice: cisticka
{48*60+57.966,14*60+28.655,"GC16JMH"},
{48*60+57.837,14*60+28.599,"GC16F8Y"},
{49*60+9.542,14*60+56.417,"GC-----"}
};
 
float lat,lon; // Latitude, Longitude, Azimuth
107,7 → 106,7
lcd_init();
 
gcnum++; // Next GC
if (gcnum>(MAXGC-1)) gcnum=0;
if (gcnum>(MAXGC-1)) gcnum=0;
 
delay_ms(200);
lcd_gotoxy(1,2);
121,18 → 120,18
lat=(gc[gcnum].lat-lat)*1854;
 
lcd_gotoxy(1,4);
printf(lcd_putc,"%.0g* ",sqrt((lon*lon) + (lat*lat))); // Distance
printf(lcd_putc,"%.0gm ",sqrt((lon*lon) + (lat*lat))); // Distance
lcd_gotoxy(1,1);
if (lon==0) lon=0.001; // Divided by zero cure
lon=3-(6/PI*atan2(lat,lon)); // Bearing
if (lon<0) lon+=12; // overflow cure
if (lon>12) lon-=12;
printf(lcd_putc,"BE%2.0g*",lon);
printf(lcd_putc,"BE%2.0gh*",lon);
lat=12.0/360*az; // Azimuth of the movement
lon=lon-lat; // Heading
if (lon<0) lon+=12; // overflow cure
if (lon>12) lon-=12;
printf(lcd_putc,"HE%2.0g*AZ%2.0g* ",lon,lat);
printf(lcd_putc,"HE%2.0gh*AZ%2.0gh*",lon,lat);
}
}