Skip to content

Commit ecc9e0b

Browse files
committed
Limit the lookup function to the manual gas mixes
Looking up the gasmix by oxygen and helium content is only needed for the manual gas mixes. For gas switches to a fixed gas mix, the index is stored directly in the data.
1 parent 8bfbb94 commit ecc9e0b

File tree

1 file changed

+5
-14
lines changed

1 file changed

+5
-14
lines changed

src/hw_ostc_parser.c

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,6 @@
3737

3838
#define UNDEFINED 0xFFFFFFFF
3939

40-
#define ALL 0
41-
#define FIXED 1
42-
#define MANUAL 2
43-
4440
#define HEADER 1
4541
#define PROFILE 2
4642

@@ -194,15 +190,10 @@ static const hw_ostc_layout_t hw_ostc_layout_ostc3 = {
194190
};
195191

196192
static unsigned int
197-
hw_ostc_find_gasmix (hw_ostc_parser_t *parser, unsigned int o2, unsigned int he, unsigned int dil, unsigned int type)
193+
hw_ostc_find_gasmix_manual (hw_ostc_parser_t *parser, unsigned int o2, unsigned int he, unsigned int dil)
198194
{
199-
unsigned int offset = 0;
195+
unsigned int offset = parser->nfixed;
200196
unsigned int count = parser->ngasmixes;
201-
if (type == FIXED) {
202-
count = parser->nfixed;
203-
} else if (type == MANUAL) {
204-
offset = parser->nfixed;
205-
}
206197

207198
unsigned int i = offset;
208199
while (i < count) {
@@ -899,7 +890,7 @@ hw_ostc_parser_samples_foreach (dc_parser_t *abstract, dc_sample_callback_t call
899890
}
900891
unsigned int o2 = data[offset];
901892
unsigned int he = data[offset + 1];
902-
unsigned int idx = hw_ostc_find_gasmix (parser, o2, he, ccr, MANUAL);
893+
unsigned int idx = hw_ostc_find_gasmix_manual (parser, o2, he, ccr);
903894
if (idx >= parser->ngasmixes) {
904895
if (idx >= NGASMIXES) {
905896
ERROR (abstract->context, "Maximum number of gas mixes reached.");
@@ -964,7 +955,7 @@ hw_ostc_parser_samples_foreach (dc_parser_t *abstract, dc_sample_callback_t call
964955

965956
unsigned int o2 = data[offset];
966957
unsigned int he = data[offset + 1];
967-
unsigned int idx = hw_ostc_find_gasmix (parser, o2, he, 0, MANUAL);
958+
unsigned int idx = hw_ostc_find_gasmix_manual (parser, o2, he, 0);
968959
if (idx >= parser->ngasmixes) {
969960
if (idx >= NGASMIXES) {
970961
ERROR (abstract->context, "Maximum number of gas mixes reached.");
@@ -1099,7 +1090,7 @@ hw_ostc_parser_samples_foreach (dc_parser_t *abstract, dc_sample_callback_t call
10991090

11001091
unsigned int o2 = data[offset];
11011092
unsigned int he = data[offset + 1];
1102-
unsigned int idx = hw_ostc_find_gasmix (parser, o2, he, 0, MANUAL);
1093+
unsigned int idx = hw_ostc_find_gasmix_manual (parser, o2, he, 0);
11031094
if (idx >= parser->ngasmixes) {
11041095
if (idx >= NGASMIXES) {
11051096
ERROR (abstract->context, "Maximum number of gas mixes reached.");

0 commit comments

Comments
 (0)