Skip to content

Commit 5f7686f

Browse files
committed
Heinrichs Weikamp: Add Placeholder for GPS Coordinates on OSTC5
Add a placeholder for the yet to be added GPS coordinates on OSTC5. This fixes the misalignment of the parsed data when the log was generated by firmware with GPS support. Signed-off-by: Michael Keller <[email protected]>
1 parent 4a20e1e commit 5f7686f

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

src/hw_ostc_parser.c

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,11 @@ typedef struct hw_ostc_parser_t {
153153
bool scrubber_warning_reported;
154154
} hw_ostc_parser_t;
155155

156+
typedef union {
157+
unsigned int intval;
158+
float floatval;
159+
} coordinate_value_t;
160+
156161
static dc_status_t hw_ostc_parser_get_datetime (dc_parser_t *abstract, dc_datetime_t *datetime);
157162
static dc_status_t hw_ostc_parser_get_field (dc_parser_t *abstract, dc_field_type_t type, unsigned int flags, void *value);
158163
static dc_status_t hw_ostc_parser_samples_foreach (dc_parser_t *abstract, dc_sample_callback_t callback, void *userdata);
@@ -1203,6 +1208,24 @@ hw_ostc_parser_internal_foreach (hw_ostc_parser_t *parser, dc_sample_callback_t
12031208
length -= 2;
12041209
}
12051210

1211+
// GNSS position update (placeholder for now)
1212+
if (events & 0x0400) {
1213+
if (length < 8) {
1214+
ERROR (abstract->context, "Buffer underflow detected!");
1215+
return DC_STATUS_DATAFORMAT;
1216+
}
1217+
1218+
coordinate_value_t lon;
1219+
lon.intval = (float)array_uint32_le(data + offset); // Longitude
1220+
coordinate_value_t lat;
1221+
lat.intval = (float)array_uint32_le(data + offset + 4); // Latitude
1222+
1223+
INFO(abstract->context, "Received GPS coordinates %f / %f", lat.floatval, lon.floatval);
1224+
1225+
offset += 8;
1226+
length -= 8;
1227+
}
1228+
12061229
// Scrubber state update
12071230
if (events & 0x0800) {
12081231
if (length < 2) {

0 commit comments

Comments
 (0)