mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Merge pull request #2643 from bstoeger/cylinder4
First steps of cylinder-editing undo
This commit is contained in:
commit
6d187b5f4a
37 changed files with 1335 additions and 795 deletions
|
@ -698,31 +698,6 @@ static void try_to_match_autogroup(const char *name, char *buf)
|
|||
nonmatch("autogroup", name, buf);
|
||||
}
|
||||
|
||||
void add_gas_switch_event(struct dive *dive, struct divecomputer *dc, int seconds, int idx)
|
||||
{
|
||||
/* sanity check so we don't crash */
|
||||
if (idx < 0 || idx >= dive->cylinders.nr) {
|
||||
report_error("Unknown cylinder index: %d", idx);
|
||||
return;
|
||||
}
|
||||
/* The gas switch event format is insane for historical reasons */
|
||||
struct gasmix mix = get_cylinder(dive, idx)->gasmix;
|
||||
int o2 = get_o2(mix);
|
||||
int he = get_he(mix);
|
||||
struct event *ev;
|
||||
int value;
|
||||
|
||||
o2 = (o2 + 5) / 10;
|
||||
he = (he + 5) / 10;
|
||||
value = o2 + (he << 16);
|
||||
|
||||
ev = add_event(dc, seconds, he ? SAMPLE_EVENT_GASCHANGE2 : SAMPLE_EVENT_GASCHANGE, 0, value, "gaschange");
|
||||
if (ev) {
|
||||
ev->gas.index = idx;
|
||||
ev->gas.mix = mix;
|
||||
}
|
||||
}
|
||||
|
||||
static void get_cylinderindex(char *buffer, uint8_t *i, struct parser_state *state)
|
||||
{
|
||||
*i = atoi(buffer);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue