Skip to content

Commit 18c3074

Browse files
jefdriesenmikeller
authored andcommitted
Link the tank to the corresponding gas mix
The ID_GAS_TRANSMITTER record reports a tank pressure from a transmitter linked to a gas mix. Use this information to link the tank to the corresponding gas mix.
1 parent b9f7745 commit 18c3074

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/halcyon_symbios_parser.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ typedef struct halcyon_symbios_tank_t {
7575
unsigned int id;
7676
unsigned int beginpressure;
7777
unsigned int endpressure;
78+
unsigned int gasmix;
7879
dc_usage_t usage;
7980
} halcyon_symbios_tank_t;
8081

@@ -150,6 +151,7 @@ halcyon_symbios_parser_create (dc_parser_t **out, dc_context_t *context, const u
150151
parser->tank[i].id = 0;
151152
parser->tank[i].beginpressure = 0;
152153
parser->tank[i].endpressure = 0;
154+
parser->tank[i].gasmix = DC_GASMIX_UNKNOWN;
153155
parser->tank[i].usage = DC_USAGE_NONE;
154156
}
155157

@@ -251,8 +253,8 @@ halcyon_symbios_parser_get_field (dc_parser_t *abstract, dc_field_type_t type, u
251253
tank->workpressure = 0.0;
252254
tank->beginpressure = parser->tank[flags].beginpressure / 10.0;
253255
tank->endpressure = parser->tank[flags].endpressure / 10.0;
256+
tank->gasmix = parser->tank[flags].gasmix;
254257
tank->usage = parser->tank[flags].usage;
255-
tank->gasmix = DC_GASMIX_UNKNOWN;
256258
break;
257259
case DC_FIELD_DECOMODEL:
258260
if (parser->gf_lo == UNDEFINED || parser->gf_hi == UNDEFINED)
@@ -318,6 +320,7 @@ halcyon_symbios_parser_samples_foreach (dc_parser_t *abstract, dc_sample_callbac
318320
halcyon_symbios_gasmix_t gasmix[NGASMIXES] = {0};
319321
halcyon_symbios_tank_t tank[NTANKS] = {0};
320322
unsigned int gasmix_id_previous = UNDEFINED;
323+
unsigned int gasmix_idx = DC_GASMIX_UNKNOWN;
321324
unsigned int tank_id_previous = UNDEFINED;
322325
unsigned int tank_usage_previous = UNDEFINED;
323326
unsigned int tank_idx = UNDEFINED;
@@ -447,6 +450,7 @@ halcyon_symbios_parser_samples_foreach (dc_parser_t *abstract, dc_sample_callbac
447450
sample.gasmix = idx;
448451
if (callback) callback(DC_SAMPLE_GASMIX, &sample, userdata);
449452
gasmix_id_previous = gas_id;
453+
gasmix_idx = idx;
450454
}
451455

452456
if (tank_id_previous != transmitter ||
@@ -469,6 +473,7 @@ halcyon_symbios_parser_samples_foreach (dc_parser_t *abstract, dc_sample_callbac
469473
tank[ntanks].id = transmitter;
470474
tank[ntanks].beginpressure = pressure;
471475
tank[ntanks].endpressure = pressure;
476+
tank[ntanks].gasmix = gasmix_idx;
472477
tank[ntanks].usage = usage;
473478
ntanks++;
474479
}
@@ -572,6 +577,7 @@ halcyon_symbios_parser_samples_foreach (dc_parser_t *abstract, dc_sample_callbac
572577
tank[ntanks].id = serial;
573578
tank[ntanks].beginpressure = pressure;
574579
tank[ntanks].endpressure = pressure;
580+
tank[ntanks].gasmix = DC_GASMIX_UNKNOWN;
575581
tank[ntanks].usage = usage;
576582
ntanks++;
577583
}

0 commit comments

Comments
 (0)