janekx wrote:Cn06 have 25x25mm antena and it is very important
I'm currently using CN-06 GPS Receiver V1 (that does not have 25x25mm antenna) on a Multiwii CRIUS AIO Pro and works fine! V2 should work better...
Luciano
janekx wrote:Cn06 have 25x25mm antena and it is very important
janekx wrote:V2 have eeprom and big antenna
karsten j. wrote:Hi
Could anyboby post his PID Settings from POS, POSR and NAVR ?
I don´t get reliable settings that the copter stills more or less quiet in the air....
What version from Eosbandi do you use ? (Currently I have installed the R33)
greetz
Karsten
howardhb wrote:I've got a DiyDrones MTK2239
When I use MiniGPS_1.4.exe (with FTDI cable direct to the GPS) to change baud rate from 38400 to 115200 and update speed to 10Hz, it works fine, until power is removed.
All settings then revert to default 38400 baud and 1Hz update.
The work-around is to re-configure the GPS at every MultiWii startup.
In config, make a new #define for your defualt GPS baud rate. #define GPS_DEFAULT_BAUD 38400) (DiyDrones GPS is 38400)
and then also define the new GPS baudrate : #define GPS_BAUD 115200
At the end of gps.pde, make a serial function for the GPS,Code: Select all
void GPS_Send_Char(const char *c) {
while (*c) SerialWrite(GPS_SERIAL, *c++);
}
Then, in multiwii.pde, a the end of setup(), add the following code, to re-configure the GPS.......Code: Select all
#if defined(GPS) // This code sets the MediaTek GPS default 38400 baud to 115200 and set to send NEMA frames
SerialOpen(GPS_SERIAL,GPS_DEFAULT_BAUD);
delay(10);
GPS_Send_Char("$PMTK251,115200*1F\r\n"); //set baudrate 115200
delay(10);
SerialOpen(GPS_SERIAL,GPS_BAUD); // open the serial port at the new speed
delay(10);
GPS_Send_Char("$PMTK314,1,1,1,1,1,5,1,1,1,1,1,1,0,1,1,1,1*2C\r\n"); //set to NMEA output
delay(10);
GPS_Send_Char("$PMTK220,100*2F\r\n"); //Will set the GPS to output serial at 10hz
delay(10);
#endif
Sometimes my GPS takes over 3 minutes to get a fix, other times, 35 seconds???
#define I2C_GPS_WP0 63 //Waypoint 0 used for RTH location (R/W)
#define I2C_GPS_WP1 74
#define I2C_GPS_WP2 85
#define I2C_GPS_WP3 96
#define I2C_GPS_WP4 107
#define I2C_GPS_WP5 118
#define I2C_GPS_WP6 129
#define I2C_GPS_WP7 140
#define I2C_GPS_WP8 151
#define I2C_GPS_WP9 162
#define I2C_GPS_WP10 173
#define I2C_GPS_WP11 184
#define I2C_GPS_WP12 195
#define I2C_GPS_WP13 206
#define I2C_GPS_WP14 217
#define I2C_GPS_WP15 228
Code: Select all
#define GPS
#define GPS_SERIAL 2 // should be 2 for flyduino v2. It's the serial port number on arduino MEGA
#define GPS_BAUD 115200
//#define GPS_BAUD 9600
#define GPS_DEFAULT_BAUD 38400 // default speed of the gps after power-
scrat wrote:One question: I have u-Blox CN-06 GPS Receiver V2.0 from rctimer. Do I still need to add 10kohm resistor in serial to Rx line? I'm supplying gps module with 5v power from AIO Pro.
p25o1 wrote:hi everyone , just want to confirm if gps hold is working in r1240, since i'm not able to make it work in angle or horizon mode.
Vaattari wrote:Hello,
Can someone please explain why GPS filtering is not needed in binary mode? I logged today the GPS data with WinGUI and there is few big errors coming in from the I2C GPS. The position jumps suddendly like 30+ meters and comes back with the next measurement. These are not filtered by the FC if filtering is disabled or is there a constrain somewhere to handle such jumps? If there is one, can it be tuned to give less room for big changes?
I'm pretty happy with the current GPS in position hold but it is not yet rock solid![]()
http://www.youtube.com/watch?v=TOPzr8Kbhyk
Thanks in advance,
Janne
copterrichie wrote:Glad to see ya about EOSBandi.
Code: Select all
#define DIGIT_TO_VAL(_x) (_x - '0')
int32_t GPS_coord_to_degrees(char* s)
{
char *p, *q;
uint32_t deg = 0, minute = 0;
uint32_t frac_min = 0; // unsigned int frac_min = 0;
uint8_t i;
// scan for decimal point or end of field
for (p = s; isdigit(*p); p++)
;
q = s;
// convert degrees
while ((p - q) > 2) {
if (deg)
deg *= 10;
deg += DIGIT_TO_VAL(*q++);
}
// convert minutes
while (p > q) {
if (minute)
minute *= 10;
minute += DIGIT_TO_VAL(*q++);
}
// convert fractional minutes
// expect up to four digits, result is in
// ten-thousandths of a minute
if (*p == '.') {
q = p + 1;
for (i = 0; i < 4; i++) {
frac_min *= 10;
if (isdigit(*q))
frac_min += *q++ - '0';
}
}
deg = deg * 10000000;
minute = minute * 1000000;
frac_min = frac_min*100;
minute = (minute + frac_min)/6;
deg = deg + minute;
return deg; // return deg * 10000000UL + (minute * 1000000UL + frac_min*100UL) / 6;
}
Crashpilot1000 wrote:@EOSBandi:
Thank you very much for doing such a terrific job in porting the GPS code !!! That is def. way beyond my coding capabilities!! I had quiet a problem with the NMEA parsing of my MTK module (at 10 and 5 Hz). I solved it the "dumb" way and set everything to uint32 except for the output of "GPS_coord_to_degrees" because GPS_read expects a sign. Now my copter does really well on nmea!
Please have a look at this codechange, perhaps it is of some useCode: Select all
#define DIGIT_TO_VAL(_x) (_x - '0')
int32_t GPS_coord_to_degrees(char* s)
{
char *p, *q;
uint32_t deg = 0, minute = 0;
uint32_t frac_min = 0; // unsigned int frac_min = 0;
uint8_t i;
// scan for decimal point or end of field
for (p = s; isdigit(*p); p++)
;
q = s;
// convert degrees
while ((p - q) > 2) {
if (deg)
deg *= 10;
deg += DIGIT_TO_VAL(*q++);
}
// convert minutes
while (p > q) {
if (minute)
minute *= 10;
minute += DIGIT_TO_VAL(*q++);
}
// convert fractional minutes
// expect up to four digits, result is in
// ten-thousandths of a minute
if (*p == '.') {
q = p + 1;
for (i = 0; i < 4; i++) {
frac_min *= 10;
if (isdigit(*q))
frac_min += *q++ - '0';
}
}
deg = deg * 10000000;
minute = minute * 1000000;
frac_min = frac_min*100;
minute = (minute + frac_min)/6;
deg = deg + minute;
return deg; // return deg * 10000000UL + (minute * 1000000UL + frac_min*100UL) / 6;
}
So long
Kraut Rob
Crashpilot1000 wrote:@EOSBandi:
I used Arduino 1.0.1. I had sudden twitches out of nowhere so i found the uint_32 error here: http://code.google.com/p/arducopter/iss ... 0&sort=-id
From my understaning it isn't fixed in our current code. Just changing unsigned int frac_min = 0; to uint32_t frac_min = 0; helped a lot. But i did my own moving average "for idiots" using 64Bit and some new problems occured i couldn't explain from my simple code. The cure for this was the solution above. I am no programmer but i think there is a bug in current NMEA readout.
So long
Kraut Rob
Code: Select all
// convert fractional minutes
// expect up to four digits, result is in
// ten-thousandths of a minute
if (*p == '.') {
q = p + 1;
for (int16_t i = 0; i < 5; i++) {
frac_min = (int32_t)(frac_min * 10);
if (isdigit(*q))
frac_min += *q++ - '0';
}
}
ret = (int32_t)deg * (int32_t)1000000UL + (int32_t)((min * 100000UL + frac_min) / 6UL);
return ret;
Code: Select all
// convert fractional minutes
// expect up to four digits, result is in
// ten-thousandths of a minute
if (*p == '.') {
q = p + 1;
for (i = 0; i < 4; i++) {
frac_min *= 10;
if (isdigit(*q))
frac_min += *q++ - '0';
}
}
return deg * 10000000UL + (min * 1000000UL + frac_min*100UL) / 6;
EOSBandi wrote:Vaattari wrote:Hello,
Can someone please explain why GPS filtering is not needed in binary mode? I logged today the GPS data with WinGUI and there is few big errors coming in from the I2C GPS. The position jumps suddendly like 30+ meters and comes back with the next measurement. These are not filtered by the FC if filtering is disabled or is there a constrain somewhere to handle such jumps? If there is one, can it be tuned to give less room for big changes?
I'm pretty happy with the current GPS in position hold but it is not yet rock solid![]()
http://www.youtube.com/watch?v=TOPzr8Kbhyk
Thanks in advance,
Janne
30 meter jumps are unnacceptable, you either does not have enough sats in view or some other malfunctions are happening. You can mask these errors with filtering up to a certain extent, but it will not solve it.
Filtering is supposed to eliminate the relatively low position resolution of the NMEA protocol. With binary (either ublox or mtk) this kind of filtering is not required.
BTW, last time i checked the MTK binary protocol was acceptable only at 5Hz, and the same is true for ublox too.
EOS
NikTheGreek wrote:@Vaattari
Which version of MW GUI you are using ?
Where i can find ?
Thanks EOSBandi for your reply. 5Hz change done![]()
Even after change the update rate from 10Hz to 5Hz the static coordinate measurements were still going all over the place. Just to see the difference I then enabled the GPS filter in Config.h. It seems to do a lot.
We have -20C outside at the moment so I did not test fly.![]()
These measurements were taken after 10 minutes of power on and duration is 15 minutes each. Is there any other issue than a delay in correction if wind push the copter away?
Thanks,
janne
Code: Select all
....
#if defined(MTK)
/* Using the AXN 1.51 firmware which defaults at 1Hz/38400 but supports binary protocol
* First connect to it with 38400, then set the speed to 115200
* and set the update rate to 10Hz
* and finally switch to Binary mode
*/
Serial.begin(38400);
delay(1500); //let it init
Serial.write("$PMTK251,115200*1F\r\n");
delay(300);
Serial.end();
Serial.begin(115200);
Serial.write("$PGCMD,16,0,0,0,0,0*6A\r\n");
delay(1000);
Serial.write("$PGCMD,16,0,0,0,0,0*6A\r\n");
delay(300);
Serial.write("$PMTK220,100*2F\r\n");
#else
//open serial port at 115200
Serial.begin(GPS_SERIAL_SPEED);
#endif
....
Code: Select all
....
#if defined(MTK)
/* Using the AXN 1.51 firmware which defaults at 1Hz/38400 but supports binary protocol
* First connect to it with 38400, then set the speed to 57600
* and set the update rate to 10Hz
* and finally switch to Binary mode
*/
Serial.begin(38400); // Handshake
delay(1500); //let it init
Serial.write("$PMTK251,57600*2C\r\n"); // Go down to 57K for data integrity
delay(1000);
Serial.end();
delay(500);
Serial.begin(57600);
Serial.write("$PGCMD,16,0,0,0,0,0*6A\r\n");
delay(1000);
Serial.write("$PGCMD,16,0,0,0,0,0*6A\r\n");
delay(300);
Serial.write("$PMTK220,100*2F\r\n");
#else
//open serial port at 115200
Serial.begin(GPS_SERIAL_SPEED);
#endif
....
Code: Select all
{ // we does not have 3d fix or numsats less than 5 , stop navigation
nav_lat = 0;
nav_lon = 0;
GPSMode = GPSMODE_NONAV;
nav_mode = NAV_MODE_NONE;
wp_distance = 0;
i2c_dataset.distance_to_home = 0;
i2c_dataset.home_to_copter_bearing = 0;
GPS_update_i2c_dataset();
}
Code: Select all
{ // we does not have 3d fix or numsats less than 5 , stop navigation
last_longitude = 0; //Crashpilot Reset Velocity LON
last_latitude = 0; //Crashpilot Reset Velocity LAT
nav_lat = 0;
nav_lon = 0;
GPSMode = GPSMODE_NONAV;
nav_mode = NAV_MODE_NONE;
wp_distance = 0;
i2c_dataset.distance_to_home = 0;
i2c_dataset.home_to_copter_bearing = 0;
GPS_update_i2c_dataset();
}
Code: Select all
....
#if defined(MTK)
/* Using the AXN 1.51 firmware which defaults at 1Hz/38400 but supports binary protocol
* First connect to it with 38400, then set the speed to 115200
* and set the update rate to 10Hz
* and finally switch to Binary mode
*/
Serial.begin(38400);
Code: Select all
....
#if defined(MTK)
/* Using the AXN 1.51 firmware which defaults at 1Hz/38400 but supports binary protocol
* First connect to it with 38400, then set the speed to 115200
* and set the update rate to 10Hz
* and finally switch to Binary mode
*/
Serial.begin(115200);
...
Code: Select all
bool GPS_MTK_newFrame(uint8_t data)
{
static uint8_t pstep; // Parse Step
static uint8_t lastbyte; // Last Byte for Sync detection
static uint8_t LSLshifter; // Bitshiftvalue
static int32_t lat; // MTK Dataset
static int32_t lon; // MTK Dataset
static int32_t alt; // MTK Dataset
static int32_t grspeed; // MTK Dataset
static int32_t grcourse; // MTK Dataset
static uint8_t satn; // MTK Dataset
int32_t tmp32;
bool parsed;
parsed = false;
if (data == 0xdd && lastbyte == 0xd0) pstep = 100; // Detect Sync "0xD0,0xDD"
lastbyte = data;
switch(pstep) {
case 0: // Special Case: Do Nothing
break;
case 100: // Special Case: Jump into decoding on next run
pstep = 1;
break;
case 1: // Ignore Payload Byte (This is the first Byte after sync preamble)
pstep++;
break;
case 2: // Read Dataset Latitude
lat = data;
LSLshifter = 0;
pstep++;
break;
case 3:
LSLshifter = LSLshifter+8;
tmp32 = data;
tmp32 = tmp32<<LSLshifter;
lat = lat | tmp32;
if (LSLshifter == 24){lat = lat * 10; pstep++;}
break;
case 4: // Read Dataset Longitude
lon = data;
LSLshifter = 0;
pstep++;
break;
case 5:
LSLshifter = LSLshifter+8;
tmp32 = data;
tmp32 = tmp32<<LSLshifter;
lon = lon | tmp32;
if (LSLshifter == 24){lon = lon * 10; pstep++;}
break;
case 6: // Read Dataset MSL Altitude
alt = data;
LSLshifter = 0;
pstep++;
break;
case 7:
LSLshifter = LSLshifter+8;
tmp32 = data;
tmp32 = tmp32<<LSLshifter;
alt = alt | tmp32;
if (LSLshifter == 24){alt = alt/100; pstep++;}
break;
case 8: // Read Dataset Ground Speed
grspeed = data;
LSLshifter = 0;
pstep++;
break;
case 9:
LSLshifter = LSLshifter+8;
tmp32 = data;
tmp32 = tmp32<<LSLshifter;
grspeed = grspeed | tmp32;
if (LSLshifter == 24) pstep++;
break;
case 10: // Read Dataset Heading
grcourse = data;
LSLshifter = 0;
pstep++;
break;
case 11:
LSLshifter = LSLshifter+8;
tmp32 = data;
tmp32 = tmp32<<LSLshifter;
grcourse = grcourse | tmp32;
if (LSLshifter == 24) pstep++;
break;
case 12: // Read number of satellites in view
satn = data;
pstep++;
break;
case 13: // Read Fix Type and finish readout, mwii does not need the rest
if (data==1){ // No Fix
i2c_dataset.status.gps2dfix = 0;
i2c_dataset.status.gps3dfix = 0;}
if (data==2){ // GPS 2D Fix
i2c_dataset.status.gps2dfix = 1;
i2c_dataset.status.gps3dfix = 0;}
if (data==3){ // GPS 3D Fix
i2c_dataset.status.gps2dfix = 1;
i2c_dataset.status.gps3dfix = 1;}
GPS_read[LAT] = lat;
GPS_read[LON] = lon;
i2c_dataset.altitude = alt;
i2c_dataset.ground_speed = grspeed;
i2c_dataset.ground_course = grcourse;
i2c_dataset.status.numsats = satn;
parsed = true; // RDY
pstep = 0; // Do nothing with the next bytes
break;
}
return parsed;
}
Code: Select all
D0DD Dataset
20 Wrong Payloadbyte
84 35 01 C4
EA EB 8A 01
0F 27 34 AD
D0DD Next Dataset
20 Wrong Payloadbyte
84 35 01 C4
EA 2B AA 01
0F 27 94 CD
Code: Select all
bool GPS_MTK_newFrame(uint8_t data)
{
static uint8_t pstep; // Parse Step
static uint8_t lastbyte; // Last Byte for Sync detection
static uint8_t LSLshifter; // Bitshiftvalue
static int32_t lat; // MTK Dataset
static int32_t lon; // MTK Dataset
static int32_t alt; // MTK Dataset
static int32_t grspeed; // MTK Dataset
static int32_t grcourse; // MTK Dataset
static uint8_t satn; // MTK Dataset
int32_t tmp32;
bool parsed;
parsed = false;
if(pstep == 0 || pstep>5){ // Only search for Sync when idle or lat and lon already decoded.
if (data == 0xdd && lastbyte == 0xd0) pstep = 100;// Detect Sync "0xD0,0xDD"
}
lastbyte = data;
switch(pstep) {
case 0: // Special Case: Do Nothing
break;
case 100: // Special Case: Jump into decoding on next run
pstep = 1;
break;
case 1: // Payload Byte is always $20! (This is the first Byte after sync preamble)
if (data == 0x20) pstep++; // Since it is always $20 we take it as extended, undocumented syncword "preamble3"
else pstep =0;
break;
case 2: // Read Dataset Latitude
lat = data;
LSLshifter = 0;
pstep++;
break;
case 3:
LSLshifter = LSLshifter+8;
tmp32 = data;
tmp32 = tmp32<<LSLshifter;
lat = lat | tmp32;
if (LSLshifter == 24){lat = lat * 10; pstep++;}
break;
case 4: // Read Dataset Longitude
lon = data;
LSLshifter = 0;
pstep++;
break;
case 5:
LSLshifter = LSLshifter+8;
tmp32 = data;
tmp32 = tmp32<<LSLshifter;
lon = lon | tmp32;
if (LSLshifter == 24){lon = lon * 10; pstep++;}
break;
case 6: // Read Dataset MSL Altitude
alt = data;
LSLshifter = 0;
pstep++;
break;
case 7:
LSLshifter = LSLshifter+8;
tmp32 = data;
tmp32 = tmp32<<LSLshifter;
alt = alt | tmp32;
if (LSLshifter == 24){alt = alt/100; pstep++;}
break;
case 8: // Read Dataset Ground Speed
grspeed = data;
LSLshifter = 0;
pstep++;
break;
case 9:
LSLshifter = LSLshifter+8;
tmp32 = data;
tmp32 = tmp32<<LSLshifter;
grspeed = grspeed | tmp32;
if (LSLshifter == 24) pstep++;
break;
case 10: // Read Dataset Heading
grcourse = data;
LSLshifter = 0;
pstep++;
break;
case 11:
LSLshifter = LSLshifter+8;
tmp32 = data;
tmp32 = tmp32<<LSLshifter;
grcourse = grcourse | tmp32;
if (LSLshifter == 24) pstep++;
break;
case 12: // Read number of satellites in view
satn = data;
pstep++;
break;
case 13: // Read Fix Type and finish readout, mwii does not need the rest
if (data==1){ // No Fix
i2c_dataset.status.gps2dfix = 0;
i2c_dataset.status.gps3dfix = 0;}
if (data==2){ // GPS 2D Fix
i2c_dataset.status.gps2dfix = 1;
i2c_dataset.status.gps3dfix = 0;}
if (data==3){ // GPS 3D Fix
i2c_dataset.status.gps2dfix = 1;
i2c_dataset.status.gps3dfix = 1;}
GPS_read[LAT] = lat;
GPS_read[LON] = lon;
i2c_dataset.altitude = alt;
i2c_dataset.ground_speed = grspeed;
i2c_dataset.ground_course = grcourse;
i2c_dataset.status.numsats = satn;
parsed = true; // RDY
pstep = 0; // Do nothing with the next bytes
break;
}
return parsed;
}
Code: Select all
D0DD20000000000000000084350000000000000000000001013C3D0100AE512C0C0F27C2A1
D0DD20000000000000000084350000000000000000000001013C3D010096552C0C0F27AE25
D0DD20000000000000000084350000000000000000000001013C3D01007E592C0C0F279AA9
D0DD20000000000000000084350000000000000000000001013C3D0100665D2C0C0F27862D
D0DD20000000000000000084350000000000000000000001013C3D01004E612C0C0F2772B1
D0DD20000000000000000084350000000000000000000001013C3D010036652C0C0F275E35
D0DD20000000000000000084350000000000000000000001013C3D01001E692C0C0F274AB9
D0DD20000000000000000084350000000000000000000001013C3D0100066D2C0C0F27363D
D0DD20000000000000000084350000000000000000000001013C3D0100EE702C0C0F2721BC
D0DD20000000000000000084350000000000000000000001013C3D0100D6742C0C0F270D40
D0DD20000000000000000084350000000000000000000001013C3D0100BE782C0C0F27F9C4
D0DD20000000000000000084350000000000000000000001013C3D0100A67C2C0C0F27E548
Crashpilot1000 wrote:@Vaattari:
Thank you for your interest! I use the eos bandi recommended FW AXN1.51_2722_3329_384.1151100.5.bin (http://code.google.com/p/i2c-gps-nav/do ... p&can=2&q=). The change of the baudrates is not accessible in config.h you have to change it in the code directly. I monitored the traffic between arduino and the gps with an ftdi adapter and the free terminal software "PUTTY". Afterwards i analyzed the log file with hexedit (shareware). I will have to change the code from above to sort out gps positions wich produce the syncword... but stay tuned. I think using mtk in binary mode (like ublox) is the way to go.
So long
Kraut Rob
Code: Select all
bool GPS_MTK_newFrame(uint8_t data)
{
static uint8_t pstep; // Parse Step
static uint8_t lastbyte; // Last Byte for Sync detection
static uint8_t LSLshifter; // Bitshiftvalue
static uint8_t chkA,count;
static int32_t lat; // MTK Dataset
static int32_t lon; // MTK Dataset
static int32_t alt; // MTK Dataset
static int32_t grspeed; // MTK Dataset
static int32_t grcourse; // MTK Dataset
static uint8_t satn,fixtype; // MTK Dataset
int32_t tmp32;
bool parsed;
parsed = false;
if (pstep == 0 && data == 0xdd && lastbyte == 0xd0) pstep = 100; // Detect Sync "0xD0,0xDD" Only search for Sync when not already decoding
lastbyte = data;
switch(pstep) {
case 0: // Special Case: Do Nothing
break;
case 100: // Special Case: Prepare next decoding run
pstep = 1; // Jump into decoding on next run
chkA = 0; count = 0; // Reset values
break;
case 1: // Payload Byte is always $20! (This is the first Byte after sync preamble)
if (data == 0x20) pstep++; // Since it is always $20 we take it as extended, undocumented syncword "preamble3"
else pstep =0; // Error! Wait for sync
chkA = chkA + data;
count ++;
break;
case 2: // Read Dataset Latitude
lat = data;
LSLshifter = 0;
pstep++;
chkA = chkA + data;
count ++;
break;
case 3:
LSLshifter = LSLshifter+8;
tmp32 = data;
tmp32 = tmp32<<LSLshifter;
lat = lat | tmp32;
if (LSLshifter == 24){lat = lat * 10; pstep++;}
chkA = chkA + data;
count ++;
break;
case 4: // Read Dataset Longitude
lon = data;
LSLshifter = 0;
pstep++;
chkA = chkA + data;
count ++;
break;
case 5:
LSLshifter = LSLshifter+8;
tmp32 = data;
tmp32 = tmp32<<LSLshifter;
lon = lon | tmp32;
if (LSLshifter == 24){lon = lon * 10; pstep++;}
chkA = chkA + data;
count ++;
break;
case 6: // Read Dataset MSL Altitude
alt = data;
LSLshifter = 0;
pstep++;
chkA = chkA + data;
count ++;
break;
case 7:
LSLshifter = LSLshifter+8;
tmp32 = data;
tmp32 = tmp32<<LSLshifter;
alt = alt | tmp32;
if (LSLshifter == 24){alt = alt/100; pstep++;}
chkA = chkA + data;
count ++;
break;
case 8: // Read Dataset Ground Speed
grspeed = data;
LSLshifter = 0;
pstep++;
chkA = chkA + data;
count ++;
break;
case 9:
LSLshifter = LSLshifter+8;
tmp32 = data;
tmp32 = tmp32<<LSLshifter;
grspeed = grspeed | tmp32;
if (LSLshifter == 24) pstep++;
chkA = chkA + data;
count ++;
break;
case 10: // Read Dataset Heading
grcourse = data;
LSLshifter = 0;
pstep++;
chkA = chkA + data;
count ++;
break;
case 11:
LSLshifter = LSLshifter+8;
tmp32 = data;
tmp32 = tmp32<<LSLshifter;
grcourse = grcourse | tmp32;
if (LSLshifter == 24) pstep++;
chkA = chkA + data;
count ++;
break;
case 12: // Read number of satellites in view
satn = data;
pstep++;
chkA = chkA + data;
count ++;
break;
case 13: // Read Fix Type
fixtype = data;
pstep++;
chkA = chkA + data;
count ++;
break;
case 14: // Wait for cheksum A
if (count == 33){ // 33 = 0x21
if (chkA == data) pstep++; // ChecksumA reached. Correct? than go on
else pstep = 0; // Error?
}else{
chkA = chkA + data;
count ++;}
break;
case 15: // Dataset RDY !! Cheksum B omitted, ChkA was OK
if (fixtype==1){ // No Fix
i2c_dataset.status.gps2dfix = 0;
i2c_dataset.status.gps3dfix = 0;}
if (fixtype==2){ // GPS 2D Fix
i2c_dataset.status.gps2dfix = 1;
i2c_dataset.status.gps3dfix = 0;}
if (fixtype==3){ // GPS 3D Fix
i2c_dataset.status.gps2dfix = 1;
i2c_dataset.status.gps3dfix = 1;}
GPS_read[LAT] = lat;
GPS_read[LON] = lon;
i2c_dataset.altitude = alt;
i2c_dataset.ground_speed = grspeed;
i2c_dataset.ground_course = grcourse;
i2c_dataset.status.numsats = satn;
parsed = true; // RDY
pstep = 0; // Do nothing
break;
}
return parsed;
}