projects
/
bertos.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Reformat code.
[bertos.git]
/
bertos
/
net
/
nmea.c
diff --git
a/bertos/net/nmea.c
b/bertos/net/nmea.c
index 9f2d67d8fb11fddf83270aa9b91f53e3cf08b6a6..93985e79b3db0456d29c6d98fa7d31c871606556 100644
(file)
--- a/
bertos/net/nmea.c
+++ b/
bertos/net/nmea.c
@@
-51,6
+51,7
@@
#include <ctype.h>
#include <time.h>
#include <string.h>
#include <ctype.h>
#include <time.h>
#include <string.h>
+#include <stdlib.h>
static uint32_t tokenToInt(const char *s, int precision)
static uint32_t tokenToInt(const char *s, int precision)
@@
-112,20
+113,13
@@
static udegree_t nmea_latitude(const char *plat, const char *phem)
int ns;
if (*phem == 0)
int ns;
if (*phem == 0)
- {
return 0;
return 0;
- }
-
/* north lat is +, south lat is - */
if (*phem == 'N')
/* north lat is +, south lat is - */
if (*phem == 'N')
- {
ns = 1;
ns = 1;
- }
else
else
- {
ns = -1;
ns = -1;
- }
return ns * convertToDegree(plat);
return ns * convertToDegree(plat);
@@
-135,19
+129,14
@@
static udegree_t nmea_longitude(const char *plot, const char *phem)
{
int ew;
{
int ew;
+ if (*phem == 0)
+ return 0;
+
/* west long is negative, east long is positive */
if (*phem == 'E')
/* west long is negative, east long is positive */
if (*phem == 'E')
- {
ew = 1;
ew = 1;
- }
- else {
+ else
ew = -1;
ew = -1;
- }
-
- if (*phem == 0)
- {
- return 0;
- }
return ew * convertToDegree(plot);
}
return ew * convertToDegree(plot);
}
@@
-157,9
+146,7
@@
static uint16_t nmea_altitude(const char *palt, const char *punits)
uint32_t alt;
if (*palt == 0)
uint32_t alt;
if (*palt == 0)
- {
return 0;
return 0;
- }
alt = atoi(palt);
alt = atoi(palt);