Skip to content

Commit 993283d

Browse files
committed
Store the original one based gas mix index
1 parent 323804d commit 993283d

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/hw_ostc_parser.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ typedef struct hw_ostc_layout_t {
104104
} hw_ostc_layout_t;
105105

106106
typedef struct hw_ostc_gasmix_t {
107+
unsigned int id;
107108
unsigned int oxygen;
108109
unsigned int helium;
109110
unsigned int type;
@@ -287,6 +288,7 @@ hw_ostc_parser_cache (hw_ostc_parser_t *parser)
287288
initial = data[31];
288289
}
289290
for (unsigned int i = 0; i < ngasmixes; ++i) {
291+
gasmix[i].id = i + 1;
290292
gasmix[i].oxygen = data[25 + 2 * i];
291293
gasmix[i].helium = 0;
292294
gasmix[i].type = 0;
@@ -297,6 +299,7 @@ hw_ostc_parser_cache (hw_ostc_parser_t *parser)
297299
} else if (version == 0x23 || version == 0x24) {
298300
ngasmixes = 5;
299301
for (unsigned int i = 0; i < ngasmixes; ++i) {
302+
gasmix[i].id = i + 1;
300303
gasmix[i].oxygen = data[28 + 4 * i + 0];
301304
gasmix[i].helium = data[28 + 4 * i + 1];
302305
gasmix[i].type = data[28 + 4 * i + 3];
@@ -320,6 +323,7 @@ hw_ostc_parser_cache (hw_ostc_parser_t *parser)
320323
initial = data[31];
321324
}
322325
for (unsigned int i = 0; i < ngasmixes; ++i) {
326+
gasmix[i].id = i + 1;
323327
gasmix[i].oxygen = data[19 + 2 * i + 0];
324328
gasmix[i].helium = data[19 + 2 * i + 1];
325329
gasmix[i].type = 0;
@@ -387,6 +391,7 @@ hw_ostc_parser_create_internal (dc_parser_t **out, dc_context_t *context, const
387391
parser->initial_setpoint = 0;
388392
parser->initial_cns = 0;
389393
for (unsigned int i = 0; i < NGASMIXES; ++i) {
394+
parser->gasmix[i].id = 0;
390395
parser->gasmix[i].oxygen = 0;
391396
parser->gasmix[i].helium = 0;
392397
parser->gasmix[i].type = 0;
@@ -902,6 +907,7 @@ hw_ostc_parser_samples_foreach (dc_parser_t *abstract, dc_sample_callback_t call
902907
ERROR (abstract->context, "Maximum number of gas mixes reached.");
903908
return DC_STATUS_NOMEMORY;
904909
}
910+
parser->gasmix[idx].id = 0;
905911
parser->gasmix[idx].oxygen = o2;
906912
parser->gasmix[idx].helium = he;
907913
parser->gasmix[idx].type = 0;
@@ -969,6 +975,7 @@ hw_ostc_parser_samples_foreach (dc_parser_t *abstract, dc_sample_callback_t call
969975
ERROR (abstract->context, "Maximum number of gas mixes reached.");
970976
return DC_STATUS_NOMEMORY;
971977
}
978+
parser->gasmix[idx].id = 0;
972979
parser->gasmix[idx].oxygen = o2;
973980
parser->gasmix[idx].helium = he;
974981
parser->gasmix[idx].type = 0;
@@ -1105,6 +1112,7 @@ hw_ostc_parser_samples_foreach (dc_parser_t *abstract, dc_sample_callback_t call
11051112
ERROR (abstract->context, "Maximum number of gas mixes reached.");
11061113
return DC_STATUS_NOMEMORY;
11071114
}
1115+
parser->gasmix[idx].id = 0;
11081116
parser->gasmix[idx].oxygen = o2;
11091117
parser->gasmix[idx].helium = he;
11101118
parser->gasmix[idx].type = 0;

0 commit comments

Comments
 (0)