diff --git a/src/context.c b/src/context.c index 1e77d83..9800eee 100644 --- a/src/context.c +++ b/src/context.c @@ -29,6 +29,7 @@ #include #ifdef _WIN32 +#define WIN32_LEAN_AND_MEAN #define NOGDI #include #endif diff --git a/src/descriptor.c b/src/descriptor.c index 9b02949..9d1efb7 100644 --- a/src/descriptor.c +++ b/src/descriptor.c @@ -344,6 +344,7 @@ static const dc_descriptor_t g_descriptors[] = { {"Shearwater", "Perdix AI", DC_FAMILY_SHEARWATER_PETREL, 6, DC_TRANSPORT_BLE, dc_filter_shearwater}, {"Shearwater", "Nerd 2", DC_FAMILY_SHEARWATER_PETREL, 7, DC_TRANSPORT_BLE, dc_filter_shearwater}, {"Shearwater", "Teric", DC_FAMILY_SHEARWATER_PETREL, 8, DC_TRANSPORT_BLE, dc_filter_shearwater}, + {"Shearwater", "Peregrine", DC_FAMILY_SHEARWATER_PETREL, 9, DC_TRANSPORT_BLE, dc_filter_shearwater}, /* Dive Rite NiTek Q */ {"Dive Rite", "NiTek Q", DC_FAMILY_DIVERITE_NITEKQ, 0, DC_TRANSPORT_SERIAL, NULL}, /* Citizen Hyper Aqualand */ @@ -593,6 +594,7 @@ static int dc_filter_shearwater (dc_transport_t transport, const void *userdata, "NERD 2", "Perdix", "Teric", + "Peregrine", }; if (transport == DC_TRANSPORT_BLUETOOTH || transport == DC_TRANSPORT_BLE) { diff --git a/src/serial_win32.c b/src/serial_win32.c index 8427a25..2b009f0 100644 --- a/src/serial_win32.c +++ b/src/serial_win32.c @@ -21,6 +21,7 @@ #include +#define WIN32_LEAN_AND_MEAN #define NOGDI #include diff --git a/src/shearwater_common.h b/src/shearwater_common.h index 35a0d01..ab795d5 100644 --- a/src/shearwater_common.h +++ b/src/shearwater_common.h @@ -42,6 +42,7 @@ extern "C" { #define PERDIXAI 6 #define NERD2 7 #define TERIC 8 +#define PEREGRINE 9 #define NSTEPS 10000 #define STEP(i,n) ((NSTEPS * (i) + (n) / 2) / (n)) diff --git a/src/shearwater_petrel.c b/src/shearwater_petrel.c index 695bd74..9d03d6e 100644 --- a/src/shearwater_petrel.c +++ b/src/shearwater_petrel.c @@ -244,6 +244,9 @@ shearwater_petrel_device_foreach (dc_device_t *abstract, dc_dive_callback_t call case 0x1F0A: model = TERIC; break; + case 0x1512: + model = PEREGRINE; + break; default: // return a model of 0 which is unknown WARNING (abstract->context, "Unknown hardware type %04x. Assuming Petrel.", hardware); diff --git a/src/shearwater_predator_parser.c b/src/shearwater_predator_parser.c index 1be4383..ee84278 100644 --- a/src/shearwater_predator_parser.c +++ b/src/shearwater_predator_parser.c @@ -55,6 +55,8 @@ #define LOG_RECORD_INFO_EVENT 0x30 #define LOG_RECORD_FINAL 0xFF +#define INFO_EVENT_TAG_LOG 38 + #define SZ_BLOCK 0x80 #define SZ_SAMPLE_PREDATOR 0x10 #define SZ_SAMPLE_PETREL 0x20 @@ -961,6 +963,26 @@ shearwater_predator_parser_samples_foreach (dc_parser_t *abstract, dc_sample_cal sample.temperature = temperature / 10.0; if (callback) callback (DC_SAMPLE_TEMPERATURE, sample, userdata); } + } else if (type == LOG_RECORD_INFO_EVENT) { + unsigned int event = data[offset + 1]; + unsigned int timestamp = array_uint32_be (data + offset + 4); + unsigned int w1 = array_uint32_be (data + offset + 8); + unsigned int w2 = array_uint32_be (data + offset + 12); + + if (event == INFO_EVENT_TAG_LOG) { + // Compass heading + if (w1 != 0xFFFFFFFF) { + sample.bearing = w1; + if (callback) callback (DC_SAMPLE_BEARING, sample, userdata); + } + + // Tag + sample.event.type = SAMPLE_EVENT_BOOKMARK; + sample.event.time = 0; + sample.event.flags = 0; + sample.event.value = w2; + if (callback) callback (DC_SAMPLE_EVENT, sample, userdata); + } } offset += parser->samplesize; diff --git a/src/socket.h b/src/socket.h index e2efa14..bc37095 100644 --- a/src/socket.h +++ b/src/socket.h @@ -23,6 +23,7 @@ #define DC_SOCKET_H #ifdef _WIN32 +#define WIN32_LEAN_AND_MEAN #define NOGDI #include #include diff --git a/src/timer.c b/src/timer.c index 14ccd46..cc17f23 100644 --- a/src/timer.c +++ b/src/timer.c @@ -26,6 +26,7 @@ #include #ifdef _WIN32 +#define WIN32_LEAN_AND_MEAN #define NOGDI #include #else diff --git a/src/usb.c b/src/usb.c index e39bc48..758c604 100644 --- a/src/usb.c +++ b/src/usb.c @@ -28,6 +28,7 @@ #ifdef HAVE_LIBUSB #ifdef _WIN32 +#define WIN32_LEAN_AND_MEAN #define NOGDI #endif #include diff --git a/src/usbhid.c b/src/usbhid.c index 22981b7..9231e64 100644 --- a/src/usbhid.c +++ b/src/usbhid.c @@ -29,6 +29,7 @@ #include #endif #ifdef _WIN32 +#define WIN32_LEAN_AND_MEAN #define NOGDI #include #endif @@ -43,6 +44,7 @@ #if defined(USE_LIBUSB) #ifdef _WIN32 +#define WIN32_LEAN_AND_MEAN #define NOGDI #endif #include