Commit graph

269 commits

Author SHA1 Message Date
Joakim Bygdell
0277d5aacc Merge informational_prefs into git_prefs
There is no need to have two variables for the same purpose.

[Dirk Hohndel: changed to keep the two separate functions as otherwise
               we no longer parse existing repos successfully]

Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-02-05 12:29:51 -08:00
Joakim Bygdell
11dcae436e MOBILE: Read profile settings from git
Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com>
2017-02-05 11:59:47 -08:00
Joakim Bygdell
d4dbd0bee7 Save profile settings to git
In order to streamline the view between desktop and mobile we need to save
selected profile related settings to git.

Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com>
2017-02-05 11:59:47 -08:00
Robert C. Helling
6518b0db45 Treat gaschanges at 1s as inital gas use
When the first leg in the planner is not cylinder 0, a gaschange
event at t=1s is inserted. In the profile, we should treat that
as inital gas, so no pressure information is printed for cylinder 0
that is used nominally for one second.

This fixes a problem reported by Willem.

Signed-off-by: Robert C. Helling <helling@atdotde.de>
2017-02-04 07:09:35 -08:00
Stefan Fuchs
cd38cda186 Bugfix planner output formating (linebreaks)
Changed the markup with <div> and <br> tags of the planner output in
a way that is is a good compromise for both displaying in UI and
printing.

Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
2017-02-04 07:06:29 -08:00
Robert C. Helling
855995191c Don't do strcmp on NIL pointer
This is what we have same_string() for...

This prevents a crash when saving a dive in the planner.

Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-02-03 15:04:51 -08:00
Dirk Hohndel
db7290a915 Same typo, two more times
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-02-03 15:01:15 -08:00
Dirk Hohndel
a959e437a9 Fix typo
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-02-03 09:35:01 -08:00
Lubomir I. Ivanov
4a894e0713 Win32: add the --win32log option to log stdout and stderr to files
Adding --win32log as the first command line option on Windows
will now log all stdout and stderr output to the files
subsurface_err.log and subsurface_out.log in the working directory.

This change required a new argument 'bool logfile' to be added to:
subsurface_console_init() which is defined in all platform files
(linux.c, macos.c, etc.)

Example usage:
subsurface.exe --win32log -v -v -v

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2017-02-03 09:24:42 -08:00
Robert Helling
5aa9c6fa1b Do not count gas used in planned dives for statistics
This is important if in one dive we have the real dive and
a planned version of the dive as different computers using
different sets of cylinders.

[Dirk Hohndel: an early version of this was mistakenly pushed out
               by me; I reverted that and added this commit since
               fixing things up as I had done for the other two
               patches made things nearly unreadable]

Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-02-03 07:45:24 -08:00
Robert Helling
67de8f3a49 Correct: Handle more tanks than gasmixes
When Suunto Vytecs are used in gauge mode they don't record gasmixes.
If a tank pressure sensor is present they nevertheless record the
pressures. This patch handles this situation by assuming the tanks
contain air (and warning the user about this).

[Dirk Hohndel: I had mistakenly pushed out an earlier version of this
               commit, so this fixes things up to the final version]

Reported-by: antonnorth@gmail.com
Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-02-03 07:43:00 -08:00
Robert Helling
8a8315d6fe Correct "When merging planned dives keep all cylinders"
When merging a real dive with a planned dive (for comparison),
we should not try to be clever in merging similar cylinders,
rather keep the union of both cylinder sets as the two versions
of the dive might differ in exctly which gas and how much of it
was used.

Increase MAX_CYLINDERS to 20 to make room for this. We warn if we
exceed this number.

[Dirk Hohndel: I had mistakenly pushed out an earlier version of this
               commit, so this fixes things up to the final version]

Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-02-03 07:41:35 -08:00
Dirk Hohndel
08c42813e5 Revert "In statistics, ignore gas use of planned dives"
This reverts commit 1d8662006c.

Mistakenly pushed to master

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-02-03 07:31:03 -08:00
Dirk Hohndel
414d7f2632 Deal with some of the whitespace issues in planner.c
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-02-03 03:10:57 -08:00
Stefan Fuchs
fbaeeec807 Print SAC values from prefs in diveplan
Print the SAC values from preferences into the diveplan.
These are the values used for calculation of gas consumption.

Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-02-03 02:45:58 -08:00
Stefan Fuchs
a1c51256b2 Add ATM pressure and altitude to diveplan
Print the ATM pressure and the altitude used for calculation into the resulting diveplan.
Moved this info together with the deco model info below the runtime table.
There is one drawback in this implementation: Altitude will be recalculated from surface pressure and therefore may differ slightly from altitude entered in the UI.

Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-02-03 02:45:30 -08:00
Robert C. Helling
1d8662006c In statistics, ignore gas use of planned dives
When merged with real dives, those would double count otherwise.

Signed-off-by: Robert C. Helling <helling@atdotde.de>
2017-02-02 12:37:24 -08:00
Robert C. Helling
a031dbbbd8 When merging planned dives keep all cylinders
When merging a real dive with a planned dive (for comparison),
we should not try to be clever in merging similar cylinders,
rather keep the union of both cylinder sets as the two versions
of the dive might differ in exctly which gas and how much of it
was used.

Increase MAX_CYLINDERS to 20 to make room for this.

Signed-off-by: Robert C. Helling <helling@atdotde.de>
2017-02-02 12:36:08 -08:00
Robert C. Helling
99595542ec Handle more tanks than gasmixes
When Suunto Vytecs are used in gauge mode they don't record gasmixes.
If a tank pressure sensor is present they nevertheless record the
pressures. This patch handles this situation by assuming the tanks
contain air (and warning the user about this).

Reported-by: antonnorth@gmail.com
Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-02-02 12:35:58 -08:00
Robert C. Helling
bb86d13546 Initialize the surface time
Otherwise we return garbage when there is no dive in the dive list.

Closes #184

Signed-off-by: Robert C. Helling <helling@atdotde.de>
2017-02-01 14:43:27 -08:00
Robert C. Helling
c1dc0c9ce0 Allow user to disable a cylinder in planner
In the cylinder table, the last column ("use") always showed
OC-GAS. Editing was enabled, but the user had to guess to enter
a small integer meaning dilluent or CCR oxygen cylingder. I guess,
nobody has ever done that.

This patch makes this column clickable. A click toggles if the cylinder
is used for planning or not. This wait it is much easier to investigate
the consequences of gas loss on a plan.

Signed-off-by: Robert C. Helling <helling@atdotde.de>
2017-01-23 22:11:51 -08:00
Dirk Hohndel
b15b3c195c QML UI: allow magic phrase for multiple buddies to be localized
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-01-22 18:20:03 -08:00
Linus Torvalds
e1ee577c4f Make event string translation when downloading from libdivecomputer more obvious
We had hardcoded the exact translation of the event numbers.  They
haven't changed (although we did have what appears to be a spurious
entry for "non stop time" at the end that libdivecomputer doesn't have
an enum for).

Instead, use an explicit array index initializer array, so that it's
obvious that the two match up (and if the sample event numbers ever
change, we should cope with it gracefully).

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2017-01-17 09:15:50 -08:00
Linus Torvalds
fe5f15bdc5 Add support for libdivecomputer using DC_SAMPLE_GASMIX
New libdivecomputer versions use DC_SAMPLE_GASMIX to indicate a gas
change (which contains the cylinder index we're changing to) rather than
SAMPLE_EVENT_GASCHANGE*.

Unlike the old GASCHANGE model, and despite the name, DC_SAMPLE_GASMIX
does not actually say what the mix is, it only specifies a cylinder
index.  We had already extended SAMPLE_EVENT_GASCHANGE2 to have the
cylinder index in the otherwise unused "flags" field, so this is not all
that different from what we used to do.

And subsurface internally already had the logic that "if we know what
the cylinder index is, take the gas mix from the cylinder data", so
we've already been able to transparently use _either_ the actual gas mix
or the cylinder index to show the event.

But we do want to make it an event rather than some sample data, because
we want to show it as such in the profile.  But because we are happy
with just the cylinder index, we'll just translate the DC_SAMPLE_GASMIX
thing to the SAMPLE_EVENT_GASCHANGE2 event, and nothing really changes
for subsurface.

libdivecomputer has made other changes, like indicating the initial
cylinder index with an early DC_SAMPLE_GASMIX report, but we've seen
that before too (in the form of early SAMPLE_EVENT_GASCHANGE events), so
that doesn't really end up changing anything for us either.

HOWEVER, one thing that is worth noticing: do *not* apply this patch and
then use an old libdivecomputer library that sends both the
DC_SAMPLE_GASMIX samples _and_ the deprecated SAMPLE_EVENT_GASCHANGE
events.  It will all *work*, but since subsurface will take either,
you'll then get duplicate gas mix events.

It's not like that is in any way fatal, but it might be a bit confusing.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2017-01-16 17:45:00 -08:00
Robert C. Helling
7725842383 Use real gas compressibility in planner
Modify formluas for gas use to take into account the
compressibility correction for real gases. This introduces
also the inverse formula to compute the pressure for a given
amount of gas.

Signed-off-by: Robert C. Helling <helling@atdotde.de>
2017-01-16 03:17:40 -08:00
Dirk Hohndel
1ab6e7fc8a Prevent crash on Mac when typing comma in GPS coordinates field
Our attempt to skip any white space after the comma causes an ASSERT (strangely
only on Macs).

This closes #158

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-01-14 09:09:58 -08:00
Linus Torvalds
638e7fb28f Add cylinder equipment tooltips with gas volume
This adds tooltips for the equipment tab for each cylinder, showing the
amount of gas used.

When you mouse over the size and working pressure fields, the tooltip will
show the amount of gas used (along with start and end gas volumes). And
when you mouse over the start and end pressures, it will show the start
and end gas volumes, and the Z factor used.

I started doing this because of the gas volume questions in the last day
or two (and a few from a few weeks ago). When even Robert Helling starts
wondering about the effects of compressibility on the SAC calculation, our
numbers are clearly too opaque.

With these tooltips, at least you can see what went into the used gas
calculations, instead of having to add debugging options to print out Z
factors.

[ This patch also adds a "rint()" to get the rounding right in the
  gas_volume() function.  Although rounding to the nearst milliliter
  really doesn't matter, it's the right thing to do after doing FP
  calculations ;^]

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2017-01-12 14:17:09 -08:00
Anton Lundin
48b2b3d0b3 ostctools: Add support for profile version 0x24
Signed-off-by: Anton Lundin <glance@acc.umu.se>
2017-01-12 14:15:53 -08:00
Anton Lundin
983561b353 ostctools_import: Switch to using dc_parser_new2
Instead of creating the individual parsers, and keeping track of their
arguments, this just uses the "new" dc_parser_new2 function ment for
buffer parsing.

Signed-off-by: Anton Lundin <glance@acc.umu.se>
2017-01-12 14:15:53 -08:00
Anton Lundin
70e2404492 Stop accessing the internals of dc_descriptor_t
This removes our own declaration of dc_descriptor_t and all our accesses
to its internals, and switches to use the libdivecomputer functions to
access those instead.

Signed-off-by: Anton Lundin <glance@acc.umu.se>
2017-01-12 14:15:53 -08:00
Anton Lundin
d11dfd2f45 ostctools: Correct argument order to get_descriptor
This corrects the argument order, which was changed back in
00629c861c, but not on this place. Whups.

Signed-off-by: Anton Lundin <glance@acc.umu.se>
2017-01-12 14:15:53 -08:00
Miika Turkia
aaa46c2465 Add some additional parameters to help text
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-01-06 20:44:02 -08:00
Robert C. Helling
935734100f Rename prefs.deco_mode to prefs.planner_deco_mode
This is to avoid confusion with planner.display_deco_mode.
When accessing the "current deco mode" use the decoMode()
helper function.

Signed-off-by: Robert C. Helling <helling@atdotde.de>
2017-01-06 20:43:23 -08:00
Robert C. Helling
bb4bf639c3 Fix deco_mode confusion
We have two prefernces determining the deco_mode (BUEHLMANN vs VPMB
vs RECREATIONAL): One for the planner (deco_mode) and one for
displaying dives (display_deco_mode). The former is set in the planner
settings while the latter is set in the preferences.

This patch clears up a confusion which of the two to use by introducing
a helper function that selects the correct variable.

Signed-off-by: Robert C. Helling <helling@atdotde.de>
2017-01-06 20:43:23 -08:00
Robert C. Helling
43599742a3 Display surface interval in diveplan
...instead of just stating "repetitive dive". As requested by
a user.

Signed-off-by: Robert C. Helling <helling@atdotde.de>
2017-01-03 22:28:18 -08:00
Miika Turkia
8766054581 Hooking up av1.xslt for log import
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2016-12-31 09:56:08 +02:00
Robert C. Helling
10b8bda662 Fix picture hashing logic for pictures on the web.
Signed-off-by: Robert C. Helling <helling@atdotde.de>
2016-12-30 19:43:00 +01:00
Anton Lundin
38474f2d47 android: Add a subsurface_user_is_root for android
This is to compile the desktop ui for android

Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-12-28 22:40:18 -08:00
Anton Lundin
3b884c2e7c Use get_descriptor instead of hard-coded switch's
This starts using the newly lifted out get_descriptor in configure dive
computer, instead of previously hard-coded out of date
switch-statements.

Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-12-28 22:40:18 -08:00
Anton Lundin
00629c861c Rename ostc_get_data_descriptor to get_descriptor
This renames and cleans up ostc_get_data_descriptor into get_descriptor,
for more generic use.

Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-12-28 22:40:18 -08:00
Anton Lundin
db8e786f85 Lift ostc_get_data_descriptor out from ostctools.c
This is for later reuse of that function in other source files.

Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-12-28 22:40:18 -08:00
Tomaz Canabrava
27b4ef321a Correctly open the resource file
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-12-27 08:27:21 -08:00
Robert C. Helling
3e4ea9e084 Get rid of debug messages
...that managed to sneak in in a previous commit.

Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-12-26 13:09:05 -08:00
Robert C. Helling
c1ef59c540 Indicate a repetitive dive in the diveplan
Fixes #1095

Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-12-26 12:47:57 -08:00
Robert C. Helling
1ab5db3726 Empty image hashes are not valid
I don't know how those arose in the first place, but an
empty QByteArray is never a valid hash value for an image. So
we should not store those in our translation tables and also
get rid of them when loading the tables from disk.

Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-12-04 05:37:16 +09:00
Robert C. Helling
f03acb9e9a Fix effective GFs in notes
This patch fixes two bugs:

1) It first computes the effective gradient factors and then
composes the notes with the diveplan rather than the other way
around.

2) It does not try to fit a line through a single point.

Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-12-04 05:32:08 +09:00
Robert C. Helling
4d0d37b690 Show effective gradient factors for VPMB-plans
For each stop, this computes an effective gradient factor
that gives the same ceiling. Then, it does linear regression
to find values for GFlow and GFhigh that give a similar deco
profile.

Note that this optimises the average gradient factor. The
runtime however depends strongly at the gradient factor at
the last depth. So we don't necessarily to get the runtime
right.

Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-11-24 09:59:42 +09:00
Robert C. Helling
d1a0655613 Show runtime on top of diveplan
This is central information when planning a dive but often
scrolled out of the window for longer plans. So print it on
the top.

Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-11-24 09:59:32 +09:00
Robert C. Helling
20e211d337 Only consider non-zero average depth for statistics
Upon importing dives, the average depth can be undefined which we store as 0.
This zero should not contribute when computing the average depth for
the (yearly) statistics, only dives with average depth set now contribute.

Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-11-15 03:25:46 -08:00
Dirk Hohndel
9006802f72 Clean up some warnings in file.c
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-11-09 06:33:45 -08:00
Miika Turkia
66d9cc788c Parse multiple dives from single DL7 log file
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-11-09 06:29:24 -08:00
Anton Lundin
2497ecf16d configure ostc3: Correct typos
This fixes a copy-paste error made by me that caused
tempSensorOffset to first be set the wrong way and then overridden by
pressureSensorOffset.

Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-11-07 21:08:28 -08:00
Tomaz Canabrava
37e3e7e69a Deco mode for plannining is not deco mode for showing
We had (in the wrong place, imo) a new feature that
should differentiate the different deco_modes, you could
plan your dive in buelhman and see it in vpm-b, for instance
but both of them accessed the same pref.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-11-01 09:41:17 -07:00
Tomaz Canabrava
c110b4a238 More preference handling fixes
Remove a few uneeded lines and add more loading code for
the preferences.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-11-01 09:40:43 -07:00
Tomaz Canabrava
ce8f621623 on first run, use system language.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-11-01 09:39:45 -07:00
Tomaz Canabrava
5da23065d6 Use default prefs for the prefs that where missing
This patch fixes all the cases that I didn't checked for
the default prefs.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-11-01 09:39:17 -07:00
Tomaz Canabrava
1dddf731ee use GET_* macros for getting settings
Those macros are nice because they take into consideration
the default preferences.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-11-01 09:39:08 -07:00
Tomaz Canabrava
da2c6b208f Load use_system_language
Forgot to load use_system_language, wich borked the preferences.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-11-01 09:38:49 -07:00
Tomaz Canabrava
fdb48f9efb Remember to load the language
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-11-01 09:38:21 -07:00
Tomaz Canabrava
df2dfa4706 Fix bug where the Font setting was ignored
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-11-01 09:37:52 -07:00
Tomaz Canabrava
92272311bf Preferences tests: fix Update Manager date loading
Date loading was incorrect, this unittest + fix deals with that.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-11-01 09:34:47 -07:00
Tomaz Canabrava
3966f3e7dd Preferences tests: location updates & bug fix
Fixed loading the location preferences.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-11-01 09:34:47 -07:00
Tomaz Canabrava
540075962c Correctly load the language based prefs
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-10-28 07:31:50 -07:00
Tomaz Canabrava
d7f339ade7 Load system Language
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-10-28 07:31:34 -07:00
Tomaz Canabrava
324b1d2dfc Fix default file behavior tests
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-10-28 07:31:17 -07:00
Tomaz Canabrava
eb6f9e263c Remember to look for the Group
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-10-28 07:30:39 -07:00
Rick Walsh
ebddf95252 ToolTipItem: show gf line based on correct gradient factor preferences
Calculate gfline using the gradient factor that is set by the planner
preferences when in the planner, and by the general prefs when not in the
planner. This is achieved by doing the gradient factor calculation in dive.c,
where buehlmann_config is defined.

Previously, the gfline was calculated using the general preferences gfhigh and
gflow, even when in the planner.

Signed-off-by: Rick Walsh <rickmwalsh@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-10-27 20:36:14 -07:00
Tomaz Canabrava
713dd26d6c Added language testcase
Also, added a missing method / property

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-10-18 11:13:37 -07:00
Tomaz Canabrava
a42b05578f Tests for Units Preferences
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-10-18 11:12:33 -07:00
Tomaz Canabrava
9c4b0170bf Make all current written tests pass
Fixes a couple of issues with the tests.
Also, a type in prefs.h is "short" while it's actually
a boolean, this made me write the wrong testcase for this.

Fixed this by setting the Qt wrapper to bool, but I didn't
changed the c implementation because I tought I could break
something.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-10-15 12:24:05 -07:00
Tomaz Canabrava
c1fbc70d83 Update a few tests, implement Planner
Also, fixed a typo that caused a bug.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-10-15 12:22:52 -07:00
Tomaz Canabrava
8cd4255a28 Test planner settings
Plus: fix a typo.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-10-15 12:22:28 -07:00
Tomaz Canabrava
256d16a540 Test geologation
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-10-15 12:21:32 -07:00
Robert C. Helling
0d20344c90 Add preference to change deco model
Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-10-11 21:58:41 -07:00
Miika Turkia
b5de08b709 No gas change event on merging dives with same gas
When merging dives, this will skip the gas change event if both dives
use same gas.

Fixes #1099

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-10-11 21:56:52 -07:00
Robert C. Helling
aa3067c0f8 Compute weighted Buehlmann coefficients for all deco models
... as those are needed for the heatmap and not only
for Buehlmann ceilings.

Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-10-03 12:44:16 -07:00
Dirk Hohndel
fa2fcc4024 Clean up group handling in SettingsObjectWrapper
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-09-25 11:01:03 -07:00
Dirk Hohndel
9b4abca9f4 Make sure we remember the dive computer vendor and model
Preferences work best if you not only write them, but read them again as
well.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-09-25 10:34:30 -07:00
Rick Walsh
7e09a6c7bc Separate VPM-B conservatism preference for planner and profile
Separate the VPM-B conservatism preference into diveplan.vpmb_conservatism for
planning dives and prefs.vpmb_conservatism for profile ceiling display of
saved dives.

Signed-off-by: Rick Walsh <rickmwalsh@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-09-24 08:30:11 -07:00
Rick Walsh
7b891904e7 Rename conservatism_level to vpmb_conservatism
Make the variable purpose less ambiguous

Signed-off-by: Rick Walsh <rickmwalsh@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-09-24 08:29:56 -07:00
Dirk Hohndel
f4ca863a91 Correctly pick up the UI language from settings
While Linux can set the locale from the language text, Windows needs the
correct locale value (which makes more sense to use, anyway - that's why
we save it).

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-09-22 22:07:42 -07:00
Dirk Hohndel
78dc3a3efe Revert "Add a simple cp2130 libusb driver"
This reverts commit 93ef223a31.
2016-09-22 14:56:31 -07:00
Dirk Hohndel
5fdbc1ffc3 Language preference: once we figure out the locale, remember it
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-09-20 12:40:30 -07:00
Dirk Hohndel
743f73e4a3 Don't look up the setting again
This caused us to do the wrong thing if the setting wasn't set at all.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-09-20 12:38:23 -07:00
Dirk Hohndel
a31dd6c1c0 Preferences: remember both the locale name and the user friendly text
Currently we are confused which it is we are looking at and so setting the
language is broken.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-09-20 12:35:49 -07:00
Dirk Hohndel
c809a8873c Second attempt to fix crash
Linus pointed out that it might be another call site (and looking at his
proposed patch I noticed a logic error in my earlier attempt)

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-09-20 09:26:35 -07:00
Dirk Hohndel
076d8966f0 Prevent possible NULL pointer dereference
Not sure if this will fix the crash for Henrik, but it's worth
a try.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-09-20 08:47:08 -07:00
Dirk Hohndel
3ea15febfa Fix compile error on Windows
We need to return a DC_STATUS here.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-09-18 07:41:55 -07:00
Anton Lundin
93ef223a31 Add a simple cp2130 libusb driver
This adds a simple cp2130 userspace driver. Its probably unusable in the
real world but its a great base to build upon.

Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-09-18 07:12:16 -07:00
Anton Lundin
e0fe8762c2 Fix warning about incompatible pointer
The set_halfduplex function takes a unsigned int, not a int.

Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-09-18 07:11:45 -07:00
Anton Lundin
ffa3c48593 Rewrite libdivecomputer custom serial code
This rewrites the custom serial code to use the new api which I
implemented in the Subsurface-branch of libdivecomputer.

This is a bit to big patch but I haven't had the time to break it down
into more sensible patches.

This rewrite enables us to support more ftdi based divecomputer
communication and is tested with both a OSTC3, OSTC2N and a Suunto
Vyper, all over the libftdi driver.

The bluetooth code paths are tested to, and should work as before.

Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-09-17 15:47:37 -07:00
Joakim Bygdell
1219dc6931 QML UI: deal with multiple buddies correctly
When editing adive in Subsurface-mobile we can only handle one buddy
due to the limitations of the combobox. To prevent loss of data when editing
a dive with more than one buddy we display "Multiple Buddies" in the buddy
field. This creates a special case where no changes are written to the buddy field
unless the user changes buddy for that dive.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-09-17 13:46:15 -07:00
Robert C. Helling
ed11dab7fb Compute total tissue saturation for all deco models
... and not just for Buehlmann. This makes the saturation
graphs meaningful for VPM-B.

Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-09-17 13:43:28 -07:00
Robert C. Helling
cd99bbe727 Cosmetic changes to Buehlmann code
Change runtime table string from ZHL-16B to ZHL-16C to reflect he fact
that we use 5min as half-time for the fastest compartment rather than
4min.

Further more trade pow(2.0, ...) for exp().

Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-09-17 13:41:12 -07:00
Dirk Hohndel
80eafb8db7 Fix some warnings
At least the warnings about size potentially being uninitialized seem correct
and valid.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-09-04 10:27:56 -07:00
Dirk Hohndel
830d9163dc iOS build: Fix compile failure
Without this moc_SubsurfaceObjectWrapper doesn't compile.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-09-04 07:52:18 -07:00
Linus Torvalds
833683521a Stop trying to fix up pressure sensor indexes
This removes 'fixup_dc_cylinder_index()', which was added to fix up the
pressure sensor indexes from the Atomic Cobalt dive computer.

Even for the Cobalt it really shouldn't matter, because the
libdivecomputer backend for the Cobalt actually tries to do the right
thing.  See for example commit 8853a1ccd422 ("Associate the pressure
samples with the primary tank.") in libdivecomputer.

Some historical digging shows that the subsurface sample pressure index
code came in from commit e32ba4d6d8 ("Improve tank handling for
Cobalt"), dated Tue Oct 28 13:48:15 2014.

And the libdivecomputer "use the right cylinder" code was around the
same time (Fri Oct 10 20:29:17 2014 +0200).

So I suspect that subsurface needed the fixup based on an older version
of libdivecomputer.  Jef's patch is a couple of weeks before, but we may
not have tracked libdivecomputer religiously.

The reason to remove this code is because it can (and does) mess up the
sensor index when it is actually reliable, like in the multi-sensor case
of the Suunto EON Steel.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-09-04 07:37:28 -07:00
Joakim Bygdell
4e0200863b Remove hacks regarding multiple gasmixes and cylinders
Enabling cylinder edit in Subsurface-mobile our previous hacks
regarding multiple cylinders and gasmixes must be removed.

Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-09-04 07:36:43 -07:00
Joakim Bygdell
674d8331f5 QML UI: Enable cylinder edit
This adds the option to select a cylinder when adding or editing a dive.
Due to limited screen size we restrict the editing to the first cylinder only.

Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-09-04 07:36:13 -07:00
Rick Walsh
7b3665827a Settings fixup: gflow and gfhigh are int
With the recent setting cleanup, gradient factors were set to bool, so were
saved as 1/1, rather than say 50/80. This commit fixes that.

Signed-off-by: Rick Walsh <rickmwalsh@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-09-04 07:29:42 -07:00