mirror of
https://github.com/subsurface/subsurface.git
synced 2025-01-31 21:03:23 +00:00
Planner: warn about high pO2
If the user entered part of the plan exceeds a pO2 of 1.6, include a warning about that in the notes. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
90885bfb8e
commit
9cae50acab
1 changed files with 16 additions and 0 deletions
16
planner.c
16
planner.c
|
@ -632,6 +632,22 @@ static void add_plan_to_notes(struct diveplan *diveplan, struct dive *dive, bool
|
|||
}
|
||||
snprintf(buffer + len, sizeof(buffer) - len, translate("gettextFromC", "%.0f%s of %s%s\n"), volume, unit, gasname(&cyl->gasmix), warning);
|
||||
}
|
||||
dp = diveplan->dp;
|
||||
while (dp) {
|
||||
if (dp->time != 0) {
|
||||
int pO2 = depth_to_atm(dp->depth, dive) * dp->gasmix.o2.permille;
|
||||
if (pO2 > 1600) {
|
||||
const char *depth_unit;
|
||||
int decimals;
|
||||
double depth_value = get_depth_units(dp->depth, &decimals, &depth_unit);
|
||||
len = strlen(buffer);
|
||||
snprintf(buffer + len, sizeof(buffer) - len,
|
||||
translate("gettextFromC", "Warning: high pO2 value %.2f at %d:%02u with gas %s at depth %.*f %s"),
|
||||
pO2 / 1000.0, FRACTION(dp->time, 60), gasname(&dp->gasmix), depth_value, decimals, depth_unit);
|
||||
}
|
||||
}
|
||||
dp = dp->next;
|
||||
}
|
||||
dive->notes = strdup(buffer);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue