Commit graph

80 commits

Author SHA1 Message Date
Dirk Hohndel
89fe2c723f Show tank / nitrox / air consumption information in the info_frame
Even though we go down to an 8pt font the info_frame changes size when the
air info is added. I don't like this but want to see how Linus would like
this resolved before going overboard.

Minor tweaks to the formating (we don't need two decimals when printing
the liters of air consumed).

This patch does NOT remove the plot of the air information in the profile
graph. I think we want to remove that once we like the text where it is,
but I wanted to do one thing at a time.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2011-09-16 15:45:14 -07:00
Linus Torvalds
5804c2970e Support gps coordinates for the location info
Sadly, no way to show them yet.  But it would be nice to let people
enter them (and it would be doubly nice to have a dive computer that
does it at the surface), and then perhaps just do the "point browser at
google maps" thing.

Saving/parsing tested by hand-feeding the location of Enenui (Molokini
Crater) from google maps by hand into my divelog.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-15 18:16:07 -07:00
Linus Torvalds
c6b13fad5a Add divemaster/buddy field and text entry
I have it in some of my notes, and Dirk seems to fill that in too, so
let's just show it, save it, and allow editing of it..

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-13 14:58:06 -07:00
Linus Torvalds
42f627b8b1 Libdivecomputer: start actually importing the dive data
So this actually reports the dive data that libdivecomputer generates.
It doesn't import special events etc, but neither do we for the xml
importer.

It is also slow as heck, since it doesn't try to do the "hey, I already
have this dive" logic and always imports everything, but the basics are
definitely there.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-12 13:25:05 -07:00
Linus Torvalds
aa416e3c96 Abstract out dive/sample allocation a bit
We're going to start to want to allocate dives and samples for the
libdivecomputer import too, so let's clean things up a bit for that.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-12 12:56:34 -07:00
Linus Torvalds
afffcdbc0d Avoid using type 'gasmix_t': use 'struct gasmix' instead
libdivecomputer already uses 'gasmix_t' for its own gasmix thing.  I
don't like th eway we step on each others name spaces, but hey, might as
well just use 'struct gasmix' and avoid the typedef.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-12 09:47:55 -07:00
Linus Torvalds
0c4e1697db Be more careful about unit changes
When we change units, we need to flush any currently active dive
information in the old units, and then carefully reload it in the new
units.

Otherwise crazy stuff happens - like having current cylinder working
pressure values that are in PSI because that *used* to be the output
unit, but then interpreting those values as BAR, because we changed the
units.

Also, since we now properly import working pressure from Diving Log,
stop importing the (useless) cylinder description.  The Diving Log
cylinder descriptions are things like "Alu" or "Steel".  We're better
off just making up our own.

Finally, since Diving Log has cylinder size in metric, make sure that we
do the "match standard cylinder sizes" *after* we've done all the
cylinder size conversions to proper units.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-11 15:49:50 -07:00
Linus Torvalds
1cc62d5811 Fix up dive number naming
Use "dive->number" instead of "dive->nr". And make the XML match too.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-11 15:49:17 -07:00
Linus Torvalds
6538e5bba0 Save and restore a "dive number"
Some people want to know how many dives they have under their belt, so
let's save and restore the dive number if it exists.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-11 11:36:33 -07:00
Linus Torvalds
88dc170af6 Declare 'update_dive()' properly
Avoid a compiler warning..

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-10 15:26:51 -07:00
Linus Torvalds
067506038a Rename 'cylinder.c' as 'equipment.c'
Make it about general equipment management, and start hooking up
functions to show new equipment information when changing dives (and to
flush changes to equipment information for the previously active dive).

Nothing is hooked up yet, and it's now showing just one (really big)
cylinder choice, so this is all broken.  But it should make it possible
to at least get somewhere some day.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-09 17:10:17 -07:00
Linus Torvalds
c4d5ebb069 Do output unit conversion in the dive info window too
This should take care of it all, unless I missed some case.

Now we should just save the default units somewhere, and I should do the
divelist update much cleaner (instead of re-doing the divelist entirely,
it should just repaint it - now we lose the highlited dive etc).

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-07 09:35:45 -07:00
Linus Torvalds
05857e0a05 Start "output unit management" support
This doesn't actually *do* anything yet, but it introduces the notion of
output units, and allows you to pick metric or imperial.

Of course, since the output doesn't currently care, the units you pick
are irrelevant.  But just wait..

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-06 19:07:17 -07:00
Nathan Samson
11becb8750 Report errors when opening files
Signed-off-by: Nathan Samson <nathansamson@gmail.com>
2011-09-05 22:15:30 +02:00
Linus Torvalds
5f79a804b9 Sanitize and fix cylinder pressure overview
Doing per-dive cylinder start/end pressures is insane, when we can have
up to eight cylinders.  The cylinder start/end pressure cannot be per
dive, it needs to be per cylinder.

This makes the save format cleaner too, we have all the cylinder data in
just one place.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-05 09:12:54 -07:00
Linus Torvalds
e58fa7b9b5 Parse uemis cylinder data
This is some seriously crazy stuff.  Instead of making sense as a
divelog, the uemis xml makes more sense as a "dive computer settings
dump".

And I guess I can see why they'd do that.  But it makes parsing it just
incredibly annoying.  The thing is more of a "these are the
configurations I support as a dive computer thing" than a "this was the
tank you were diving with".

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-04 14:56:01 -07:00
Linus Torvalds
aab4d593bd Generate date string for the dive list dynamically
.. and sort based on the 'time_t' value itself.

This allows us to use a more compact date format that doesn't need to
sort alphabetically, because sorting by date is always based on the date
value.  So we can use just a two-digit year, and skip the seconds, to
keep the column narrow, while still sorting correctly.

Also, "Depth" is a nice header string, but it is wider than the column
itself, which makes the whole column wider than necessary.  So put the
units in the header instead of in the string, keeping things narrow.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-04 12:19:20 -07:00
Linus Torvalds
0917436729 Add placeholder for cylinder type description
So we don't want to save working pressure, but cylinder type knowledge
would be lovely and useful.  And we can probably make a good initial
guess, or at least let people fill it in later.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-04 11:34:50 -07:00
Linus Torvalds
b176daf6d6 Do better cylinder information management
Instead of just tracking gasmix, track the size and workng pressure of
the cylinder too.

And use "cylinder" instead of "tank" throughout.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-03 20:31:18 -07:00
Linus Torvalds
1e75ceac0d Add various dive fixups, and show pressure (if any) in the plot
Now the dive profile plot *really* needs some units.  The pressure is
just a random line otherwise.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-03 13:19:26 -07:00
Linus Torvalds
5f05173e79 Do a dive de-dup pass
If given multiple dives at the same time, just de-dup the dives.  This
happens when you've dumped the whole dive-computer several times, and
some dives show up in multiple dumps.

When de-duping, try to avoid dropping data.  So if one dive has notes
attached to it, and the other one does not, pick the notes from the dive
that does have them.  Obvious stuff like that.

The sample merge is also written so that it should be possible to merge
two dives. Which we don't actually do yet.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-02 16:40:28 -07:00
Linus Torvalds
22fcef2ec7 Save and parse notes and locations
It's pretty rough, but it seems to work.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-01 19:56:04 -07:00
Linus Torvalds
1155ad3f0f Add ability to 'save' dives
This just generates another xml file.  Don't get me wrong: I still don't
like xml, but this way we can save in the same format we load things
from.  Except the save-format is a *lot* cleaner than the abortion that
is Suunto or libdivecomputer xml.

Don't bother with some crazy xml library crap for saving. Just do it!

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-01 16:27:52 -07:00
Linus Torvalds
d5e42d485e gasmix: stop tracking nitrogen percentages
The only thing you can do with that thing is screw things up (like
libdivecomputer did).  There's no value in tracking the "filler" gas,
since you can always just calculate it from the gases that actually
matter.

So just track Oxygen and Helium - and make sure they have sane values.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-01 16:26:11 -07:00
Linus Torvalds
9741913124 Start parsing gas mixes
The suunto xml is just completely crazy.  What's the helium percentage
companion to "o2pct"? Would it be "hepct"? No. It's "hepct_0".

Ok, so they didn't number the first o2pct, which could be seen as sane:
that's the only mix value that should always exist.  And they clearly
started their indexing with 0.  So with multiple mixes, you'd then
expect "o2pct_1" and "hepct_1", right?

Wrong! Because XML people are crazy, the second O2 mix percentage is
obviously "o2pct_2".  So the O2 percentages are one-based, with an
implicit one.  But the He percentages are zero-based with an explicit
zero.  So the second mix is "o2pct_2" and "hepct_1".

I'd like to ask what drugs Suunto people are on, but hey, it's a Finnish
company.  No need to ask.  Vodka explains everything.  LOTS AND LOTS OF
VODKA.

In comparison, the libdivecomputer output is nice and sane, and uses a
'gasmix' node.  Of course, now we have so many different XML nesting
nodes to check that I just made it an array of different noces.  That
also allows me to mark the suunto case, so that we only do the "check
for crazy alcoholic xml entries" when it's a suunto file.

The "type of file" thing is probably a good idea for deciding on default
units too. Some day.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-01 13:32:52 -07:00
Linus Torvalds
00d798854a Start cleaning up dive accessors
I'm going to add a menu to import (and eventually export) dives, and so
we'd like to be able to start out with no dives at all.  Right now we
croak if that happens - it's not like the code has been written with
actual end users in mind.

So start cleaning things up.  First make the 'current_dive' macro work
right even for invalid dives.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-08-31 16:33:20 -07:00
Linus Torvalds
8e95ded57b Split up profile frame generation into its own file.
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-08-31 10:20:46 -07:00
Linus Torvalds
3aa02ccba9 Generate a default name for a dive, if it doesn't have one already
The name is a string containint date, time, depth and length.  So it's
useful even with nothing else going on.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-08-30 20:54:43 -07:00
Linus Torvalds
5c4cc39c56 Start moving some of the non-parsing stuff out of 'parse.c'
Create a 'main.c' with the main routine and argument "parsing" etc.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-08-30 18:40:25 -07:00
Linus Torvalds
f3a338a9af Split up dive data structure declarations into 'dive.h'
The dive parser should eventually be just a part of the program, not the
whole thing. So start preparing for that.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-08-30 18:23:59 -07:00