kopia lustrzana https://github.com/OpenRTX/OpenRTX
Update GPS test
rodzic
67195d178f
commit
2e0ac1b1f6
|
@ -40,6 +40,7 @@ int main()
|
||||||
gps_init(9600);
|
gps_init(9600);
|
||||||
gps_enable();
|
gps_enable();
|
||||||
|
|
||||||
|
int i = 0;
|
||||||
while(1)
|
while(1)
|
||||||
{
|
{
|
||||||
int len = gps_getNmeaSentence(line, MINMEA_MAX_LENGTH*10);
|
int len = gps_getNmeaSentence(line, MINMEA_MAX_LENGTH*10);
|
||||||
|
@ -47,90 +48,78 @@ int main()
|
||||||
{
|
{
|
||||||
printf("Got sentence with length %d:\r\n", len);
|
printf("Got sentence with length %d:\r\n", len);
|
||||||
printf("%s\r\n", line);
|
printf("%s\r\n", line);
|
||||||
|
switch (minmea_sentence_id(line, false)) {
|
||||||
|
case MINMEA_SENTENCE_RMC:
|
||||||
|
{
|
||||||
|
struct minmea_sentence_rmc frame;
|
||||||
|
if (minmea_parse_rmc(&frame, line)) {
|
||||||
|
printf("$RMC: raw coordinates and speed: (%d/%d,%d/%d) %d/%d\n\r",
|
||||||
|
frame.latitude.value, frame.latitude.scale,
|
||||||
|
frame.longitude.value, frame.longitude.scale,
|
||||||
|
frame.speed.value, frame.speed.scale);
|
||||||
|
printf("$RMC fixed-point coordinates and speed scaled to three decimal places: (%d,%d) %d\n\r",
|
||||||
|
minmea_rescale(&frame.latitude, 1000),
|
||||||
|
minmea_rescale(&frame.longitude, 1000),
|
||||||
|
minmea_rescale(&frame.speed, 1000));
|
||||||
|
printf("$RMC floating point degree coordinates and speed: (%f,%f) %f\n\r",
|
||||||
|
minmea_tocoord(&frame.latitude),
|
||||||
|
minmea_tocoord(&frame.longitude),
|
||||||
|
minmea_tofloat(&frame.speed));
|
||||||
}
|
}
|
||||||
}
|
} break;
|
||||||
|
|
||||||
// int i = 0;
|
case MINMEA_SENTENCE_GGA:
|
||||||
// while(1)
|
{
|
||||||
// {
|
struct minmea_sentence_gga frame;
|
||||||
// while((USART3->SR & USART_SR_RXNE) == 0) ;
|
if (minmea_parse_gga(&frame, line)) {
|
||||||
// line[i++] = USART3->DR;
|
printf("$GGA: fix quality: %d\n\r", frame.fix_quality);
|
||||||
// // If a NMEA sentence is complete
|
}
|
||||||
// if (line[i - 1] == '\n') {
|
} break;
|
||||||
// line[i] = '\0';
|
|
||||||
// printf("%s\n\r", line);
|
case MINMEA_SENTENCE_GSV:
|
||||||
// switch (minmea_sentence_id(line, false)) {
|
{
|
||||||
// case MINMEA_SENTENCE_RMC:
|
struct minmea_sentence_gsv frame;
|
||||||
// {
|
if (minmea_parse_gsv(&frame, line)) {
|
||||||
// struct minmea_sentence_rmc frame;
|
printf("$GSV: message %d of %d\n\r", frame.msg_nr, frame.total_msgs);
|
||||||
// if (minmea_parse_rmc(&frame, line)) {
|
printf("$GSV: satellites in view: %d\n\r", frame.total_sats);
|
||||||
// printf("$RMC: raw coordinates and speed: (%d/%d,%d/%d) %d/%d\n\r",
|
for (int i = 0; i < 4; i++)
|
||||||
// frame.latitude.value, frame.latitude.scale,
|
printf("$GSV: sat nr %d, elevation: %d, azimuth: %d, snr: %d dbm\n\r",
|
||||||
// frame.longitude.value, frame.longitude.scale,
|
frame.sats[i].nr,
|
||||||
// frame.speed.value, frame.speed.scale);
|
frame.sats[i].elevation,
|
||||||
// printf("$RMC fixed-point coordinates and speed scaled to three decimal places: (%d,%d) %d\n\r",
|
frame.sats[i].azimuth,
|
||||||
// minmea_rescale(&frame.latitude, 1000),
|
frame.sats[i].snr);
|
||||||
// minmea_rescale(&frame.longitude, 1000),
|
}
|
||||||
// minmea_rescale(&frame.speed, 1000));
|
} break;
|
||||||
// printf("$RMC floating point degree coordinates and speed: (%f,%f) %f\n\r",
|
|
||||||
// minmea_tocoord(&frame.latitude),
|
case MINMEA_SENTENCE_VTG:
|
||||||
// minmea_tocoord(&frame.longitude),
|
{
|
||||||
// minmea_tofloat(&frame.speed));
|
|
||||||
// }
|
} break;
|
||||||
// } break;
|
|
||||||
//
|
// Ignore this message as we take data from RMC
|
||||||
// case MINMEA_SENTENCE_GGA:
|
case MINMEA_SENTENCE_GLL:
|
||||||
// {
|
;
|
||||||
// struct minmea_sentence_gga frame;
|
break;
|
||||||
// if (minmea_parse_gga(&frame, line)) {
|
|
||||||
// printf("$GGA: fix quality: %d\n\r", frame.fix_quality);
|
// These messages are never sent by the Jumpstar JS-M710 Module
|
||||||
// }
|
case MINMEA_SENTENCE_GSA: break;
|
||||||
// } break;
|
case MINMEA_SENTENCE_GST: break;
|
||||||
//
|
case MINMEA_SENTENCE_ZDA: break;
|
||||||
// case MINMEA_SENTENCE_GSV:
|
|
||||||
// {
|
// Error handling
|
||||||
// struct minmea_sentence_gsv frame;
|
case MINMEA_INVALID:
|
||||||
// if (minmea_parse_gsv(&frame, line)) {
|
{
|
||||||
// printf("$GSV: message %d of %d\n\r", frame.msg_nr, frame.total_msgs);
|
printf("Error: Invalid NMEA sentence!\n\r");
|
||||||
// printf("$GSV: satellites in view: %d\n\r", frame.total_sats);
|
} break;
|
||||||
// for (int i = 0; i < 4; i++)
|
|
||||||
// printf("$GSV: sat nr %d, elevation: %d, azimuth: %d, snr: %d dbm\n\r",
|
case MINMEA_UNKNOWN:
|
||||||
// frame.sats[i].nr,
|
{
|
||||||
// frame.sats[i].elevation,
|
printf("Error: Unsupported NMEA sentence!\n\r");
|
||||||
// frame.sats[i].azimuth,
|
} break;
|
||||||
// frame.sats[i].snr);
|
}
|
||||||
// }
|
i = 0;
|
||||||
// } break;
|
}
|
||||||
//
|
}
|
||||||
// case MINMEA_SENTENCE_VTG:
|
|
||||||
// {
|
|
||||||
//
|
|
||||||
// } break;
|
|
||||||
//
|
|
||||||
// // Ignore this message as we take data from RMC
|
|
||||||
// case MINMEA_SENTENCE_GLL:
|
|
||||||
// ;
|
|
||||||
// break;
|
|
||||||
//
|
|
||||||
// // These messages are never sent by the Jumpstar JS-M710 Module
|
|
||||||
// case MINMEA_SENTENCE_GSA: break;
|
|
||||||
// case MINMEA_SENTENCE_GST: break;
|
|
||||||
// case MINMEA_SENTENCE_ZDA: break;
|
|
||||||
//
|
|
||||||
// // Error handling
|
|
||||||
// case MINMEA_INVALID:
|
|
||||||
// {
|
|
||||||
// printf("Error: Invalid NMEA sentence!\n\r");
|
|
||||||
// } break;
|
|
||||||
//
|
|
||||||
// case MINMEA_UNKNOWN:
|
|
||||||
// {
|
|
||||||
// printf("Error: Unsupported NMEA sentence!\n\r");
|
|
||||||
// } break;
|
|
||||||
// }
|
|
||||||
// i = 0;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Ładowanie…
Reference in New Issue