Commit graph

18754 commits

Author SHA1 Message Date
Linus Torvalds
f8de487c2f Make a guess at the cylinder description from the size and pressure
I'll want to also add a way to override/set the cylinder type: both
manually by just setting a size in liters, and by picking from some list
of standard cylinder sizes.

For example, it looks like most of my dives are marked as having
12-liter cylinders.  That is probably some default from Suunto Dive
Manager, or from whatever Dirk did.  It's almost certainly not right for
any of them: as far as I know, the standard cylinders for Lahaina Divers
(which is likely most of the warm water dives) are AL72's for air, and
AL80's for Nitrox.

That would be a 10L and a 11.1L tank respectively, afaik.  I don't know
what a 12-liter tank would be or where that size comes from.

Anyway, the LP85+ tank designation for some of the dives looks more
likely: that's one of the common sizes I've used for local dives.  So
the size of that thing is much more probably correct.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-04 13:34:22 -07:00
Nathan Samson
6b075e0339 Merge hbonse's UI tweaks, but fixing the compile warnings. Also bringing it up to date with the master (and my own UI improvements)
Signed-off-by: Nathan Samson <nathansamson@gmail.com>
2011-09-04 22:15:55 +02:00
Linus Torvalds
f448b68de0 Clean up 'fixup_dive()' a bit
We don't want to override potentially more exact values for water
temperature etc either.  The sample save interval may be longer than
some internally kept state of key per-dive values like that.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-04 13:06:47 -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
230a13476d Merge branch 'ui-improvements' of https://github.com/nathansamson/diveclog
* 'ui-improvements' of https://github.com/nathansamson/diveclog:
  Split the dive list in columns. Columns are sortable now (name = date, depth, duration)
  Remove the redundant frames in the notebook. Closes #9
  Use a pane so the dive list can be made wider or smaller to the users wishes
2011-09-04 11:49:49 -07:00
Linus Torvalds
550eb862fa Merge branch 'compiler-warning' of https://github.com/nathansamson/diveclog
* 'compiler-warning' of https://github.com/nathansamson/diveclog:
  Removed the unused startemp and enttemp calculations. This fixes a compiler warning too.

Fix up trivial conflict in dive.c due to the temperature simplification
(commit 9961c7f89c: "Remove redundant temperature readings").
2011-09-04 11:46:39 -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
ecff0922d4 Don't save cylinder working pressure
It was a mistake to save it - and I did it just because other dive
managers did.  It's a totally nonsensical measure, and nobody cares.
The only thing that matters is the size of the cylinder, and the
*actual* pressures.  Those give actual air consumption numbers, and are
meaningful and unambiguous.

So the "working pressure" for a cylinder is pointless except for two
things:

 - if you don't know the actual physical size, you need the "working
   pressure" along with the air size (eg "85 cuft") in order to compute
   the physical size.  So we do use the working pressure on *input* from
   systems that report cylinder sizes that way.

 - People may well want to know what kind of cylinder they were diving,
   and again, you can make a good guess about this from the working
   pressure.  So saving information like "HP100+" for the cylinder would
   be a good thing.

But notice how in neither case do we actually want to save the working
pressure itself.  And in fact saving it actually makes the output format
ambiguous: if we give both size and working pressure, what does 'size'
mean? Is it physical size in liters, or air size in cu ft?

So saving working pressure is just wrong. Get rid of it.

I'm going to add some kind of "cylinder description" thing, which we can
save instead (and perhaps guess standard cylinders from input like the
working pressure from dive logs that don't do this sanely - which is all
of them, as far as I can tell).

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-04 11:34:44 -07:00
Linus Torvalds
9961c7f89c Remove redundant temperature readings
I'm aiming to really differentiate in dive log software by making my XML
export files be *clean*, dammit.

That means that we don't have random names, we don't have crazy random
units, and we don't have redundant information.

So when the temperature doesn't change, just don't report it.  That's
already what "no sample" means, just clean things up.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-04 11:20:27 -07:00
Nathan Samson
31123f63af Split the dive list in columns. Columns are sortable now (name = date, depth, duration)
Signed-off-by: Nathan Samson <nathansamson@gmail.com>
2011-09-04 20:14:39 +02:00
Hylke Bons
c4514b062a Some UI beauty patches:
Uppercase first letter for each label word
Tweak the paddings for easier reading
Rename File menu to Log menu
Add a separator before Quit in the Log menu
Remove frame in extended diving info and add 6px padding

Signed-off-by: Hylke Bons <hylkebons@gmail.com>
2011-09-04 19:37:23 +02:00
Nathan Samson
bcf12edfe9 Merge branch 'master' into ui-improvements 2011-09-04 19:06:47 +02:00
Linus Torvalds
23a6607ae7 Fix typo in Makefile (LDLAGS -> LDFLAGS)
Reported-by: Konrad Delong <https://github.com/konryd>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-04 10:01:37 -07:00
Nathan Samson
6138d151e9 Remove the redundant frames in the notebook. Closes #9
Signed-off-by: Nathan Samson <nathansamson@gmail.com>
2011-09-04 19:01:30 +02:00
Linus Torvalds
9dc88381d2 Merge branch 'fix-entries' of https://github.com/nathansamson/diveclog
* 'fix-entries' of https://github.com/nathansamson/diveclog:
  Word wrap the info textview. Also do not show the scrollbars if not necessary.
  Change location to a text entry instead of text view.
2011-09-04 09:58:34 -07:00
Nathan Samson
1117cd37d7 Use a pane so the dive list can be made wider or smaller to the users wishes
Signed-off-by: Nathan Samson <nathansamson@gmail.com>
2011-09-04 18:54:12 +02:00
Linus Torvalds
797343bf8a Update gitignore for the name-change of the executable
It's not called 'parse' any more.  And I think I should rename 'divelog'
too to something more unique.  Right now the working name for the
project is 'diveclog' (kind of like 'jdivelog') , but I'm not convinced
that the "C implementation" part is really important enough to make a
point of long-term.

"subsurface"? I don't know.  Maybe I should follow the "name all
projects after myself" mantra.  "divenut"?

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-04 09:52:40 -07:00
Linus Torvalds
a57668127e Oops. I forgot to 'fclose()' the file after saving the xml
It never actually triggered anything for me, but any buffered data might
be lost, especially if you force-exit the application after saving a
dive log.

This probably explains a corrupted (truncated) dive file report from
Nathan Samson.

Reported-by: Nathan Samson <https://github.com/nathansamson>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-04 09:50:31 -07:00
Nathan Samson
f12382c66f Removed the unused startemp and enttemp calculations. This fixes a compiler warning too.
Signed-off-by: Nathan Samson <nathansamson@gmail.com>
2011-09-04 15:18:20 +02:00
Nathan Samson
14547d8ca2 Word wrap the info textview. Also do not show the scrollbars if not necessary.
Signed-off-by: Nathan Samson <nathansamson@gmail.com>
2011-09-04 15:17:21 +02:00
Nathan Samson
5ea6b229f8 Change location to a text entry instead of text view.
Signed-off-by: Nathan Samson <nathansamson@gmail.com>
2011-09-04 15:17:11 +02:00
Linus Torvalds
a6b9eaee0a Add 'Quit' menu item, and fix invisible "File" on gtk2
I didn't even notice that the "File" part of the file menu no longer
showed up, since the keyboard accelerator for ^S worked fine..  But
apparently there's no default label associated with GTK_STOCK_FILE in
gtk2, so the "File" text went away with the conversion to GtkUIManager
in commit 4d62478e14 ("Use the newer GtkUIManager for menu creation.")

The addition of a Quit menu entry with the associated keyboard
accelerator also makes ^Q "just work".

Of course, if we actually tracked dirty state etc, we could perhaps ask
the user whether they wanted to save or something.  But I'm not exactly
famous for my GUI chops, so ..

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-03 21:38:07 -07:00
Linus Torvalds
c938679726 Merge https://github.com/mrjbq7/diveclog
* https://github.com/mrjbq7/diveclog:
  dive.c: Fix spelling.
2011-09-03 20:55:02 -07:00
Linus Torvalds
6fd86ab6b7 Don't bother saving n2 percentage
It's all calculated anyway, and for the same reason we don't bother even
parsing it at load time, we really shouldn't bother saving it either.

The only thing you can do with that value is "check if the percentages
add up to 100%", and so what?

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-03 20:50:11 -07:00
Nathan Samson
3a04342607 Improve the layout of the text entries in gtk3. For gtk2 this could also be useful
Signed-off-by: Nathan Samson <nathansamson@gmail.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-03 20:45:31 -07:00
Nathan Samson
4d62478e14 Use the newer GtkUIManager for menu creation.
Signed-off-by: Nathan Samson <nathansamson@gmail.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-03 20:45:22 -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
John Benediktsson
f31e17a0ae dive.c: Fix spelling. 2011-09-03 18:48:39 -07:00
Linus Torvalds
c1bed52a77 Add 'mean depth' marker on dive plot
Just because I can.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-03 13:55:36 -07:00
Linus Torvalds
2804dc42d8 Only update mean/max depths with computed ones if they are way off
The computer may track "real" max depth more closely than it tracks
samples.  So we trust the non-computed mean/max depths more than the
computed ones.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-03 13:36:25 -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
f8e39675cc Update README a bit
..since this is now on github, might as well tell people what they need
to compile it, and warn them about the state of the project.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-03 08:53:05 -07:00
Linus Torvalds
3def2b1aac Add location note to the top bar too.
I really don't understand the packing rules.  This does not look like
what I intended.

Oh well.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-02 20:00:10 -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
ef0d00e76a Improve uemis xml parsing a bit
It looks like the "units.pressure" setting is only about the units that
things are *shown* in on the wrist computer: the units in the file are
always in bar (or rather, centi-bar).

Which is definitely the right thing to do, and means that we shouldn't
care about parsing the units setting.  It's purely about how something
is shown, not about parsing.

That's probably true of the other units too, but let's see when I have
more data to go on.

Also, parse water temperatures and tank pressure.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-02 15:01:53 -07:00
Linus Torvalds
a5e4c7ffd1 Silently ignore zero pressure
Don't complain about them, they're just missing values

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-02 14:06:26 -07:00
Linus Torvalds
9506c4bf0a Use 'units' value instead of guessing based on integer/FP
We still end up guessing based on magnitude of the value, though: it
might be 'bar' or 'mbar', we end up picking one or the other based on
just how big the value is.

I should make it look at any possible explicit units too, since at least
with good xml, they exist.  Of course, the only good xml I've seen so
far is the one we generate ourselves ;)

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-02 13:59:39 -07:00
Linus Torvalds
d9106995d3 Hack up some very rudimentary support for the Uemis xml format
I think I'll need to re-organize the handling of per-format code, but
for now we just mix it all up.

The uemis conversion is also questionable even for just the small parts
I do.  Does it really do "centiPSI"? That sounds crazy.  I'm waiting for
Dirk to send me some actual human-readable output from the dives, right
now some of it is just rough guesses.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-02 11:32:48 -07:00
Linus Torvalds
8042246df6 Show temperature in the info summary
If it exists, it really does help identify the dive.  At least it does
for me: "local or Maui"?

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-01 22:22:25 -07:00
Linus Torvalds
2cd2cafdf4 Generate 'watertemp' field from samples if required
Sure, it's redundant, but it's convenient for the general dive info.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-01 22:21:16 -07:00
Linus Torvalds
f7fb74f3a7 Fix wrongly nested watertemp xml entry
Too much cut-and-paste: the ending tag said "airtemp".

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-01 22:18:44 -07:00
Linus Torvalds
bafc7e771e We can't save escape characters.
I think it should be legal xml, but whatever.  libxml2 is very unhappy,
and complains when loading - even if I escape them.  So let's just
replace the low escape characters with '?'.

The only thing to ever care was my test-case, I suspect.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-01 20:28:17 -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
0189de695c Do gasmix as an empty element XML too
Let's make it a goal that the XML we output is pretty.  That clearly was
never a goal for the Suunto XML, but we can be oh-so-much-better than that.

I still don't love XML, but let's try to make the best of a bad situation,
and take pride in what we do.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-01 17:44:13 -07:00
Linus Torvalds
c139aa8d51 Clean up save-file output a bit
Use the "empty element" form for samples that don't have any events
associated with them (and none do, right now).  This avoids that
annoying "</sample>" crud.

And output the units in the output helpers, so that you can't forget
them even if you try.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-01 17:37:41 -07:00
Linus Torvalds
adc92d6de2 Always use proper units when saving.
When we see a number like 23.145, we'd better always also see a unit.
It's just good practice.  So add 'min' to duration (and use only two
digits for number of seconds), and 'm' to depth.

And write the date in international standard format.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-01 17:17:19 -07:00
Linus Torvalds
5001ab66cb Teach the date parser to also parse the international standard date format
The standard way to write a date is yyyy-mm-dd, which is unambiguous and
sorts correctly.

We parsed that right in the 'datetime' case, but not in the normal date
case.  And we do want to use that in our output format, exactly because
it's standard.

And also parse 'duration' for the dive duration.  It's what we use when
saving, it just so happened that we ended up not parsing it right, but
then picking it up from the samples instead.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-01 17:13:39 -07:00
Linus Torvalds
1376712f0b Save everything in our current dives and samples into the xml file
Now, as we start parsing more, we just need to also add the code to save
it.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-01 16:59:10 -07:00
Linus Torvalds
99c111e348 Fix up small details in input/output
Be more careful with FP conversions, and with the Kelvin<->C offset.
And make sure to use the same names when saving as when parsing.

Now when we save a set of dives, then re-load them, and save again, the
second save image is identical to the first one.

Of course, we don't actually save everything we load, so we still do
lose information when we load and then save the result.  But at least we
now don't lose the information that we *do* save.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-01 16:41:10 -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