fix: actually default bottom gas to air

If there are no gas mixes returned by libdivecomputer, we need to default to air. The previous commit would have defaulted to pure oxygen.

Signed-off-by: Micha WERLE <micha@michaelwerle.com>
This commit is contained in:
Micha WERLE 2023-11-20 12:22:58 +09:00 committed by Michael Keller
parent 4842344bc1
commit c612641517

View file

@ -123,7 +123,7 @@ static struct gasmix get_deeper_gasmix(struct gasmix a, struct gasmix b)
if (get_o2(a) < get_o2(b)) {
return a;
}
if (get_o2(a) > get_o2(b))
if (get_o2(a) > get_o2(b)) {
return b;
}
return get_he(a) < get_he(b) ? b : a;
@ -161,7 +161,10 @@ static int parse_gasmixes(device_data_t *devdata, struct dive *dive, dc_parser_t
}
}
bool no_volume = true;
struct gasmix bottom_gas = { {1000}, {0} }; /* Default to pure O2 */
struct gasmix bottom_gas = { {1000}, {0} }; /* Default to pure O2, or air if there are no mixes defined */
if (ngases == 0) {
bottom_gas = gasmix_air;
}
clear_cylinder_table(&dive->cylinders);
for (i = 0; i < MAX(ngases, ntanks); i++) {