Garmin: Fix Reporting of Sensor Count.
Report the number of tank sensors independently of the number of gasmixes. This fixes an unintuitive error message popping up when importing dives with more sensors than gasmixes. Fixes https://github.com/subsurface/subsurface/issues/4221. Reported-by: @bwong2132 Signed-off-by: Michael Keller <mikeller@042.ch>
This commit is contained in:
parent
9b12e8e638
commit
c7e89eab11
@ -85,8 +85,9 @@ dc_field_get(dc_field_cache_t *cache, dc_field_type_t type, unsigned int flags,
|
|||||||
case DC_FIELD_AVGDEPTH:
|
case DC_FIELD_AVGDEPTH:
|
||||||
return DC_FIELD_VALUE(*cache, value, AVGDEPTH);
|
return DC_FIELD_VALUE(*cache, value, AVGDEPTH);
|
||||||
case DC_FIELD_GASMIX_COUNT:
|
case DC_FIELD_GASMIX_COUNT:
|
||||||
case DC_FIELD_TANK_COUNT:
|
|
||||||
return DC_FIELD_VALUE(*cache, value, GASMIX_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:
|
case DC_FIELD_GASMIX:
|
||||||
if (flags >= MAXGASES)
|
if (flags >= MAXGASES)
|
||||||
break;
|
break;
|
||||||
|
|||||||
@ -14,6 +14,7 @@ typedef struct dc_field_cache {
|
|||||||
double ATMOSPHERIC;
|
double ATMOSPHERIC;
|
||||||
dc_divemode_t DIVEMODE;
|
dc_divemode_t DIVEMODE;
|
||||||
unsigned int GASMIX_COUNT;
|
unsigned int GASMIX_COUNT;
|
||||||
|
unsigned int TANK_COUNT;
|
||||||
dc_salinity_t SALINITY;
|
dc_salinity_t SALINITY;
|
||||||
dc_gasmix_t GASMIX[MAXGASES];
|
dc_gasmix_t GASMIX[MAXGASES];
|
||||||
|
|
||||||
|
|||||||
@ -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
|
// There's no way to match them up unless they are an identity
|
||||||
// mapping, so having two different ones doesn't actually work.
|
// mapping, so having two different ones doesn't actually work.
|
||||||
if (garmin->dive.nr_sensor > garmin->cache.GASMIX_COUNT)
|
if (garmin->dive.nr_sensor > garmin->cache.TANK_COUNT)
|
||||||
DC_ASSIGN_FIELD(garmin->cache, GASMIX_COUNT, garmin->dive.nr_sensor);
|
DC_ASSIGN_FIELD(garmin->cache, TANK_COUNT, garmin->dive.nr_sensor);
|
||||||
|
|
||||||
for (int i = 0; i < garmin->dive.nr_sensor; i++) {
|
for (int i = 0; i < garmin->dive.nr_sensor; i++) {
|
||||||
static const char *name[] = { "Sensor 1", "Sensor 2", "Sensor 3", "Sensor 4", "Sensor 5" };
|
static const char *name[] = { "Sensor 1", "Sensor 2", "Sensor 3", "Sensor 4", "Sensor 5" };
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user