Add support for parsing bookmark events

The bookmark value is a bitfield indicating the type of bookmark:

  1 - Pressed the bookmark button during a dive
  2 - Reset the stopwatch
  4 - Unknown
  8 - Unknown
This commit is contained in:
Greg McLaughlin 2022-11-08 23:52:24 +01:00 committed by Jef Driesen
parent bf93040ab1
commit c2102f62d6

View File

@ -1074,6 +1074,7 @@ mares_iconhd_parser_samples_foreach (dc_parser_t *abstract, dc_sample_callback_t
unsigned int depth = 0, temperature = 0;
unsigned int gasmix = 0, alarms = 0;
unsigned int decostop = 0, decodepth = 0, decotime = 0, tts = 0;
unsigned int bookmark = 0;
if (parser->model == GENIUS || parser->model == HORIZON) {
if (parser->logformat == 1) {
if (!mares_genius_isvalid (data + offset, SDPT_SIZE, SDPT_TYPE)) {
@ -1087,6 +1088,7 @@ mares_iconhd_parser_samples_foreach (dc_parser_t *abstract, dc_sample_callback_t
alarms = array_uint32_le (data + offset + marker + 0x14);
misc = array_uint32_le (data + offset + marker + 0x18);
deco = array_uint32_le (data + offset + marker + 0x1C);
bookmark = (misc >> 2) & 0x0F;
gasmix = (misc >> 6) & 0x0F;
decostop = (misc >> 10) & 0x01;
if (decostop) {
@ -1108,6 +1110,7 @@ mares_iconhd_parser_samples_foreach (dc_parser_t *abstract, dc_sample_callback_t
decotime = array_uint16_le (data + offset + marker + 0x0A);
alarms = array_uint32_le (data + offset + marker + 0x0C);
misc = array_uint32_le (data + offset + marker + 0x14);
bookmark = (misc >> 2) & 0x0F;
gasmix = (misc >> 6) & 0x0F;
decostop = (misc >> 18) & 0x01;
decodepth = (misc >> 19) & 0x7F;
@ -1144,6 +1147,15 @@ mares_iconhd_parser_samples_foreach (dc_parser_t *abstract, dc_sample_callback_t
}
}
// Bookmark
if (bookmark) {
sample.event.type = SAMPLE_EVENT_BOOKMARK;
sample.event.time = 0;
sample.event.flags = 0;
sample.event.value = bookmark;
if (callback) callback (DC_SAMPLE_EVENT, sample, userdata);
}
if (parser->model == GENIUS || parser->model == HORIZON) {
// Deco stop / NDL.
if (decostop) {