Commit graph

9802 commits

Author SHA1 Message Date
Linus Torvalds
e9d2890134 Start filling in temperature and nitrox data in dive list
Still more to go, but it's slowly fleshing out..

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-19 13:32:10 -07:00
Linus Torvalds
de721d9810 Add temp/nitrox/sac entries to divelist
This doesn't really fill them, it just adds them to the possible
entries.  I'll get to it later.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-19 12:56:37 -07:00
Linus Torvalds
69ff164afc Make the pane split be vertical rather than horizontal
Ok, this makes that dive list look empty and ugly, but as mentioned, we
really should start filling it with all the useful information that we
can sort by, like temperature and air use.

And even stuff that might not make sense to sort by (would you want to
sort by cylinder size or name? Or by nitrox percentage) could still be
*shown* in the list fairly naturally.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-19 12:46:22 -07:00
Linus Torvalds
fefcbf125e Remove dive info frame
It has always been problematic, and I've been moving things in and out
of it.

And it just isn't a very powerful widget.  You can't *do* anything with
it.  The information it shows you may be useful, but the core stuff
already shows up in the dive list.

And the dive list is actually a much superior widget over that static
dive info frame.  The information that shows up in the dive list can be
sorted by column, for example.

So when we show temperatures or SAC numbers in the dive info frame,
that's actually a very bad place to show them: we would be much better
off showing it in the dive list, and then we could sort by SAC or by
temperature.

In other words: just remove the thing.  Instead, plan to extend the dive
list to contain all the information.  That will probably mean that we
need to change the current pane widget to be a vertical pane, rather
than a horizontal one, but what's wrong with that?

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-19 12:39:35 -07:00
Linus Torvalds
96005d20ea Make the divelist column naming clearer
Currently we use random hard-coded integers, and it's not always clear
what is going on.  Make it much more explicit with an enumeration of the
different divelist columns.

And change the column order to make it more logical, and make sure we
actually catch all uses while at it.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-19 12:25:16 -07:00
Dirk Hohndel
e1171a57a7 Attempt to smooth out the velocity readings
If the velocity is slower than FAST then we look back up to 30 seconds and
calculate the velocity for the past 30 seconds instead.

For the first version I'm not doing the average of the changes but simply
the change from beginning to end.

The alternative would be to do another triangle smoothing or something
like that - but as we don't know how many samples we have in the 30 second
window, it's a little harder here.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2011-09-16 21:45:32 -07:00
Dirk Hohndel
d5b102bdf3 Flip tank pressure graph to show the RIGHT way
This annoyed me from the first moment Linus added the tank pressure graph.
As the pressure goes down, the graph needs to go down. Seriously.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2011-09-16 20:53:05 -07:00
Dirk Hohndel
bbf5f960e1 Stop plotting the gas / consumption information into the profile
And move the code into info.c where it now belongs

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2011-09-16 20:44:40 -07:00
Dirk Hohndel
6911229278 Make handling of empty airconsumption string consistent
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2011-09-16 20:20:28 -07:00
Dirk Hohndel
4564d67953 More fixes to positioning of gas / consumption information in info_frame
This gives the airconsumption label a fixed size and changes its alignment
so it is anchored to the right.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2011-09-16 20:16:52 -07:00
Dirk Hohndel
1937df188a Stop tank / gas / consumption info from changing info_frame size
Simply set it to an empty string with TWO lines when there is nothing to
display

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2011-09-16 16:29:43 -07:00
Dirk Hohndel
c58da2ee0c Indicate vertical velocity through color
So far Linus has hated all of my attempts to visualize vertical velocity
through color. This time I'm trying something dramatically new: there is
no PURPLE involved. Maybe that will convince him of the value.

We simply calculate the vertical velocity for the current plot segment
(last sample point to this sample point - in this version even without
divisions by zero) and assign a label based on the rate of change. These
labels are translated through a predefined table into colors:

Dark green is +/- 5ft/min (stable)
Light green is descents up to 30ft/min and ascents up to 15ft/min
Yellow is descents up to 60ft/min and ascents up to 30ft/min
Orange is descents up to 100ft/min and ascents up to 60ft/min
Red is outside of those ranges - you are most likely in danger

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2011-09-16 16:22:00 -07:00
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
ff0a601cc3 Dirk can't count to ten
That's ok, Dirk. I've got your back.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-16 14:21:30 -07:00
Dirk Hohndel
d6f8a0ef43 Remove dive number from frame label
It's now in the window title - no point in having it twice.
Also added a little "Dive #xx - " template. The old "##. " was a bit too
minimalistic for my liking.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2011-09-16 14:12:37 -07:00
Linus Torvalds
296642a632 Put the dive number and location in the window title bar
I suspect the "info" area is better used for actual values, so move the
dive location into the window title instead (using date if no location
info), and title the info frame with date and time.

This just means that the date/time gets removed from inside the frame:
we may want to put air consumption info in there instead?

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-16 12:15:46 -07:00
Dirk Hohndel
40b123f63a Tweak temperature plot to look better for small fluctuations
If the temperature is in a very narrow range the existing code visually
exaggerated the fluctuations. This tries to dampen that effect a bit.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2011-09-16 11:35:04 -07:00
Linus Torvalds
f3e70c5496 Tweak plot scaling a bit
Change the duration max rounding as noted by Dirk, and move the air
consumption down further towards the bottom right corner.  In
particular, I make the text positions not scale with the window size,
purely by the size of the text.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-16 10:49:49 -07:00
Dirk Hohndel
60a62cf843 Minor corrections to printing of the last temperature
- the time stamp where we printed the last temp was wrong
 - we really shouldn't check mK for being identical - especially on dive
   computers that store a lot of samples

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-16 09:51:38 -07:00
Linus Torvalds
ec97a62f34 Use plot_info for final remaining temperature and pressure data plots too
Ok, this is pretty much it now.  Instead of having various random checks
for "is the time of the sample past the end of the dive" hacks, we not
plot all graphs from the cleaned-up plot_info structure instead of the
raw samples.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-16 09:23:54 -07:00
Linus Torvalds
82f143d229 Plot pressure data based on 'struct plot_info' rather than raw dive data
Further movement to using the sanitized and cleaned-up plot info rather
than the raw data.

The raw dive data contains samples from the end of the dive that we
don't want to drop, but that we also don't want to actually use for
plotting the dive.  So the eventual end goal here is to not ever use the
raw dive samples directly for plotting, but use the diveplot data that
we have analyzed for min/max (properly ignoring final entries) etc.

There's still some data that we take from the samples when plotting, but
it's getting rarer.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-16 09:10:13 -07:00
Linus Torvalds
7c5c9e2024 Do min/max pressure and temperature based on the non-surface data
Do the min/max calculations only *after* we have removed the extra
surface events at the end.

The Uemis data in particular has a lot of surface events after the dive,
and we don't really want to take them into account since we won't be
plotting them anyway.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-16 08:53:12 -07:00
Linus Torvalds
adda1c6e86 Plot temperature info using 'struct plot_info' rather than the raw dive samples
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-16 08:42:27 -07:00
Linus Torvalds
33fed10d66 Start using 'plot_info' more for dive-time limits
.. I'll want to move pressure limit calculations into the 'plot_info',
so that we can do several passes of analysis and change dive limits etc
without having to actually modify the dive data itself (or add new
fields to 'struct dive' just for plotting).

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-16 08:20:06 -07:00
Linus Torvalds
8c18add46b Do libdivecomputer imports in a separate thread
This is the hackiest thing ever, unless you count the previous code that
was even hackier (and just called the gtk main routine at random
places).

The libdivecomputer library is not really set up to be part of the gtk
main loop, and cannot afford (for example) to have lots of mainloop
events while it's parsing.  Some dive computers are very timing
sensitive for the communication.

So just start a thread for doing the libdivecomputer stuff, and just
continually call the gtk main loop while that thread is running.  I'm
sure we could actually use some gtk signalling thing to make the thread
exit do the right thing, but instead we just poll the status every
100ms.

I did say it was hacky.  It does seem to work, though.  No more
temporary graying out of the windows when they don't react in a timely
manner because libdivecomputer does some blocking operation.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-15 22:58:02 -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
3a6652634b Rename the project 'subsurface'
I never really liked 'diveclog' as a name - it's not like the C part is
all that important.  And while I could try to just make up another slang
word for despicable person (in the tradition of naming all my projects
after myself), I just can't see it.

So let's just call it "subsurface".

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-15 09:43:14 -07:00
Dirk Hohndel
efb1fa44b8 Print the end temperature of the dive
Currently we print the temperature every five minutes. Especially with
dive computers that keep rather frequent temperature samples that means
that we have one more interesting data point that we don't label: the
surface temperature at the end of the dive.

This patch adds some logic to try to print the last temperature sample
that was recorded before the dive ended - unless that same value has
already been printed (to avoid silly duplications on dive computers with
less frequent sampling)

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-15 09:33:13 -07:00
Dirk Hohndel
b49c878a74 Don't draw temperature plot past the end of the dive
Just like we end depth and tank pressure plots once we are on the surface
(this is relevant for dive computers like the uemis Zurich that keep
recording samples after the end of the dive)

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-15 09:33:13 -07:00
Dirk Hohndel
ed4e71a817 Fix uemis depth calculation in the uemis XML importer
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-15 08:52:55 -07:00
Dirk Hohndel
fa76733d25 Fix depth calculations in SDA import
stole and fixed Linus' code in the uemis XML importer

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-15 08:52:55 -07:00
Dirk Hohndel
9ddef6854e Fix incorrect data dereference
This caused incorrect "missing Dive100" messages when importing SDA file
from the uemis Zurich.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-15 08:52:55 -07:00
Dirk Hohndel
518ec33ba3 First pass to parse uemis Zurich '.SDA' files
This is missing a ton of the information in the .SDA files It only
parses the divelog.SDA file, not the dive.SDA file It ignores the
information on the gas(es) used and all the data on the tanks.

It still draws some strange artefacts at the end of the dive

But it correctly hooks into the import dialogue, it gives you a file
select box (somewhere, I'm sure, a gtk developer cries quietly) and then
parses enough of this file to serve as a proof of concept.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-15 08:52:55 -07:00
Linus Torvalds
5f13a87cbd Flush any pending changes at notebook 'switch-page' time
Dirk points out that equipment changes (cylinder size etc) do not cause
a proper repaint of the dive profile with new SAC information.  The
reason? We haven't flushed the changes when the notebook changes from
the equipment page to the dive profile page.

Reported-by: Dirk Hohndel <dirk@hohndel.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-14 16:05:37 -07:00
Dirk Hohndel
b35e1bad8e Quick fix to hardcode device name only once
Linus clearly wanted to make SURE that we use /dev/ttyUSB0

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-14 11:37:25 -07:00
Linus Torvalds
b4c84c1a2e I'm trying to figure something out that prints reasonably..
I'll get there.  Shrink it down a bit, start adding notes and location,
and maybe put three per page. That might work.

.. or maybe I should just take a look at how others have done this.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-13 20:39:43 -07:00
Linus Torvalds
a0096f3a6b Make the printout look different
Not *better* mint you. Just different.

I suck at graphs.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-13 19:49:48 -07:00
Linus Torvalds
ce86289eed Add the capability to print a dive profile
Ok, this is the ugliest f*&$ing printout I have ever seen in my life,
but think of it as a "the concept of printing works" commit, and you'll
be able to hold your lunch down and not gouge out your eyeballs with a
spoon.  Maybe.

I'm just doing the cairo display as-is for the printout, which is a
seriously bad idea.  I need to not try to do colors etc, and instead of
having white lines on a black background I just need to make thelines be
black on white paper.

But that would involve actually changing the current "plot()" routine,
which is against the point of the exercise right now.  This really is
just a demonstration of how to add printing capabilities.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-13 16:02:42 -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
c7b9387d4b Separate the notion of creating the cylinder widgets from showing them
Now we always create the MAX_CYLINDER sets of cylinder widgets.  But we
don't actually pack them into the frame - that's a separate phase.

Right now we still do the stupid "always just pack two cylinders" thing,
but the idea is that we can pack just as many as the dive needs on a
per-dive basis.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-13 13:50:03 -07:00
Linus Torvalds
a92811351b Make multiple cylinders actually work
This just always shows two cylinders, which is obviously bogus, but it's
a good test-case for the multi-cylinder case.

I need to figure out how to dynamically show the right number of
cylinders, but that also involves the notion of adding a cylinder in
order to fill out information that didn't use to exist.

That's lower priority - now the infrastructure seems to be there.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-13 13:25:06 -07:00
Linus Torvalds
a4c9cc110f More work on abstracting the gtk cylinder widget thing
Ok, now we have an array of them, and most of the time we pass the right
pointer back and forth.

There's still a couple of places that hardcode "gtk_cylinder[0]" as the
data, but by now they are mostly things that should iterate over all the
cylinders.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-13 13:15:31 -07:00
Linus Torvalds
b19b76ecfa Start abstracting out the cylinder equipment widgets
Create a "struct cylinder_widget" so that when we handle multiple
cylinders, we can match them up with the actual cylinder data;

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-13 12:58:53 -07:00
Linus Torvalds
cb2f70f631 Always pack the widgets into boxes, not frames
Let's try to be consistent about this.  Make the parent of each widget
be a box.  Maybe the frames come with boxes, but since I have no clue
about gtk, I'm going to just always create them by hand.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-13 11:59:37 -07:00
Linus Torvalds
5a47bdc9c4 Add a checkbox for nitrox settings
Grey out the nitrox value unless the user explicitly checks the checkbox.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-13 11:47:20 -07:00
Linus Torvalds
0a13d287e5 Use round line noins and caps
It doesn't really make much of a difference, but it can be visible
especially with lots of tight samples.  Miter joins really look horrible
for acute angles.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-13 08:25:54 -07:00
Linus Torvalds
55156e63c3 Label the temperature graph
Oooh, pretty.

Or not.  The temperature graph is usually ugly as hell, but Dirk has the
cool dive computer with lots and lots of temperature readings.  Which
makes the graph a pretty graph, rather than a butt-ugly staircase like
mine.

Next time: get a dive computer with an OLED screen, and that can draw
pretty temperature graphs.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-13 08:16:29 -07:00
Linus Torvalds
f4559ba9fa Plot a sick kind of temperature curve
.. without the actual text, because I'm a "random plots that cannot
actually be interpreted" kind of guy.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-12 20:37:32 -07:00
Linus Torvalds
73013911af Update the README about libdivecomputer
The build instructions are in the git commit log too, but let's make
them a bit easier to find.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-12 14:05:44 -07:00
Linus Torvalds
574a5b808f Don't save empty cylinder descriptions in the xml
They get created when the equipment thing doesn't have a name for the
cylinder, but we don't want to save that lack of description.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-12 13:41:37 -07:00