Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Garmin: Fix Reporting of Sensor Count. #64

Merged
merged 1 commit into from
Jun 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/field-cache.c
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,9 @@ dc_field_get(dc_field_cache_t *cache, dc_field_type_t type, unsigned int flags,
case DC_FIELD_AVGDEPTH:
return DC_FIELD_VALUE(*cache, value, AVGDEPTH);
case DC_FIELD_GASMIX_COUNT:
case DC_FIELD_TANK_COUNT:
return DC_FIELD_VALUE(*cache, value, GASMIX_COUNT);
case DC_FIELD_TANK_COUNT:
return DC_FIELD_VALUE(*cache, value, TANK_COUNT);
case DC_FIELD_GASMIX:
if (flags >= MAXGASES)
break;
Expand Down
1 change: 1 addition & 0 deletions src/field-cache.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ typedef struct dc_field_cache {
double ATMOSPHERIC;
dc_divemode_t DIVEMODE;
unsigned int GASMIX_COUNT;
unsigned int TANK_COUNT;
dc_salinity_t SALINITY;
dc_gasmix_t GASMIX[MAXGASES];

Expand Down
4 changes: 2 additions & 2 deletions src/garmin_parser.c
Original file line number Diff line number Diff line change
Expand Up @@ -1696,8 +1696,8 @@ garmin_parser_set_data (garmin_parser_t *garmin, const unsigned char *data, unsi
//
// There's no way to match them up unless they are an identity
// mapping, so having two different ones doesn't actually work.
if (garmin->dive.nr_sensor > garmin->cache.GASMIX_COUNT)
DC_ASSIGN_FIELD(garmin->cache, GASMIX_COUNT, garmin->dive.nr_sensor);
if (garmin->dive.nr_sensor > garmin->cache.TANK_COUNT)
DC_ASSIGN_FIELD(garmin->cache, TANK_COUNT, garmin->dive.nr_sensor);

for (int i = 0; i < garmin->dive.nr_sensor; i++) {
static const char *name[] = { "Sensor 1", "Sensor 2", "Sensor 3", "Sensor 4", "Sensor 5" };
Expand Down
Loading