/trunk/ftphelper.c |
---|
79,7 → 79,7 |
char FTP_data[DATA_TRANSFER_SIZE+10]; // rx & tx buffer to avoid 2 buffers |
#define KEYWORD_COUNT 55 |
#define KEYWORD_COUNT 56 |
// most used gpx tags can be compressed |
const char keyword[KEYWORD_COUNT][16]= |
{"Altimeter>\0 \0", |
136,7 → 136,8 |
"AvaiableMotorPo\0", |
"FC_I2C_ErrorCou\0", |
"FC_SPI_ErrorCou\0", |
"TargetDistance>\0" |
"TargetDistance>\0", |
"_ErrorCounter>\0 " |
}; |
//ACHTUNG: ggf. DATA_TRANSFER_SIZE vergrössern |
/trunk/gpx.c |
---|
62,6 → 62,7 |
#include "spi_slave.h" |
#include "main.h" |
#include "uart1.h" |
#include "uart2.h" |
#include "compass.h" |
#include "analog.h" |
#include "main.h" |
173,6 → 174,7 |
sprintf(string, "<GNSS_System>%d</GNSS_System>\r\n",gps_receive_config); |
CheckSumAndWrite(&Check16File,string, doc->file); |
} |
if(NMEA_cnt_gga) { sprintf(string, "<External_GNSS_NMEA>YES</External_GNSS_NMEA>\r\n");CheckSumAndWrite(&Check16File,string, doc->file);} |
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
sprintf(string, "<License>\r\n"); CheckSumAndWrite(&Check16File,string, doc->file); |
if(tmp_license->User[0] != 0) |
223,7 → 225,6 |
sprintf(string, "<FcTemperat.>%i.%1i</FcTemperat.>\r\n",FC_Temperatur/10,abs(FC_Temperatur)%10);CheckSumAndWrite(&Check16File,string, doc->file); |
if(FromGimbalCtrl.GimbalStatus) {sprintf(string, "<GimbalCtrV>%i.%02i</GimbalCtrV>\r\n",1 + FromGimbalCtrl.Version / 100, FromGimbalCtrl.Version % 100);CheckSumAndWrite(&Check16File,string, doc->file);} |
if(EE_Parameter.ExternalControl) {sprintf(string, "<ExternalControl>%i,%02x,%02x</ExternalControl>\r\n",EE_Parameter.ExternalControl,FromFC_ExternalCtrlCfg,FromFC_ExternalCtrlSwitch);CheckSumAndWrite(&Check16File,string, doc->file);} |
sprintf(string, "<Channels>ALT:%i,GPS:%i,CF:%i,SL:%i,FS:%i,MSS:%i,SWP:%i,NWP:%i,CCM:%i,CCZ:%i</Channels>\r\n",EE_Parameter.HoeheChannel,EE_Parameter.NaviGpsModeChannel,EE_Parameter.CareFreeChannel, EE_Parameter.StartLandChannel, EE_Parameter.FailsafeChannel, EE_Parameter.MotorSafetySwitch,EE_Parameter.SingleWpControlChannel,EE_Parameter.MenuKeyChannel,EE_Parameter.CamCtrlModeChannel,EE_Parameter.CamCtrlZoomChannel);CheckSumAndWrite(&Check16File,string, doc->file); |
// Alt = Altitude |
// GPS = GPS |
505,6 → 506,12 |
{ |
case 0: |
Logged_GPX_Counter++; |
if(NMEA_In_Fix_Txt[0] >= '1') |
{ |
sprintf(string, "<trkpt lat=\"%s\" lon=\"%s\">\r\n",NMEA_In_Lat_Txt,NMEA_In_Lon_Txt); |
} |
else |
if(GPSData.Position.Status != INVALID) |
{ |
if(GPSData.Position.Latitude < 0) u8_1 = '-'; |
518,7 → 525,9 |
i32_1 = abs(GPSData.Position.Longitude)/10000000L; |
i32_2 = abs(GPSData.Position.Longitude)%10000000L; |
sprintf(string, "lon=\"%c%ld.%07ld\">\r\n",u8_1, i32_1, i32_2); |
} else sprintf(string, "<trkpt lat=\"\" lon=\"\">"); |
} |
else sprintf(string, "<trkpt lat=\"\" lon=\"\">"); |
CheckSumAndWrite(&Check16Block,string, doc->file); |
altitude = GPSData.Position.Altitude; |
break; |
771,6 → 780,13 |
// sprintf(string, "<FCTemperat>%d</FCTemperat>\r\n",FC_Temperatur); |
// CheckSumAndWrite(&Check16Block,string, doc->file); |
if(NMEA_cnt_gga) |
{ |
sprintf(string, "<Ext_GNSS_Fix>%s</Ext_GNSS_Fix>\r\n",NMEA_In_Fix_Txt); |
CheckSumAndWrite(&Check16File,string, doc->file); |
sprintf(string, "<Ext_GNSS_Alti>%s</Ext_GNSS_Alti>\r\n",NMEA_In_Alt_Txt); |
CheckSumAndWrite(&Check16File,string, doc->file); |
} |
// eof extensions |
sprintf(string, "</extensions>\r\n"); |
CheckSumAndWrite(&Check16Block,string, doc->file); |
/trunk/main.c |
---|
671,6 → 671,14 |
{ |
TimerSecond += 1000; |
if(MenuBlinkBit) MenuBlinkBit = 0; else MenuBlinkBit = 1; |
if(NMEA_cnt) if(--NMEA_cnt == 0) |
{ |
TrigLogging.NMEA_Lat[0] = 0; |
TrigLogging.NMEA_Lon[0] = 0; |
TrigLogging.NMEA_Alt[0] = 0; |
NMEA_In_Fix_Txt[0] = 0; |
NMEA_cnt_gga = 0; |
} |
if(FC.StatusFlags & FC_STATUS_FLY) |
{ |
NaviData.FlyingTime++; // we want to count the battery-time |
/trunk/main.h |
---|
1,9 → 1,13 |
#ifndef _MAIN_H |
#define _MAIN_H |
//#define HOME_TRANSMITTER |
//#define FOLLOW_ME |
#ifdef HOME_TRANSMITTER |
#define FOLLOW_ME |
#endif |
#ifdef FOLLOW_ME |
extern u8 TransmitAlsoToFC; |
#endif |
14,7 → 18,7 |
#define VERSION_MAJOR 2 |
#define VERSION_MINOR 21 |
#define VERSION_PATCH 0 |
#define VERSION_PATCH 1 |
// 0 = A |
// 1 = B |
// 2 = C |
/trunk/menu.c |
---|
66,6 → 66,7 |
#include "menu.h" |
#include "uart0.h" |
#include "uart1.h" |
#include "uart2.h" |
#include "ncmag.h" |
#include "logging.h" |
#include "settings.h" |
81,7 → 82,7 |
u8 MenuItem = 0; |
u8 MaxMenuItem = 34; |
u8 MaxMenuItem = 35; |
void Menu_Putchar(char c) |
{ |
218,7 → 219,7 |
else sign = '+'; |
i1 = abs(GPSData.Position.Latitude)/10000000L; |
i2 = abs(GPSData.Position.Latitude)%10000000L; |
LCD_printfxy(0,2,"Lat:%c%03ld.%07ld deg",sign, i1, i2); |
LCD_printfxy(0,2,"Lat: %c%02ld.%07ld deg",sign, i1, i2); |
if(GPSData.Position.Altitude < 0) sign = '-'; |
else sign = '+'; |
i1 = abs(GPSData.Position.Altitude)/1000L; |
327,7 → 328,7 |
else sign = '+'; |
i1 = abs(NaviData.HomePosition.Latitude)/10000000L; |
i2 = abs(NaviData.HomePosition.Latitude)%10000000L; |
LCD_printfxy(0,2,"Lat:%c%03ld.%07ld deg",sign, i1, i2); |
LCD_printfxy(0,2,"Lat: %c%02ld.%07ld deg",sign, i1, i2); |
if(NaviData.HomePosition.Altitude < 0) sign = '-'; |
else sign = '+'; |
i1 = abs(NaviData.HomePosition.Altitude)/1000L; |
845,9 → 846,20 |
if(Keys & KEY3) BaroCalState = 0; // cancel |
} |
break; |
case 35: |
LCD_printfxy(0,0,"NMEA Input"); |
if(!NMEA_cnt) LCD_printfxy(0,3,"No Data ") |
else |
{ |
LCD_printfxy(0,1,"Lon:%s ",NMEA_In_Lon_Txt); |
LCD_printfxy(0,2,"Lat:%s ",NMEA_In_Lat_Txt); |
if(NMEA_In_Fix_Txt[0] < '1') LCD_printfxy(1,3,"No Fix! %s",NMEA_In_Fix_Txt) |
else LCD_printfxy(0,3,"Fix:%s %s ",NMEA_In_Fix_Txt,NMEA_In_Alt_Txt); |
LCD_printfxy(11,0,"%3u",NMEA_cnt_gga); |
if(!NMEA_cnt_gga) LCD_printfxy(0,3,"No $GPGGA Data! "); |
} |
break; |
default: |
//MaxMenuItem = MenuItem - 1; |
MenuItem = 0; |
/trunk/spi_slave.c |
---|
61,6 → 61,7 |
#include "led.h" |
#include "gps.h" |
#include "uart1.h" |
#include "uart2.h" |
#include "spi_slave.h" |
#include "compass.h" |
#include "timer1.h" |
530,7 → 531,7 |
ToFlightCtrl.Param.Byte[0] = EarthMagneticFieldFiltered/5; |
ToFlightCtrl.Param.Byte[1] = EarthMagneticInclination; |
ToFlightCtrl.Param.Byte[2] = EarthMagneticInclinationTheoretic; |
//ToFlightCtrl.Param.Byte[3] |
ToFlightCtrl.Param.Byte[3] = NMEA_In_Fix_Txt[0]; |
//ToFlightCtrl.Param.Byte[4] |
//ToFlightCtrl.Param.Byte[5] |
ToFlightCtrl.Param.Int[3] = NaviData.TargetPositionDeviation.Distance_dm / 10; |
542,7 → 543,6 |
ToFlightCtrl.Param.sInt[7] = LuftdruckTemperaturOffset; // Bytes 14 & 15 |
ToFlightCtrl.Param.Int[8] = FromLaserCtrl.Distance; // Bytes 16 & 17 |
ToFlightCtrl.Param.Byte[18] = FlyzonePointCnt; |
ToFlightCtrl.Param.Byte[19] = 0; |
break; |
case SPI_NCCMD_GPSINFO: |
/trunk/spi_slave.h |
---|
390,6 → 390,4 |
#endif //_SPI_SLAVE_H |
/trunk/triggerlog.c |
---|
60,6 → 60,7 |
#include "timer1.h" |
#include "timer2.h" |
#include "uart1.h" |
#include "uart2.h" |
#include "triggerlog.h" |
#include "gpx.h" |
#include "ssc.h" |
99,6 → 100,22 |
if(SimulationFlags) TrigLogging.Yaw = CompassSetpointCorrected; |
else TrigLogging.Yaw = GyroCompassCorrected; |
TrigLogging.NewData++; |
if(NMEA_cnt) |
{ |
u8 i; |
for(i=0; i<16;i++) |
{ |
TrigLogging.NMEA_Lon[i] = NMEA_In_Lon_Txt[i]; |
TrigLogging.NMEA_Lat[i] = NMEA_In_Lat_Txt[i]; |
if(i<10) TrigLogging.NMEA_Alt[i] = NMEA_In_Alt_Txt[i]; |
} |
} |
else |
{ |
TrigLogging.NMEA_Lon[0] = 0; |
TrigLogging.NMEA_Lat[0] = 0; |
TrigLogging.NMEA_Alt[0] = 0; |
} |
} |
const s8 TRIG_DOCUMENT_FOOTER[] = |
318,6 → 335,7 |
fputs_(string, doc->file); |
if(SimulationFlags) { sprintf(string, " SIMULATED"); fputs_(string, doc->file);}; |
if(BlitzSchuhConnected){ sprintf(string, "\r\n#External hotshoe sensor connected"); fputs_(string, doc->file);}; |
if(NMEA_cnt){ sprintf(string, "\r\n#External GNSS-Data (NMEA) used"); fputs_(string, doc->file);}; |
} |
return(retvalue); |
} |
356,6 → 374,13 |
sprintf(string, ";%04d-%02d-%02dT%02d:%02d:%02d.%dZ",SystemTime.Year, SystemTime.Month, SystemTime.Day, SystemTime.Hour, SystemTime.Min, SystemTime.Sec,SystemTime.mSec/100); |
fputs_(string, doc->file); |
// Position |
if(NMEA_In_Fix_Txt[0] >= '1') |
{ |
sprintf(string,";%s;%s",TrigLogging.NMEA_Lat,TrigLogging.NMEA_Lon); |
fputs_(string, doc->file); |
} |
else |
{ |
if(TrigLogging.Latitude < 0) sign = '-'; |
else sign = '+'; |
i1 = abs(TrigLogging.Latitude)/10000000L; |
362,7 → 387,7 |
i2 = abs(TrigLogging.Latitude)%10000000L; |
sprintf(string,";%c%ld.%07ld",sign, i1, i2); |
fputs_(string, doc->file); |
if(TrigLogging.Longitude < 0) sign = '-'; |
else sign = '+'; |
i1 = abs(TrigLogging.Longitude)/10000000L; |
369,8 → 394,17 |
i2 = abs(TrigLogging.Longitude)%10000000L; |
sprintf(string,";%c%ld.%07ld",sign, i1, i2); |
fputs_(string, doc->file); |
} |
// calculate relative altitude with respect to the altitude of the home position |
// Altitude GPS |
if(TrigLogging.NMEA_Alt[0]) |
{ |
sprintf(string,";%s",TrigLogging.NMEA_Alt); |
fputs_(string, doc->file); |
} |
else |
{ |
rel_altitude = TrigLogging.AltiGPS;// - NaviData.HomePosition.Altitude; |
// if(rel_altitude < 0) rel_altitude = 0; // avoid negative altitudes in log |
i1 = rel_altitude/1000L; |
377,6 → 411,7 |
i2 = rel_altitude%1000L; |
sprintf(string,";%ld.%03ld",i1, labs(i2)); |
fputs_(string, doc->file); |
} |
// Altitude Baro |
sprintf(string,";%ld.%02d",TrigLogging.AltiBaro/100,abs(TrigLogging.AltiBaro%100)); |
fputs_(string, doc->file); |
/trunk/triggerlog.h |
---|
43,6 → 43,9 |
u16 ServoControlNick; |
u16 ServoControlPoi; |
u8 NewData; |
u8 NMEA_Lon[16]; |
u8 NMEA_Lat[16]; |
u8 NMEA_Alt[10]; |
} TrigLog_t; |
extern TrigLog_t TrigLogging; |
/trunk/uart1.c |
---|
157,7 → 157,8 |
UART_TypeDef *DebugUART = UART1; |
#ifdef FOLLOW_ME |
#define FOLLOW_ME_INTERVAL 200 // 5 Hz |
#define FOLLOW_ME_INTERVAL 200 // 5 Hz |
#define HOME_INTERVAL 400 // 2,5 Hz |
u32 UART1_FollowMe_Timer = 0; |
Point_t FollowMe; |
#endif |
1737,7 → 1738,9 |
FollowMe.Event_Flag = 1; |
FollowMe.Index = 1; // 0 = Delete List, 1 place at first entry in the list |
FollowMe.Type = POINT_TYPE_WP; |
#ifdef HOME_TRANSMITTER |
FollowMe.Type = POINT_TYPE_HOME; |
#endif |
FollowMe.WP_EventChannelValue = 100; // set servo value |
FollowMe.AltitudeRate = 0; // do not change height |
FollowMe.Speed = 0; // rate to change the Position (0 = max) |
1761,7 → 1764,12 |
*/ |
MKProtocol_CreateSerialFrame(&UART1_tx_buffer, 's', NC_ADDRESS, 1, (u8 *)&FollowMe, sizeof(FollowMe)); |
} |
#ifdef HOME_TRANSMITTER |
UART1_FollowMe_Timer = SetDelay(HOME_INTERVAL); // set new update time |
#else |
UART1_FollowMe_Timer = SetDelay(FOLLOW_ME_INTERVAL); // set new update time |
#endif |
} |
#endif |
#ifdef DEBUG // only include functions if DEBUG is defined |
/trunk/uart2.c |
---|
64,6 → 64,13 |
u8 UART2_tbuffer[UART2_TX_BUFFER_LEN]; |
Buffer_t UART2_tx_buffer; |
unsigned char NMEA_In_Lat_Txt[16]; |
unsigned char NMEA_In_Lon_Txt[16]; |
unsigned char NMEA_In_Alt_Txt[10]; |
unsigned char NMEA_In_Fix_Txt[10]; |
u16 NMEA_cnt,NMEA_cnt_gga; |
/********************************************************/ |
/* Initialize UART2 */ |
/********************************************************/ |
169,13 → 176,220 |
UART1_PutString("ok"); |
} |
void NEMA_Parser(unsigned char data) |
{ |
static u16 state = 0, fx,la,lo,i,a; |
if(data == '$') state = 0; |
static u32 latitude; |
static unsigned char lat_txt[16], lon_txt[16],fix_txt[10],alt_txt[10]; |
//$GPGGA,HHMMSS.ss,BBBB.BBBB,b,LLLLL.LLLL,l,Q,NN,D.D,H.H,h,G.G,g,A.A,RRRR*PP |
//$GPGGA,191410,4735.5634,N,00739.3538,E,1,04,4.4,351.5,M,48.0,M,,*45 |
//$GPRMC,162614.123,A,5230.5900,N,01322.3900,E,10.0,90.0,131006,1.2,E,A*13 |
//$GPRMC,HHMMSS.sss,A,BBBB.BBBB,b,LLLLL.LLLL,l,GG.G,RR.R,DDMMYY,M.M,m,F*PP |
//http://www.kowoma.de/gps/zusatzerklaerungen/NMEA.htm |
switch(state) |
{ |
case 0: if(data == '$') state++;// $ |
fx = 0; |
la = 1; |
lo = 1; |
fix_txt[0] = 0; |
lat_txt[0] = 0;lon_txt[0] = 0;alt_txt[0] = 0; |
break; |
case 1: if(data == 'G') state++;// $G |
break; |
case 2: if(data == 'P') state++;// $GP |
NMEA_cnt = 3; |
break; |
//+++++++++++++++++++++++++++++++++++++++++++++++++++ |
case 3: if(data == 'R') state++;// $GPR |
if(data == 'G') state = 6;// $GPG |
break; |
case 4: if(data == 'M') state++;// $GPRM |
break; |
case 5: if(data == 'C') state = 100;// $GPRMC |
break; |
//+++++++++++++++++++++++++++++++++++++++++++++++++++ |
case 6: if(data == 'G') state++;// $GPGG |
break; |
case 7: if(data == 'A') state = 200;// $GPGGA |
break; |
//+++++++++++++++++++++++++++++++++++++++++++++++++++ |
// $GPRMC (RMC = recommended minimum sentence C, empfohlener Minimumdatensatz) |
//+++++++++++++++++++++++++++++++++++++++++++++++++++ |
/* |
case 100: if(data == ',') state++; // $GPRMC, |
NMEA_cnt_rmc %= 1000; |
NMEA_cnt_rmc++; |
break; |
case 101: if(data == ',') state = 110; // $GPRMC,162614.123, // time scipped |
break; |
case 110: if(data == ',') state++; |
else fix_txt[0] = data; // $GPRMC,162614.123,A A = Active V = Void |
break; |
case 111: if(data == ',') state++; // / $GPRMC,162614.123,A, |
break; |
case 112: if(data == ',') state++; // $GPRMC,162614.123,A,5317.123456789 Latitude |
else |
{ |
if(la < 16) lat_txt[la++] = data; |
lat_txt[la] = 0; |
} |
break; |
case 113: if(data == ',') state++; //$GPRMC,162614.123,A,5230.5900,N, |
if(data == 'N') lat_txt[0] = '+'; |
if(data == 'S') lat_txt[0] = '-'; |
break; |
case 114: if(data == ',') state++; //$GPRMC,162614.123,A,5230.5900,N,00722.123456789 |
else |
{ |
if(lo < 16) lon_txt[lo++] = data; |
lon_txt[lo] = 0; |
} |
break; |
case 115: if(data == ',') state++; //$GPRMC,162614.123,A,5230.5900,N,01322.3900,E, |
if(data == 'O') lon_txt[0] = '+'; |
if(data == 'E') lon_txt[0] = '+'; |
if(data == 'W') lon_txt[0] = '-'; |
break; |
case 116: if(data == ',') state++; //$GPRMC,162614.123,A,5230.5900,N,01322.3900,E,10.0, |
break; |
case 117: if(data == ',') state++; //$GPRMC,162614.123,A,5230.5900,N,01322.3900,E,10.0,90.0, |
break; |
case 118: if(data == ',') state++; //$GPRMC,162614.123,A,5230.5900,N,01322.3900,E,10.0,90.0,131006, |
break; |
case 119: |
if(data == ',') |
{ |
state++; //$GPRMC,162614.123,A,5230.5900,N,01322.3900,E,10.0,90.0,131006,1.2, |
NMEA_In_Lat_Txt[0] = lat_txt[0]; |
NMEA_In_Lat_Txt[1] = lat_txt[1]; |
NMEA_In_Lat_Txt[2] = lat_txt[2]; |
NMEA_In_Lat_Txt[3] = '.'; |
NMEA_In_Lat_Txt[4] = lat_txt[3]; |
NMEA_In_Lat_Txt[5] = lat_txt[4]; |
for(i=5; i<16; i++) |
{ |
if(lat_txt[i] == '.') i++; |
NMEA_In_Lat_Txt[i] = lat_txt[i]; |
} |
NMEA_In_Lon_Txt[0] = lon_txt[0]; |
NMEA_In_Lon_Txt[1] = lon_txt[1]; |
NMEA_In_Lon_Txt[2] = lon_txt[2]; |
NMEA_In_Lon_Txt[3] = lon_txt[3]; |
NMEA_In_Lon_Txt[4] = '.'; |
NMEA_In_Lon_Txt[5] = lon_txt[4]; |
NMEA_In_Lon_Txt[6] = lon_txt[5]; |
for(i=5; i<16; i++) |
{ |
if(lon_txt[i] == '.') i++; |
NMEA_In_Lon_Txt[i] = lon_txt[i]; |
} |
} |
break; |
case 120: if(data == ',') state++; //$GPRMC,162614.123,A,5230.5900,N,01322.3900,E,10.0,90.0,131006,1.2,E, |
break; |
case 121: state = 0; //$GPRMC,162614.123,A,5230.5900,N,01322.3900,E,10.0,90.0,131006,1.2,E,A*13 |
fix_txt[1] = data; |
fix_txt[2] = 0; |
NMEA_In_Fix_Txt[0] = fix_txt[0]; |
NMEA_In_Fix_Txt[1] = fix_txt[1]; |
break; |
*/ |
//+++++++++++++++++++++++++++++++++++++++++++++++++++ |
// $GPGGA |
//+++++++++++++++++++++++++++++++++++++++++++++++++++ |
case 200: if(data == ',') state++; //$GPGGA, |
NMEA_cnt_gga %= 1000; |
NMEA_cnt_gga++; |
break; |
case 201: if(data == ',') state = 212; //$GPGGA,191410 // time scipped |
break; |
case 212: if(data == ',') state++; //$GPGGA,191410,4735.5634 Latitude |
else |
{ |
if(la < 16) lat_txt[la++] = data; |
lat_txt[la] = 0; |
} |
break; |
case 213: if(data == ',') state++; //$GPGGA,191410,4735.5634,N |
if(data == 'N') lat_txt[0] = '+'; |
if(data == 'S') lat_txt[0] = '-'; |
break; |
case 214: if(data == ',') state++; //$GPGGA,191410,4735.5634,N,00739.3538 |
else |
{ |
if(lo < 16) lon_txt[lo++] = data; |
lon_txt[lo] = 0; |
} |
break; |
case 215: if(data == ',') state++; //$GPGGA,191410,4735.5634,N,00739.3538,E |
if(data == 'O') lon_txt[0] = '+'; |
if(data == 'E') lon_txt[0] = '+'; |
if(data == 'W') lon_txt[0] = '-'; |
i = 0; a = 0; |
break; |
case 216: //$GPGGA,191410,4735.5634,N,00739.3538,E,1 -> 0 = No Fix, 1, = Fix, 2 = DGPS, ... |
case 217: //$GPGGA,191410,4735.5634,N,00739.3538,E,1,04 -> Anzahl Sat |
case 218: //$GPGGA,191410,4735.5634,N,00739.3538,E,1,04,4.4 HDOP |
if(data == ',') |
{ |
if(++state != 219) // letztes Leerzeiten entfernen |
fix_txt[i++] = ' '; // komma durch leerzeichen ersetzten |
} |
else if(i < 9) fix_txt[i++] = data; |
fix_txt[i] = 0; |
break; |
case 219: if(data == ',') state++; //$GPGGA,191410,4735.5634,N,00739.3538,E,1,04,4.4,351.5 |
else if(a < 9) alt_txt[a++] = data; |
fix_txt[i] = 0; |
break; |
case 220: |
if(data == ',') |
{ |
state++; //$GPGGA,191410,4735.5634,N,00739.3538,E,1,04,4.4,351.5,M |
NMEA_In_Lat_Txt[0] = lat_txt[0]; |
NMEA_In_Lat_Txt[1] = lat_txt[1]; |
NMEA_In_Lat_Txt[2] = lat_txt[2]; |
NMEA_In_Lat_Txt[3] = '.'; |
NMEA_In_Lat_Txt[4] = lat_txt[3]; |
NMEA_In_Lat_Txt[5] = lat_txt[4]; |
for(i=5; i<16; i++) |
{ |
if(lat_txt[i] == '.') i++; |
NMEA_In_Lat_Txt[i] = lat_txt[i]; |
} |
NMEA_In_Lon_Txt[0] = lon_txt[0]; |
NMEA_In_Lon_Txt[1] = lon_txt[1]; |
NMEA_In_Lon_Txt[2] = lon_txt[2]; |
NMEA_In_Lon_Txt[3] = lon_txt[3]; |
NMEA_In_Lon_Txt[4] = '.'; |
NMEA_In_Lon_Txt[5] = lon_txt[4]; |
NMEA_In_Lon_Txt[6] = lon_txt[5]; |
for(i=6; i<16; i++) |
{ |
if(lon_txt[i] == '.') i++; |
NMEA_In_Lon_Txt[i] = lon_txt[i]; |
} |
} |
for(i=0; i<10; i++) |
{ |
NMEA_In_Alt_Txt[i] = alt_txt[i]; |
NMEA_In_Fix_Txt[i] = fix_txt[i]; |
} |
break; |
default: state = 0; |
} |
} |
/********************************************************/ |
/* UART2 Interrupt Handler */ |
/********************************************************/ |
void UART2_IRQHandler(void) |
{ |
// if receive irq or receive timeout irq has occured |
if((UART_GetITStatus(UART2, UART_IT_Receive) != RESET) || (UART_GetITStatus(UART2, UART_IT_ReceiveTimeOut) != RESET) ) |
{ |
190,7 → 404,8 |
// wait for space in the tx buffer of the UART1 |
while(UART_GetFlagStatus(UART1, UART_FLAG_TxFIFOFull) == SET) {}; |
// move the byte from the rx buffer of UART2 to the tx buffer of UART1 |
UART_SendData(UART1, UART_ReceiveData(UART2)); |
if(UART_VersionInfo.HWMajor < 30) UART_SendData(UART1, UART_ReceiveData(UART2)); |
else UART_ReceiveData(UART2); |
} |
} |
else |
198,7 → 413,9 |
// ignore serial data from the FC |
while(UART_GetFlagStatus(UART2, UART_FLAG_RxFIFOEmpty) != SET) |
{ |
UART_ReceiveData(UART2); |
unsigned char c; |
c = UART_ReceiveData(UART2); |
if(UART_VersionInfo.HWMajor >= 30) NEMA_Parser(c); |
} |
} |
} // eof receive irq or receive timeout irq |
/trunk/uart2.h |
---|
10,5 → 10,9 |
void UART2_TransmitTxData(void); |
void UART2_ProcessRxData(void); |
extern unsigned char NMEA_In_Lat_Txt[16]; |
extern unsigned char NMEA_In_Lon_Txt[16]; |
extern unsigned char NMEA_In_Fix_Txt[10]; |
extern unsigned char NMEA_In_Alt_Txt[10]; |
extern u16 NMEA_cnt,NMEA_cnt_gga; |
#endif //__UART2_H |