mirror of
https://github.com/subsurface/subsurface.git
synced 2025-01-31 20:13:23 +00:00
Extract some useful extra data from Uemis SDA
This is just a proof of concept for this patch series, mainly designed to show how the extra data would be used. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
45251ec724
commit
df0057d262
1 changed files with 17 additions and 1 deletions
18
uemis.c
18
uemis.c
|
@ -293,9 +293,11 @@ void uemis_parse_divelog_binary(char *base64, void *datap)
|
|||
struct divecomputer *dc = &dive->dc;
|
||||
int template, gasoffset;
|
||||
int active = 0;
|
||||
char version[5];
|
||||
|
||||
datalen = uemis_convert_base64(base64, &data);
|
||||
|
||||
snprintf(version, sizeof(version), "%1u.%02u", data[18], data[17]);
|
||||
add_extra_data(dc, "software_version", version);
|
||||
dive->dc.airtemp.mkelvin = C_to_mkelvin((*(uint16_t *)(data + 45)) / 10.0);
|
||||
dive->dc.surface_pressure.mbar = *(uint16_t *)(data + 43);
|
||||
if (*(uint8_t *)(data + 19))
|
||||
|
@ -366,5 +368,19 @@ void uemis_parse_divelog_binary(char *base64, void *datap)
|
|||
}
|
||||
if (sample)
|
||||
dive->dc.duration.seconds = sample->time.seconds - 1;
|
||||
|
||||
/* get data from the footer */
|
||||
char buffer[24];
|
||||
snprintf(buffer, sizeof(buffer), "%d",*(uint16_t *)(data + i + 35));
|
||||
add_extra_data(dc, "main battery after dive", buffer);
|
||||
snprintf(buffer, sizeof(buffer), "%0u:%02u", FRACTION(*(uint16_t *)(data + i + 24), 60));
|
||||
add_extra_data(dc, "no fly time", buffer);
|
||||
snprintf(buffer, sizeof(buffer), "%0u:%02u", FRACTION(*(uint16_t *)(data + i + 26), 60));
|
||||
add_extra_data(dc, "no dive time", buffer);
|
||||
snprintf(buffer, sizeof(buffer), "%0u:%02u", FRACTION(*(uint16_t *)(data + i + 28), 60));
|
||||
add_extra_data(dc, "desat time", buffer);
|
||||
snprintf(buffer, sizeof(buffer), "%u",*(uint16_t *)(data + i + 30));
|
||||
add_extra_data(dc, "allowed altitude", buffer);
|
||||
|
||||
return;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue