initial commit
This commit is contained in:
commit
955b2a02b8
5
.gitignore
vendored
Normal file
5
.gitignore
vendored
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
.pio
|
||||||
|
.vscode/.browse.c_cpp.db*
|
||||||
|
.vscode/c_cpp_properties.json
|
||||||
|
.vscode/launch.json
|
||||||
|
.vscode/ipch
|
||||||
10
.vscode/extensions.json
vendored
Normal file
10
.vscode/extensions.json
vendored
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
{
|
||||||
|
// See http://go.microsoft.com/fwlink/?LinkId=827846
|
||||||
|
// for the documentation about the extensions.json format
|
||||||
|
"recommendations": [
|
||||||
|
"platformio.platformio-ide"
|
||||||
|
],
|
||||||
|
"unwantedRecommendations": [
|
||||||
|
"ms-vscode.cpptools-extension-pack"
|
||||||
|
]
|
||||||
|
}
|
||||||
37
include/README
Normal file
37
include/README
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
|
||||||
|
This directory is intended for project header files.
|
||||||
|
|
||||||
|
A header file is a file containing C declarations and macro definitions
|
||||||
|
to be shared between several project source files. You request the use of a
|
||||||
|
header file in your project source file (C, C++, etc) located in `src` folder
|
||||||
|
by including it, with the C preprocessing directive `#include'.
|
||||||
|
|
||||||
|
```src/main.c
|
||||||
|
|
||||||
|
#include "header.h"
|
||||||
|
|
||||||
|
int main (void)
|
||||||
|
{
|
||||||
|
...
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
Including a header file produces the same results as copying the header file
|
||||||
|
into each source file that needs it. Such copying would be time-consuming
|
||||||
|
and error-prone. With a header file, the related declarations appear
|
||||||
|
in only one place. If they need to be changed, they can be changed in one
|
||||||
|
place, and programs that include the header file will automatically use the
|
||||||
|
new version when next recompiled. The header file eliminates the labor of
|
||||||
|
finding and changing all the copies as well as the risk that a failure to
|
||||||
|
find one copy will result in inconsistencies within a program.
|
||||||
|
|
||||||
|
In C, the convention is to give header files names that end with `.h'.
|
||||||
|
|
||||||
|
Read more about using header files in official GCC documentation:
|
||||||
|
|
||||||
|
* Include Syntax
|
||||||
|
* Include Operation
|
||||||
|
* Once-Only Headers
|
||||||
|
* Computed Includes
|
||||||
|
|
||||||
|
https://gcc.gnu.org/onlinedocs/cpp/Header-Files.html
|
||||||
48
include/gps.h
Normal file
48
include/gps.h
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <Arduino.h>
|
||||||
|
|
||||||
|
struct GPSData {
|
||||||
|
float latitude; // in degrees, poistive is N
|
||||||
|
float longitude; // in degrees, positive is E
|
||||||
|
short altitude; // in meters from sea level
|
||||||
|
};
|
||||||
|
|
||||||
|
class GPSSerial {
|
||||||
|
private:
|
||||||
|
enum Field {
|
||||||
|
HEADER,
|
||||||
|
TIME,
|
||||||
|
LATITUDE,
|
||||||
|
LAT_INDICATOR,
|
||||||
|
LONGITUDE,
|
||||||
|
LONG_INDICATOR,
|
||||||
|
FIX_STATUS,
|
||||||
|
SAT_USED,
|
||||||
|
HDOP,
|
||||||
|
ALTITUDE,
|
||||||
|
ALT_UNIT,
|
||||||
|
ALTREF,
|
||||||
|
ALTREF_UNIT,
|
||||||
|
DIFFAGE,
|
||||||
|
DIFFSTATION,
|
||||||
|
CHECKSUM,
|
||||||
|
};
|
||||||
|
|
||||||
|
HardwareSerial* port;
|
||||||
|
char field_buffer[32];
|
||||||
|
unsigned char field_len;
|
||||||
|
Field field;
|
||||||
|
unsigned char checksum; // rolling checksum
|
||||||
|
|
||||||
|
|
||||||
|
bool read_field();
|
||||||
|
void update_checksum();
|
||||||
|
|
||||||
|
public:
|
||||||
|
GPSData data;
|
||||||
|
GPSSerial(HardwareSerial* hw_port) { port = hw_port; }
|
||||||
|
~GPSSerial();
|
||||||
|
bool is_data_ready(void);
|
||||||
|
};
|
||||||
|
|
||||||
46
lib/README
Normal file
46
lib/README
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
|
||||||
|
This directory is intended for project specific (private) libraries.
|
||||||
|
PlatformIO will compile them to static libraries and link into the executable file.
|
||||||
|
|
||||||
|
The source code of each library should be placed in a separate directory
|
||||||
|
("lib/your_library_name/[Code]").
|
||||||
|
|
||||||
|
For example, see the structure of the following example libraries `Foo` and `Bar`:
|
||||||
|
|
||||||
|
|--lib
|
||||||
|
| |
|
||||||
|
| |--Bar
|
||||||
|
| | |--docs
|
||||||
|
| | |--examples
|
||||||
|
| | |--src
|
||||||
|
| | |- Bar.c
|
||||||
|
| | |- Bar.h
|
||||||
|
| | |- library.json (optional. for custom build options, etc) https://docs.platformio.org/page/librarymanager/config.html
|
||||||
|
| |
|
||||||
|
| |--Foo
|
||||||
|
| | |- Foo.c
|
||||||
|
| | |- Foo.h
|
||||||
|
| |
|
||||||
|
| |- README --> THIS FILE
|
||||||
|
|
|
||||||
|
|- platformio.ini
|
||||||
|
|--src
|
||||||
|
|- main.c
|
||||||
|
|
||||||
|
Example contents of `src/main.c` using Foo and Bar:
|
||||||
|
```
|
||||||
|
#include <Foo.h>
|
||||||
|
#include <Bar.h>
|
||||||
|
|
||||||
|
int main (void)
|
||||||
|
{
|
||||||
|
...
|
||||||
|
}
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
The PlatformIO Library Dependency Finder will find automatically dependent
|
||||||
|
libraries by scanning project source files.
|
||||||
|
|
||||||
|
More information about PlatformIO Library Dependency Finder
|
||||||
|
- https://docs.platformio.org/page/librarymanager/ldf.html
|
||||||
21
platformio.ini
Normal file
21
platformio.ini
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
; PlatformIO Project Configuration File
|
||||||
|
;
|
||||||
|
; Build options: build flags, source filter
|
||||||
|
; Upload options: custom upload port, speed and extra flags
|
||||||
|
; Library options: dependencies, extra library storages
|
||||||
|
; Advanced options: extra scripting
|
||||||
|
;
|
||||||
|
; Please visit documentation for the other options and examples
|
||||||
|
; https://docs.platformio.org/page/projectconf.html
|
||||||
|
|
||||||
|
[env:pico]
|
||||||
|
platform = https://github.com/maxgerhardt/platform-raspberrypi.git
|
||||||
|
board = pico
|
||||||
|
framework = arduino
|
||||||
|
board_build.core = earlephilhower
|
||||||
|
|
||||||
|
[env:pico2]
|
||||||
|
platform = https://github.com/maxgerhardt/platform-raspberrypi.git
|
||||||
|
board = rpipico2
|
||||||
|
framework = arduino
|
||||||
|
board_build.core = earlephilhower
|
||||||
235
serial_out.txt
Normal file
235
serial_out.txt
Normal file
@ -0,0 +1,235 @@
|
|||||||
|
$GPGSV,3,2,11,15,08,041,,16,58,207,29,18,26,059,,23,49,064,*7A
|
||||||
|
$GPGSV,3,3,11,26,26,180,28,27,72,320,16,30,00,334,*4B
|
||||||
|
$GPGLL,4343.66601,N,01023.53900,E,225603.00,A,A*61
|
||||||
|
$GPRMC,225604.00,A,4343.66627,N,01023.53882,E,0.694,,051125,,,A*79
|
||||||
|
$GPVTG,,T,,M,0.694,N,1.285,K,A*26
|
||||||
|
$GPGGA,225604.00,4343.66627,N,01023.53882,E,1,05,2.87,-9.9,M,46.3,M,,*78
|
||||||
|
$GPGSA,A,3,26,16,08,27,10,,,,,,,,4.40,2.87,3.33*03
|
||||||
|
$GPGSV,3,1,11,02,17,255,20,07,07,310,,08,38,302,23,10,59,141,37*73
|
||||||
|
$GPGSV,3,2,11,15,08,041,,16,58,207,31,18,26,059,,23,49,064,*73
|
||||||
|
$GPGSV,3,3,11,26,26,180,30,27,72,320,16,30,00,334,*42
|
||||||
|
$GPGLL,4343.66627,N,01023.53882,E,225604.00,A,A*69
|
||||||
|
$GPRMC,225605.00,A,4343.66659,N,01023.53870,E,0.627,,051125,,,A*74
|
||||||
|
$GPVTG,,T,,M,0.627,N,1.162,K,A*24
|
||||||
|
$GPGGA,225605.00,4343.66659,N,01023.53870,E,1,05,2.87,-8.3,M,46.3,M,,*76
|
||||||
|
$GPGSA,A,3,26,16,08,27,10,,,,,,,,4.40,2.87,3.33*03
|
||||||
|
$GPGSV,3,1,11,02,17,255,21,07,07,310,,08,38,302,22,10,59,141,37*73
|
||||||
|
$GPGSV,3,2,11,15,08,041,,16,58,207,32,18,26,059,,23,49,064,*70
|
||||||
|
$GPGSV,3,3,11,26,26,180,31,27,72,320,16,30,00,334,*43
|
||||||
|
$GPGLL,4343.66659,N,01023.53870,E,225605.00,A,A*6C
|
||||||
|
$GPRMC,225606.00,A,4343.66681,N,01023.53854,E,0.488,,051125,,,A*73
|
||||||
|
$GPVTG,,T,,M,0.488,N,0.904,K,A*2A
|
||||||
|
$GPGGA,225606.00,4343.66681,N,01023.53854,E,1,05,2.87,-6.7,M,46.3,M,,*7C
|
||||||
|
$GPGSA,A,3,26,16,08,27,10,,,,,,,,4.40,2.87,3.33*03
|
||||||
|
$GPGSV,3,1,11,02,17,255,22,07,07,310,,08,38,302,22,10,59,141,38*7F
|
||||||
|
$GPGSV,3,2,11,15,08,041,,16,58,207,33,18,26,059,,23,49,064,*71
|
||||||
|
$GPGSV,3,3,11,26,26,180,31,27,72,320,16,30,00,334,*43
|
||||||
|
$GPGLL,4343.66681,N,01023.53854,E,225606.00,A,A*6C
|
||||||
|
$GPRMC,225607.00,A,4343.66682,N,01023.53836,E,0.260,,051125,,,A*75
|
||||||
|
$GPVTG,,T,,M,0.260,N,0.482,K,A*29
|
||||||
|
$GPGGA,225607.00,4343.66682,N,01023.53836,E,1,05,2.87,-5.5,M,46.3,M,,*7B
|
||||||
|
$GPGSA,A,3,26,16,08,27,10,,,,,,,,4.40,2.87,3.33*03
|
||||||
|
$GPGSV,3,1,11,02,17,255,22,07,07,310,,08,38,302,23,10,59,141,38*7E
|
||||||
|
$GPGSV,3,2,11,15,08,041,,16,58,207,33,18,26,059,,23,49,064,*71
|
||||||
|
$GPGSV,3,3,11,26,26,180,31,27,72,320,16,30,00,334,*43
|
||||||
|
$GPGLL,4343.66682,N,01023.53836,E,225607.00,A,A*6A
|
||||||
|
$GPRMC,225608.00,A,4343.66692,N,01023.53823,E,0.293,,051125,,,A*73
|
||||||
|
$GPVTG,,T,,M,0.293,N,0.542,K,A*28
|
||||||
|
$GPGGA,225608.00,4343.66692,N,01023.53823,E,1,05,2.87,-4.6,M,46.3,M,,*73
|
||||||
|
$GPGSA,A,3,26,16,08,27,10,,,,,,,,4.39,2.87,3.33*0D
|
||||||
|
$GPGSV,3,1,11,02,17,255,22,07,07,310,,08,38,302,23,10,59,141,38*7E
|
||||||
|
$GPGSV,3,2,11,15,08,041,,16,58,207,33,18,26,059,,23,49,064,*71
|
||||||
|
$GPGSV,3,3,11,26,26,180,30,27,72,320,14,30,00,334,*40
|
||||||
|
$GPGLL,4343.66692,N,01023.53823,E,225608.00,A,A*60
|
||||||
|
$GPRMC,225609.00,A,4343.66694,N,01023.53820,E,0.143,,051125,,,A*79
|
||||||
|
$GPVTG,,T,,M,0.143,N,0.264,K,A*25
|
||||||
|
$GPGGA,225609.00,4343.66694,N,01023.53820,E,1,05,2.87,-3.8,M,46.3,M,,*7E
|
||||||
|
$GPGSA,A,3,26,16,08,27,10,,,,,,,,4.39,2.87,3.33*0D
|
||||||
|
$GPGSV,3,1,11,02,17,255,22,07,07,310,,08,38,302,22,10,59,141,37*70
|
||||||
|
$GPGSV,3,2,11,15,08,041,,16,58,207,33,18,26,059,,23,49,064,*71
|
||||||
|
$GPGSV,3,3,11,26,26,180,29,27,72,320,14,30,00,334,*48
|
||||||
|
$GPGLL,4343.66694,N,01023.53820,E,225609.00,A,A*64
|
||||||
|
$GPRMC,225610.00,A,4343.66698,N,01023.53812,E,0.071,,051125,,,A*7C
|
||||||
|
$GPVTG,,T,,M,0.071,N,0.131,K,A*26
|
||||||
|
$GPGGA,225610.00,4343.66698,N,01023.53812,E,1,05,2.87,-3.1,M,46.3,M,,*72
|
||||||
|
$GPGSA,A,3,26,16,08,27,10,,,,,,,,4.39,2.87,3.33*0D
|
||||||
|
$GPGSV,3,1,11,02,17,255,22,07,07,310,,08,38,302,21,10,59,141,37*73
|
||||||
|
$GPGSV,3,2,11,15,08,041,,16,58,207,33,18,26,059,,23,49,064,*71
|
||||||
|
$GPGSV,3,3,11,26,26,180,29,27,72,320,14,30,00,334,*48
|
||||||
|
$GPGLL,4343.66698,N,01023.53812,E,225610.00,A,A*61
|
||||||
|
$GPRMC,225611.00,A,4343.66675,N,01023.53807,E,0.259,,051125,,,A*72
|
||||||
|
$GPVTG,,T,,M,0.259,N,0.479,K,A*27
|
||||||
|
$GPGGA,225611.00,4343.66675,N,01023.53807,E,1,05,2.87,-2.1,M,46.3,M,,*75
|
||||||
|
$GPGSA,A,3,26,16,08,27,10,,,,,,,,4.39,2.87,3.33*0D
|
||||||
|
$GPGSV,3,1,11,02,17,255,22,07,07,310,,08,38,302,20,10,59,141,37*72
|
||||||
|
$GPGSV,3,2,11,15,08,041,,16,58,207,33,18,26,059,,23,49,064,*71
|
||||||
|
$GPGSV,3,3,11,26,26,180,29,27,72,320,14,30,00,334,*48
|
||||||
|
$GPGLL,4343.66675,N,01023.53807,E,225611.00,A,A*67
|
||||||
|
$GPRMC,225612.00,A,4343.66608,N,01023.53809,E,0.987,,051125,,,A*7D
|
||||||
|
$GPVTG,,T,,M,0.987,N,1.828,K,A*26
|
||||||
|
$GPGGA,225612.00,4343.66608,N,01023.53809,E,1,05,2.87,-0.3,M,46.3,M,,*72
|
||||||
|
$GPGSA,A,3,26,16,08,27,10,,,,,,,,4.39,2.87,3.33*0D
|
||||||
|
$GPGSV,3,1,11,02,17,255,22,07,07,310,,08,38,302,20,10,59,141,37*72
|
||||||
|
$GPGSV,3,2,11,15,08,041,,16,58,207,33,18,26,059,,23,49,064,*71
|
||||||
|
$GPGSV,3,3,11,26,26,180,29,27,72,320,14,30,00,334,*48
|
||||||
|
$GPGLL,4343.66608,N,01023.53809,E,225612.00,A,A*60
|
||||||
|
$GPRMC,225613.00,A,4343.66624,N,01023.53804,E,0.360,,051125,,,A*7C
|
||||||
|
$GPVTG,,T,,M,0.360,N,0.666,K,A*20
|
||||||
|
$GPGGA,225613.00,4343.66624,N,01023.53804,E,1,05,2.87,0.3,M,46.3,M,,*5D
|
||||||
|
$GPGSA,A,3,26,16,08,27,10,,,,,,,,4.39,2.87,3.33*0D
|
||||||
|
$GPGSV,3,1,11,02,17,255,22,07,07,310,,08,38,302,20,10,59,141,37*72
|
||||||
|
$GPGSV,3,2,11,15,08,041,,16,58,207,33,18,26,059,,23,49,064,*71
|
||||||
|
$GPGSV,3,3,11,26,26,180,29,27,72,320,14,30,00,334,*48
|
||||||
|
$GPGLL,4343.66624,N,01023.53804,E,225613.00,A,A*62
|
||||||
|
$GPRMC,225614.00,A,4343.66631,N,01023.53795,E,0.134,,051125,,,A*7B
|
||||||
|
$GPVTG,,T,,M,0.134,N,0.249,K,A*2A
|
||||||
|
$GPGGA,225614.00,4343.66631,N,01023.53795,E,1,05,2.87,1.2,M,46.3,M,,*59
|
||||||
|
$GPGSA,A,3,26,16,08,27,10,,,,,,,,4.39,2.87,3.33*0D
|
||||||
|
$GPGSV,3,1,11,02,17,255,22,07,07,310,,08,38,302,21,10,59,141,37*73
|
||||||
|
$GPGSV,3,2,11,15,08,041,,16,58,207,33,18,26,059,,23,49,064,*71
|
||||||
|
$GPGSV,3,3,11,26,26,180,30,27,72,320,14,30,00,334,*40
|
||||||
|
$GPGLL,4343.66631,N,01023.53795,E,225614.00,A,A*66
|
||||||
|
$GPRMC,225615.00,A,4343.66623,N,01023.53792,E,0.282,,051125,,,A*70
|
||||||
|
$GPVTG,,T,,M,0.282,N,0.522,K,A*2E
|
||||||
|
$GPGGA,225615.00,4343.66623,N,01023.53792,E,1,05,2.87,2.0,M,46.3,M,,*5D
|
||||||
|
$GPGSA,A,3,26,16,08,27,10,,,,,,,,4.39,2.87,3.33*0D
|
||||||
|
$GPGSV,3,1,11,02,17,255,23,07,07,310,,08,38,302,21,10,59,141,37*72
|
||||||
|
$GPGSV,3,2,11,15,08,041,,16,58,207,32,18,26,059,,23,49,064,*70
|
||||||
|
$GPGSV,3,3,11,26,26,180,30,27,72,320,14,30,00,334,*40
|
||||||
|
$GPGLL,4343.66623,N,01023.53792,E,225615.00,A,A*63
|
||||||
|
$GPRMC,225616.00,A,4343.66610,N,01023.53791,E,0.413,,051125,,,A*7E
|
||||||
|
$GPVTG,,T,,M,0.413,N,0.764,K,A*20
|
||||||
|
$GPGGA,225616.00,4343.66610,N,01023.53791,E,1,05,2.87,2.7,M,46.3,M,,*5A
|
||||||
|
$GPGSA,A,3,26,16,08,27,10,,,,,,,,4.39,2.87,3.33*0D
|
||||||
|
$GPGSV,3,1,11,02,17,255,22,07,07,310,,08,38,302,21,10,59,141,37*73
|
||||||
|
$GPGSV,3,2,11,15,08,041,,16,58,207,32,18,26,059,,23,49,064,*70
|
||||||
|
$GPGSV,3,3,11,26,26,180,30,27,72,320,14,30,00,334,*40
|
||||||
|
$GPGLL,4343.66610,N,01023.53791,E,225616.00,A,A*63
|
||||||
|
$GPRMC,225617.00,A,4343.66599,N,01023.53791,E,0.429,,051125,,,A*74
|
||||||
|
$GPVTG,,T,,M,0.429,N,0.795,K,A*27
|
||||||
|
$GPGGA,225617.00,4343.66599,N,01023.53791,E,1,05,2.87,3.2,M,46.3,M,,*5D
|
||||||
|
$GPGSA,A,3,26,16,08,27,10,,,,,,,,4.39,2.87,3.33*0D
|
||||||
|
$GPGSV,3,1,11,02,17,255,22,07,07,310,,08,38,302,20,10,59,141,37*72
|
||||||
|
$GPGSV,3,2,11,15,08,041,,16,58,207,32,18,26,059,,23,49,064,*70
|
||||||
|
$GPGSV,3,3,11,26,26,180,29,27,72,320,14,30,00,334,*48
|
||||||
|
$GPGLL,4343.66599,N,01023.53791,E,225617.00,A,A*60
|
||||||
|
$GPRMC,225618.00,A,4343.66557,N,01023.53791,E,0.798,,051125,,,A*70
|
||||||
|
$GPVTG,,T,,M,0.798,N,1.479,K,A*2E
|
||||||
|
$GPGGA,225618.00,4343.66557,N,01023.53791,E,1,05,2.87,4.2,M,46.3,M,,*57
|
||||||
|
$GPGSA,A,3,26,16,08,27,10,,,,,,,,4.39,2.87,3.33*0D
|
||||||
|
$GPGSV,3,1,11,02,17,255,22,07,07,310,,08,38,302,21,10,59,141,37*73
|
||||||
|
$GPGSV,3,2,11,15,08,041,,16,58,207,32,18,26,059,,23,49,064,*70
|
||||||
|
$GPGSV,3,3,11,26,26,180,29,27,72,320,14,30,00,334,*48
|
||||||
|
$GPGLL,4343.66557,N,01023.53791,E,225618.00,A,A*6D
|
||||||
|
$GPRMC,225619.00,A,4343.66561,N,01023.53791,E,0.540,,051125,,,A*73
|
||||||
|
$GPVTG,,T,,M,0.540,N,1.000,K,A*23
|
||||||
|
$GPGGA,225619.00,4343.66561,N,01023.53791,E,1,05,2.87,4.4,M,46.3,M,,*55
|
||||||
|
$GPGSA,A,3,26,16,08,27,10,,,,,,,,4.39,2.87,3.33*0D
|
||||||
|
$GPGSV,3,1,11,02,17,255,22,07,07,310,,08,38,302,21,10,59,141,37*73
|
||||||
|
$GPGSV,3,2,11,15,08,041,,16,58,207,32,18,26,059,,23,49,064,*70
|
||||||
|
$GPGSV,3,3,11,26,26,180,29,27,72,320,14,30,00,334,*48
|
||||||
|
$GPGLL,4343.66561,N,01023.53791,E,225619.00,A,A*69
|
||||||
|
$GPRMC,225620.00,A,4343.66522,N,01023.53795,E,0.933,,051125,,,A*72
|
||||||
|
$GPVTG,,T,,M,0.933,N,1.728,K,A*26
|
||||||
|
$GPGGA,225620.00,4343.66522,N,01023.53795,E,1,05,2.87,5.3,M,46.3,M,,*5A
|
||||||
|
$GPGSA,A,3,26,16,08,27,10,,,,,,,,4.39,2.87,3.33*0D
|
||||||
|
$GPGSV,3,1,11,02,17,255,22,07,07,310,,08,38,302,21,10,59,141,37*73
|
||||||
|
$GPGSV,3,2,11,15,08,041,,16,58,207,32,18,26,059,,23,49,064,*70
|
||||||
|
$GPGSV,3,3,11,26,26,180,29,27,72,320,10,30,00,334,*4C
|
||||||
|
$GPGLL,4343.66522,N,01023.53795,E,225620.00,A,A*60
|
||||||
|
$GPRMC,225621.00,A,4343.66487,N,01023.53795,E,1.055,,051125,,,A*75
|
||||||
|
$GPVTG,,T,,M,1.055,N,1.953,K,A*2C
|
||||||
|
$GPGGA,225621.00,4343.66487,N,01023.53795,E,1,05,2.87,6.1,M,46.3,M,,*54
|
||||||
|
$GPGSA,A,3,26,16,08,27,10,,,,,,,,4.39,2.87,3.33*0D
|
||||||
|
$GPGSV,3,1,11,02,17,255,22,07,07,310,,08,38,302,20,10,59,141,37*72
|
||||||
|
$GPGSV,3,2,11,15,08,041,,16,58,207,32,18,26,059,,23,49,064,*70
|
||||||
|
$GPGSV,3,3,11,26,26,180,29,27,72,320,10,30,00,334,*4C
|
||||||
|
$GPGLL,4343.66487,N,01023.53795,E,225621.00,A,A*6F
|
||||||
|
$GPRMC,225622.00,A,4343.66513,N,01023.53789,E,0.370,,051125,,,A*72
|
||||||
|
$GPVTG,,T,,M,0.370,N,0.685,K,A*2C
|
||||||
|
$GPGGA,225622.00,4343.66513,N,01023.53789,E,1,05,2.87,6.0,M,46.3,M,,*57
|
||||||
|
$GPGSA,A,3,26,16,08,27,10,,,,,,,,4.39,2.87,3.33*0D
|
||||||
|
$GPGSV,3,1,11,02,17,255,23,07,07,310,,08,38,302,20,10,59,141,37*73
|
||||||
|
$GPGSV,3,2,11,15,08,041,,16,58,207,32,18,26,059,,23,49,064,*70
|
||||||
|
$GPGSV,3,3,11,26,26,180,29,27,72,320,10,30,00,334,*4C
|
||||||
|
$GPGLL,4343.66513,N,01023.53789,E,225622.00,A,A*6D
|
||||||
|
$GPRMC,225623.00,A,4343.66506,N,01023.53789,E,0.408,,051125,,,A*7F
|
||||||
|
$GPVTG,,T,,M,0.408,N,0.756,K,A*2B
|
||||||
|
$GPGGA,225623.00,4343.66506,N,01023.53789,E,1,05,2.87,6.4,M,46.3,M,,*56
|
||||||
|
$GPGSA,A,3,26,16,08,27,10,,,,,,,,4.39,2.87,3.33*0D
|
||||||
|
$GPGSV,3,1,11,02,17,255,22,07,07,310,,08,38,302,20,10,59,141,37*72
|
||||||
|
$GPGSV,3,2,11,15,08,041,,16,58,207,31,18,26,059,,23,49,064,*73
|
||||||
|
$GPGSV,3,3,11,26,26,180,29,27,72,320,10,30,00,334,*4C
|
||||||
|
$GPGLL,4343.66506,N,01023.53789,E,225623.00,A,A*68
|
||||||
|
$GPRMC,225624.00,A,4343.66484,N,01023.53794,E,0.697,,051125,,,A*7B
|
||||||
|
$GPVTG,,T,,M,0.697,N,1.291,K,A*20
|
||||||
|
$GPGGA,225624.00,4343.66484,N,01023.53794,E,1,05,2.87,6.8,M,46.3,M,,*5A
|
||||||
|
$GPGSA,A,3,26,16,08,27,10,,,,,,,,4.39,2.87,3.33*0D
|
||||||
|
$GPGSV,3,1,11,02,17,255,23,07,07,310,,08,38,302,21,10,59,141,36*73
|
||||||
|
$GPGSV,3,2,11,15,08,041,,16,58,207,32,18,26,059,,23,49,064,*70
|
||||||
|
$GPGSV,3,3,11,26,26,180,29,27,72,320,10,30,00,334,*4C
|
||||||
|
$GPGLL,4343.66484,N,01023.53794,E,225624.00,A,A*68
|
||||||
|
$GPRMC,225625.00,A,4343.66465,N,01023.53798,E,0.752,,051125,,,A*71
|
||||||
|
$GPVTG,,T,,M,0.752,N,1.393,K,A*2B
|
||||||
|
$GPGGA,225625.00,4343.66465,N,01023.53798,E,1,05,2.87,7.1,M,46.3,M,,*50
|
||||||
|
$GPGSA,A,3,26,16,08,27,10,,,,,,,,4.39,2.87,3.33*0D
|
||||||
|
$GPGSV,3,1,11,02,17,255,23,07,07,310,,08,38,302,21,10,59,141,36*73
|
||||||
|
$GPGSV,3,2,11,15,08,041,,16,58,207,32,18,26,059,,23,49,064,*70
|
||||||
|
$GPGSV,3,3,11,26,26,180,30,27,72,320,10,30,00,334,*44
|
||||||
|
$GPGLL,4343.66465,N,01023.53798,E,225625.00,A,A*6A
|
||||||
|
$GPRMC,225626.00,A,4343.66451,N,01023.53801,E,0.634,,051125,,,A*7B
|
||||||
|
$GPVTG,,T,,M,0.634,N,1.175,K,A*20
|
||||||
|
$GPGGA,225626.00,4343.66451,N,01023.53801,E,1,05,2.87,7.5,M,46.3,M,,*5F
|
||||||
|
$GPGSA,A,3,26,16,08,27,10,,,,,,,,4.39,2.87,3.33*0D
|
||||||
|
$GPGSV,3,1,11,02,17,255,22,07,07,310,,08,38,302,22,10,59,141,37*70
|
||||||
|
$GPGSV,3,2,11,15,08,041,,16,58,207,32,18,26,059,,23,49,064,*70
|
||||||
|
$GPGSV,3,3,11,26,26,180,30,27,72,320,13,30,00,334,*47
|
||||||
|
$GPGLL,4343.66451,N,01023.53801,E,225626.00,A,A*61
|
||||||
|
$GPRMC,225627.00,A,4343.66421,N,01023.53806,E,0.784,,051125,,,A*70
|
||||||
|
$GPVTG,,T,,M,0.784,N,1.452,K,A*2A
|
||||||
|
$GPGGA,225627.00,4343.66421,N,01023.53806,E,1,05,2.87,8.1,M,46.3,M,,*55
|
||||||
|
$GPGSA,A,3,26,16,08,27,10,,,,,,,,4.39,2.87,3.33*0D
|
||||||
|
$GPGSV,3,1,11,02,17,255,23,07,07,310,,08,38,302,22,10,59,141,36*70
|
||||||
|
$GPGSV,3,2,11,15,08,041,,16,58,207,31,18,26,059,,23,49,064,*73
|
||||||
|
$GPGSV,3,3,11,26,26,180,30,27,72,320,13,30,00,334,*47
|
||||||
|
$GPGLL,4343.66421,N,01023.53806,E,225627.00,A,A*60
|
||||||
|
$GPRMC,225628.00,A,4343.66406,N,01023.53808,E,0.715,,051125,,,A*7C
|
||||||
|
$GPVTG,,T,,M,0.715,N,1.324,K,A*24
|
||||||
|
$GPGGA,225628.00,4343.66406,N,01023.53808,E,1,05,2.87,8.3,M,46.3,M,,*53
|
||||||
|
$GPGSA,A,3,26,16,08,27,10,,,,,,,,4.39,2.87,3.33*0D
|
||||||
|
$GPGSV,3,1,11,02,17,255,23,07,07,310,,08,38,302,22,10,59,141,37*71
|
||||||
|
$GPGSV,3,2,11,15,08,041,,16,58,207,32,18,26,059,,23,49,064,*70
|
||||||
|
$GPGSV,3,3,11,26,26,180,30,27,72,320,13,30,00,334,*47
|
||||||
|
$GPGLL,4343.66406,N,01023.53808,E,225628.00,A,A*64
|
||||||
|
$GPRMC,225629.00,A,4343.66383,N,01023.53813,E,0.660,,051125,,,A*7E
|
||||||
|
$GPVTG,,T,,M,0.660,N,1.223,K,A*21
|
||||||
|
$GPGGA,225629.00,4343.66383,N,01023.53813,E,1,05,2.87,8.3,M,46.3,M,,*52
|
||||||
|
$GPGSA,A,3,26,16,08,27,10,,,,,,,,4.39,2.87,3.33*0D
|
||||||
|
$GPGSV,3,1,11,02,17,255,23,07,07,310,,08,38,302,21,10,59,141,37*72
|
||||||
|
$GPGSV,3,2,11,15,08,041,,16,58,207,32,18,26,059,,23,49,064,*70
|
||||||
|
$GPGSV,3,3,11,26,26,180,29,27,72,320,13,30,00,334,*4F
|
||||||
|
$GPGLL,4343.66383,N,01023.53813,E,225629.00,A,A*65
|
||||||
|
$GPRMC,225630.00,A,4343.66394,N,01023.53814,E,0.163,,051125,,,A*73
|
||||||
|
$GPVTG,,T,,M,0.163,N,0.301,K,A*25
|
||||||
|
$GPGGA,225630.00,4343.66394,N,01023.53814,E,1,05,2.87,8.2,M,46.3,M,,*5A
|
||||||
|
$GPGSA,A,3,26,16,08,27,10,,,,,,,,4.39,2.87,3.32*0C
|
||||||
|
$GPGSV,3,1,11,02,17,255,21,07,07,310,,08,38,302,20,10,59,141,36*70
|
||||||
|
$GPGSV,3,2,11,15,08,041,,16,58,207,31,18,26,059,,23,49,064,*73
|
||||||
|
$GPGSV,3,3,11,26,26,180,29,27,72,320,13,30,00,334,*4F
|
||||||
|
$GPGLL,4343.66394,N,01023.53814,E,225630.00,A,A*6C
|
||||||
|
$GPRMC,225631.00,A,4343.66411,N,01023.53789,E,0.514,,051125,,,A*77
|
||||||
|
$GPVTG,,T,,M,0.514,N,0.952,K,A*2D
|
||||||
|
$GPGGA,225631.00,4343.66411,N,01023.53789,E,1,05,2.87,7.9,M,46.3,M,,*5E
|
||||||
|
$GPGSA,A,3,26,16,08,27,10,,,,,,,,4.39,2.87,3.32*0C
|
||||||
|
$GPGSV,3,1,11,02,17,255,21,07,07,310,,08,38,302,21,10,59,141,34*73
|
||||||
|
$GPGSV,3,2,11,15,08,041,,16,58,207,23,18,26,059,,23,49,064,*70
|
||||||
|
$GPGSV,3,3,11,26,26,180,28,27,72,320,13,30,00,334,*4E
|
||||||
|
$GPGLL,4343.66411,N,01023.53789,E,225631.00,A,A*6C
|
||||||
|
$GPRMC,225632.00,A,4343.66427,N,01023.53775,E,0.426,,051125,,,A*72
|
||||||
|
$GPVTG,,T,,M,0.426,N,0.789,K,A*25
|
||||||
|
$GPGGA,225632.00,4343.66427,N,01023.53775,E,1,04,2.93,8.0,M,46.3,M,,*59
|
||||||
|
$GPGSA,A,3,26,16,08,10,,,,,,,,,4.56,2.93,3.50*01
|
||||||
|
$GPGSV,3,1,11,02,17,255,22,07,07,310,,08,38,302,22,10,59,141,33*74
|
||||||
|
$GPGSV,3,2,11,15,08,041,,16,58,207,23,18,26,059,,23,49,064,*70
|
||||||
|
$GPGSV,3,3,11,26,26,180,29,27,72,320,06,30,00,334,*4B
|
||||||
|
$GPGLL,4343.66427,N,01023.53775,E,225632.00,A,A*69
|
||||||
166
src/gps.cpp
Normal file
166
src/gps.cpp
Normal file
@ -0,0 +1,166 @@
|
|||||||
|
#include <stdlib.h>
|
||||||
|
#include "gps.h"
|
||||||
|
|
||||||
|
#define DEBUG(x) {int i=10;do{Serial.println(x);delay(100);}while(--i>0);Serial.println("IT'S OK NOW");}
|
||||||
|
|
||||||
|
// read the port and put the characters into the field_buffer
|
||||||
|
bool GPSSerial::read_field()
|
||||||
|
{
|
||||||
|
while (port->available() > 0) {
|
||||||
|
int c = port->read();
|
||||||
|
if (c < 0) return false;
|
||||||
|
|
||||||
|
switch (c) {
|
||||||
|
case '*': // end of payload, start of checksum
|
||||||
|
case ',': // end of a field
|
||||||
|
field_buffer[field_len] = '\0';
|
||||||
|
return true;
|
||||||
|
case '\r': // also the end of a field but wait for the next character
|
||||||
|
while(port->available() <= 0) delay(1);
|
||||||
|
c = port->read();
|
||||||
|
// c could be <0 or not '\n' but we just don't care :p
|
||||||
|
field_buffer[field_len] = '\0';
|
||||||
|
return true;
|
||||||
|
default:
|
||||||
|
field_buffer[field_len++] = (char)c;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void GPSSerial::update_checksum()
|
||||||
|
{
|
||||||
|
for (int i = 0; i < field_len && field_buffer[i] != '\0'; i++) {
|
||||||
|
checksum ^= field_buffer[i];
|
||||||
|
}
|
||||||
|
checksum ^= ',';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* Parse NMEA messages from serial communication, filling the GPSData structure.
|
||||||
|
* Since the arduino framework controls serial ports via interrupt the only way
|
||||||
|
* to do "async" operations on serial is through polling and internal state.
|
||||||
|
* Returns true when the data is ready, false otherwise.
|
||||||
|
*/
|
||||||
|
bool GPSSerial::is_data_ready(void)
|
||||||
|
{
|
||||||
|
bool done = false;
|
||||||
|
while (read_field() && !done) {
|
||||||
|
// we only care about the GGA message, since it contains all the information
|
||||||
|
// needed
|
||||||
|
switch (field) {
|
||||||
|
case HEADER: // waiting for the header
|
||||||
|
// we only care about GPGGA messages
|
||||||
|
if (strcmp(field_buffer, "$GPGGA") == 0) {
|
||||||
|
checksum = '$';
|
||||||
|
update_checksum();
|
||||||
|
field = TIME; // move to the next field
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case TIME:
|
||||||
|
// TIME field is ignored
|
||||||
|
update_checksum();
|
||||||
|
field = LATITUDE;
|
||||||
|
break;
|
||||||
|
case LATITUDE:
|
||||||
|
{
|
||||||
|
// the first two characters are in degrees
|
||||||
|
char x[3] = {field_buffer[0], field_buffer[1], 0};
|
||||||
|
float degrees = strtof(x, NULL);
|
||||||
|
// all other characters are in minutes
|
||||||
|
float minutes = strtof(&field_buffer[2], NULL);
|
||||||
|
data.latitude = degrees + minutes / 60.0;
|
||||||
|
}
|
||||||
|
update_checksum();
|
||||||
|
field = LAT_INDICATOR;
|
||||||
|
break;
|
||||||
|
case LAT_INDICATOR:
|
||||||
|
if (field_buffer[0] == 'N') {
|
||||||
|
// Do nothing
|
||||||
|
} else if (field_buffer[0] == 'S') {
|
||||||
|
data.latitude = -data.latitude;
|
||||||
|
}
|
||||||
|
update_checksum();
|
||||||
|
field = LONGITUDE;
|
||||||
|
break;
|
||||||
|
case LONGITUDE:
|
||||||
|
{
|
||||||
|
// the first three characters are in degrees
|
||||||
|
char x[4] = {field_buffer[0], field_buffer[1], field_buffer[2], 0};
|
||||||
|
float degrees = strtof(x, NULL);
|
||||||
|
// all other characters are in minutes
|
||||||
|
float minutes = strtof(&field_buffer[3], NULL);
|
||||||
|
data.longitude = degrees + minutes / 60.0;
|
||||||
|
}
|
||||||
|
update_checksum();
|
||||||
|
field = LONG_INDICATOR;
|
||||||
|
break;
|
||||||
|
case LONG_INDICATOR:
|
||||||
|
if (field_buffer[0] == 'E') {
|
||||||
|
// Do nothing
|
||||||
|
} else if (field_buffer[0] == 'W') {
|
||||||
|
data.longitude = -data.longitude;
|
||||||
|
}
|
||||||
|
update_checksum();
|
||||||
|
field = FIX_STATUS;
|
||||||
|
break;
|
||||||
|
case FIX_STATUS:
|
||||||
|
// FIX_STATUS is ignored
|
||||||
|
update_checksum();
|
||||||
|
field = SAT_USED;
|
||||||
|
break;
|
||||||
|
case SAT_USED:
|
||||||
|
// SAT_USED is ignored
|
||||||
|
update_checksum();
|
||||||
|
field = HDOP;
|
||||||
|
break;
|
||||||
|
case HDOP:
|
||||||
|
// HDOP is ignored
|
||||||
|
update_checksum();
|
||||||
|
field = ALTITUDE;
|
||||||
|
break;
|
||||||
|
case ALTITUDE:
|
||||||
|
data.altitude = int(round(strtof(field_buffer, NULL)));
|
||||||
|
update_checksum();
|
||||||
|
field = ALT_UNIT;
|
||||||
|
break;
|
||||||
|
case ALT_UNIT:
|
||||||
|
// ALT_UNIT is always "m"
|
||||||
|
update_checksum();
|
||||||
|
field = ALTREF;
|
||||||
|
break;
|
||||||
|
case ALTREF:
|
||||||
|
update_checksum();
|
||||||
|
field = ALTREF_UNIT;
|
||||||
|
break;
|
||||||
|
case ALTREF_UNIT:
|
||||||
|
update_checksum();
|
||||||
|
field = DIFFAGE;
|
||||||
|
break;
|
||||||
|
case DIFFAGE:
|
||||||
|
update_checksum();
|
||||||
|
field = DIFFSTATION;
|
||||||
|
break;
|
||||||
|
case DIFFSTATION:
|
||||||
|
update_checksum();
|
||||||
|
field = CHECKSUM;
|
||||||
|
break;
|
||||||
|
case CHECKSUM:
|
||||||
|
{
|
||||||
|
checksum ^= ',';
|
||||||
|
unsigned char ck = strtol(field_buffer, NULL, 16);
|
||||||
|
if (ck == checksum) {
|
||||||
|
done = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
checksum = 0;
|
||||||
|
field = HEADER;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
// done handling the field, reset the buffer
|
||||||
|
field_len = 0;
|
||||||
|
}
|
||||||
|
return done;
|
||||||
|
}
|
||||||
41
src/main.cpp
Normal file
41
src/main.cpp
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
/*
|
||||||
|
Ublox NEO-6M module test for pi pico
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <Arduino.h>
|
||||||
|
#include "gps.h"
|
||||||
|
|
||||||
|
|
||||||
|
#define LOCKUP(x) do{Serial.println(x);delay(1000);}while(true)
|
||||||
|
|
||||||
|
#define UBLOX_RX_PIN 13
|
||||||
|
#define UBLOX_TX_PIN 12
|
||||||
|
|
||||||
|
GPSSerial gps(&Serial1);
|
||||||
|
|
||||||
|
void setup()
|
||||||
|
{
|
||||||
|
Serial.begin(9600);
|
||||||
|
|
||||||
|
// ublox serial
|
||||||
|
Serial1.setTX(UBLOX_TX_PIN);
|
||||||
|
Serial1.setRX(UBLOX_RX_PIN);
|
||||||
|
Serial1.begin(9600);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void loop()
|
||||||
|
{
|
||||||
|
static GPSData data;
|
||||||
|
if (gps.is_data_ready()) {
|
||||||
|
data = gps.data;
|
||||||
|
|
||||||
|
Serial.print("latitude: ");
|
||||||
|
Serial.println(data.latitude, 10);
|
||||||
|
Serial.print("longitude: ");
|
||||||
|
Serial.println(data.longitude, 10);
|
||||||
|
Serial.print("altitude: ");
|
||||||
|
Serial.println(data.altitude);
|
||||||
|
Serial.print("\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
11
test/README
Normal file
11
test/README
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
|
||||||
|
This directory is intended for PlatformIO Test Runner and project tests.
|
||||||
|
|
||||||
|
Unit Testing is a software testing method by which individual units of
|
||||||
|
source code, sets of one or more MCU program modules together with associated
|
||||||
|
control data, usage procedures, and operating procedures, are tested to
|
||||||
|
determine whether they are fit for use. Unit testing finds problems early
|
||||||
|
in the development cycle.
|
||||||
|
|
||||||
|
More information about PlatformIO Unit Testing:
|
||||||
|
- https://docs.platformio.org/en/latest/advanced/unit-testing/index.html
|
||||||
Loading…
x
Reference in New Issue
Block a user