Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Revision 4:41330399104d, committed 2018-06-29
- Comitter:
- Tomo073
- Date:
- Fri Jun 29 04:25:20 2018 +0000
- Parent:
- 3:940fe222bab0
- Child:
- 5:b97034d6df35
- Commit message:
- a;
Changed in this revision
| GPS.cpp | Show annotated file Show diff for this revision Revisions of this file |
| GPS.h | Show annotated file Show diff for this revision Revisions of this file |
--- a/GPS.cpp Wed Jun 13 06:54:42 2018 +0000
+++ b/GPS.cpp Fri Jun 29 04:25:20 2018 +0000
@@ -2,6 +2,9 @@
#include "GPS.h"
GPS::GPS(PinName gpstx,PinName gpsrx): serial(gpstx,gpsrx){
+
+ Initialization();
+
}
void GPS::attach(void(*fn)()){
@@ -35,11 +38,11 @@
switch(info){
case 1:
- time = strtof(DATA, NULL) + 90000.0;
+ time = strtod(DATA, NULL) + 90000.0;
break;
case 2:
- fMinutes = modff(strtof(DATA, NULL), &latitude)*60.0;
- latitude = latitude*100.0 + fMinutes;
+ Minutes = modf(strtod(DATA, NULL)/100.0, &latitude);
+ latitude = latitude + Minutes*10.0/6.0;
break;
case 3:
if(!strcmp(DATA, "S")){
@@ -47,8 +50,8 @@
}
break;
case 4:
- fMinutes = modff(strtof(DATA, NULL), &longtitude)*60.0;
- longtitude = longtitude*100.0 + fMinutes;
+ Minutes = modf(strtod(DATA, NULL)/100.0, &longtitude);
+ longtitude = longtitude + Minutes*10.0/6.0;
break;
case 5:
if(!strcmp(DATA, "W")){
@@ -88,7 +91,7 @@
longtitude = -1.0;
latitude = -1.0;
altitude = -1.0;
- time = -1.0;
- fMinutes = -1.0;
+ times = -1.0;
+ Minutes = -1.0;
}
--- a/GPS.h Wed Jun 13 06:54:42 2018 +0000
+++ b/GPS.h Fri Jun 29 04:25:20 2018 +0000
@@ -7,16 +7,15 @@
ex:NVIC_SetPriority(UART2_IRQn,0); //0の部分で優先順位を決定
readable == true のとき正しいデータが出力
- ※経度、緯度、海抜、時間の読み方
+ ※経度(lon)、緯度(lat)、海抜(alt)、時間(time)の読み方
lon,lat:dddmmss.ssss
ddd:度(1,2ケタの場合あり)
mm:分
ss:秒
- time:hhmmss.000000
+ time:hhmm.mmmm
hh.時
mm.分
- ss.秒
alt:mm.mmmm
@@ -68,7 +67,7 @@
bool readable;
char datadefault;
- float longtitude, latitude, time, altitude, times;
+ long double longtitude, latitude, time, altitude, times;
void attach(void(*fn)());
void GetDefault();
@@ -76,7 +75,7 @@
private:
Serial serial;
- float fMinutes;
+ long double Minutes;
void getstring(char DATA[]);
void Initialization();
};