| Line | Branch | Decision | Exec | Source |
|---|---|---|---|---|
| 1 | /** | |||
| 2 | * | |||
| 3 | * https://github.com/wdalmut/libgps/tree/develop/src | |||
| 4 | * | |||
| 5 | */ | |||
| 6 | ||||
| 7 | #pragma once | |||
| 8 | ||||
| 9 | #include "rusefi_types.h" | |||
| 10 | ||||
| 11 | #define GPS_MAX_STRING 256 | |||
| 12 | ||||
| 13 | typedef enum { | |||
| 14 | NMEA_UNKNOWN = 0x00, | |||
| 15 | NMEA_GPRMC = 0x01, | |||
| 16 | NMEA_GPGGA = 0x02 | |||
| 17 | } nmea_message_type; | |||
| 18 | ||||
| 19 | #define _EMPTY 0x00 | |||
| 20 | #define NMEA_GPRMC_STR "$GPRMC" | |||
| 21 | #define NMEA_GPGGA_STR "$GPGGA" | |||
| 22 | #define _COMPLETED 0x03 | |||
| 23 | ||||
| 24 | #define NMEA_CHECKSUM_ERR 0x80 | |||
| 25 | #define NMEA_MESSAGE_ERR 0xC0 | |||
| 26 | ||||
| 27 | struct GPSlocation { | |||
| 28 | float latitude; | |||
| 29 | float longitude; | |||
| 30 | float speed; | |||
| 31 | float altitude; | |||
| 32 | float course; | |||
| 33 | efidatetime_t time; | |||
| 34 | nmea_message_type type; | |||
| 35 | int quality; | |||
| 36 | int satellites; | |||
| 37 | char lat; // Northing Indicator N=North, S=South | |||
| 38 | char lon; // Easting Indicator E=East, W=West | |||
| 39 | }; | |||
| 40 | typedef struct GPSlocation loc_t; | |||
| 41 | ||||
| 42 | nmea_message_type nmea_get_message_type(const char *); | |||
| 43 | int nmea_valid_checksum(const char *); | |||
| 44 | ||||
| 45 | ||||
| 46 | void gps_location(loc_t *, char const * const); | |||
| 47 | ||||
| 48 | 18 | static int str2int(const char * a, const int len) { | ||
| 49 | 18 | int i = 0, k = 0; | ||
| 50 |
2/2✓ Branch 0 taken 36 times.
✓ Branch 1 taken 18 times.
|
2/2✓ Decision 'true' taken 36 times.
✓ Decision 'false' taken 18 times.
|
54 | while (i < len) { |
| 51 | 36 | k = (k << 3) + (k << 1) + (*a) - '0'; | ||
| 52 | 36 | a++; | ||
| 53 | 36 | i++; | ||
| 54 | } | |||
| 55 | 18 | return k; | ||
| 56 | } | |||
| 57 |