Commit graph

9797 commits

Author SHA1 Message Date
Grace Karanja
ab7db605e5 QML UI: Move top bar to its own file
Move the QML top panel to its own file, so that it can be used in
other files.

Signed-off-by: Grace Karanja <gracie.karanja89@gmail.com>
2015-08-31 15:49:09 -07:00
Grace Karanja
390c10bb08 QML UI: Remove unneeded MobileDive class
The MobileDive class in divelistmodel.h is a duplication of the
Dive class in templatelayout.h. This patch moves the Dive to
the qthelper file.

[Dirk Hohndel: merged with upstream master - let's hope I didn't
               mess anything up]

Signed-off-by: Grace Karanja <gracie.karanja89@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-31 15:47:48 -07:00
Grace Karanja
46cfe003f3 QML UI: Add Android build instructions
Add instructions on how to build the android version to the INSTALL
file.

Signed-off-by: Grace Karanja <gracie.karanja89@gmail.com>
2015-08-31 15:24:15 -07:00
Grace Karanja
5a7dbf0225 QML UI: Use AddDive instead of clear dive
No need to clear the dives when adding a new one.

Signed-off-by: Grace Karanja <gracie.karanja89@gmail.com>
2015-08-31 15:24:15 -07:00
Grace Karanja
a734a2ee19 QML UI: Dynamically change button text
Dynamically change the text of the show/hide profile button.

Signed-off-by: Grace Karanja <gracie.karanja89@gmail.com>
2015-08-31 15:24:15 -07:00
Grace Karanja
3d5ad19888 QML UI: Add button to hide dive profile
Allow toggling of dive profile visibility

Signed-off-by: Grace Karanja <gracie.karanja89@gmail.com>
2015-08-31 15:24:15 -07:00
Grace Karanja
1925b3d012 QML UI: Remove clearDetails() function in DiveList.qml
This function is not needed, as we will move all of the logic to
C++.

Signed-off-by: Grace Karanja <gracie.karanja89@gmail.com>
2015-08-31 15:24:14 -07:00
Grace Karanja
a3bdf49b84 QML UI: Clear divelist model before starting new dive
When user clicks on AddDive, we should clear the model.

Signed-off-by: Grace Karanja <gracie.karanja89@gmail.com>
2015-08-31 15:24:14 -07:00
Grace Karanja
8d03d26480 QML UI: Start Add Dive feature
Start working on the add dive feature, to enable the user add a
new dive using the mobile UI.

Signed-off-by: Grace Karanja <gracie.karanja89@gmail.com>
2015-08-31 15:24:14 -07:00
Robert C. Helling
10d8a625d0 Adopt expected times in TestPlan
Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-31 15:19:10 -07:00
Robert C. Helling
e32896c2bc Introduce double depth_to_bar()
as it leads to significant cleanup.

Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-31 15:18:40 -07:00
Robert C. Helling
bd8126a709 Calculate ceiling only when it is needed
So far, add_segment() returned a tissue tolerance (i.e. ceiling)
computed just in its return statement. This tissue_tolerance
needed to be dragged around until it was needed or be dropped
if not needed at all.

As for VPM-B, this ceiling computation is a bit expensive, this patch
calls the computation function tissue_tolerance_calc() when the
value is actually needed and not before.

This changes the signature of some functions.

Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-31 15:17:39 -07:00
Robert C. Helling
d9306125d9 Do the Boyle compensation when the gradient is needed
and not some time before and store the result in a global variable.

This stores only the bottom gradients and computes the Boyle compensation
when computing the allowed ambient pressure.

As the Boyle compensation needs a reference ambient pressure, to find the ceiling,
we have to iterate this computation until the reference pressure is close enough to
the ceiling.

Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-31 15:15:19 -07:00
Robert C. Helling
3a7109e44e Changed qInfo() to qDebug()
... as the former was introduced only in Qt 5.5 in order to make the
test build also with 5.4

Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-31 15:13:43 -07:00
Anton Lundin
74ecb924f4 Support multiple o2 sensor values from libdc
libdivecomputer might call us with DC_SAMPLE_PPO2 multiple times, which
means multiple sensors.

Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-31 15:13:06 -07:00
Anton Lundin
0cf9e0570d Store DC_SAMPLE_PPO2 as a o2 sensor
DC_SAMPLE_PPO2 represents a known ppO2, and not a setpoint.

Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-31 15:12:53 -07:00
Anton Lundin
70d9297e3a Be compatible with libgit2 0.22 again
In libgit2 0.22 tree_flags was called flags.

Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-31 15:12:37 -07:00
Anton Lundin
b7038e4bec Remove unneeded includes
Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-31 15:12:18 -07:00
Dirk Hohndel
332bde9c86 Update ReleaseNotes
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-31 10:44:34 -07:00
Dirk Hohndel
3bcb634e06 Remove about window have for Beta releases
Simply tag the beta versions correctly and none of this is needed.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-31 10:36:49 -07:00
Rick Walsh
2c4ae23ccc VPM-B: Get rid of ugly blips in ceiling
A real ceiling is the ceiling calculated when the ambient pressure is at the
ceiling.  As such, the Boyle's law compensation should be done against the
ambient pressure at the ceiling.  Instead of doing an iterative calculation,
take the lesser ambient pressure of the ceiling of the previous sample, and the
depth of the current sample.

This approach gets rid of "blips" in the calculated ceiling due to a step in
Boyle's law compensation during ascent.  In limited testing, it also appears to
avoid creating a ceiling deeper than the calculated plan in most cases.

Signed-off-by: Rick Walsh <rickmwalsh@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-30 16:55:36 -07:00
Rick Walsh
9238a7f0df Profile.c: Fix stepping through loop between sample points
If adjacent samples at times t0 and t1 are greater than time_stepsize apart,
this for loop steps through the time between samples to calculate tissue
tolerance incrementally at each intermediate time, j, (and interpolated depth).

If the difference between t1 and t0 is not a multiple of time_stepsize,
immediately before the final increment time_stepsize needs to be reduced to
t1 - j so that j = t1 in the final increment.

This is necessary when:
	t1 - j < time_stepsize	(i.e. we are about to start the final
				increment, and time_stepsize needs to be
				reduced), and
	j < t1			(i.e. we didn't just do the final increment -
				without this condition time_stepsize would be
				set to zero, leading to an infinite loop)

Previously, the check was (j - t0 < time_stepsize), which always returns false.

Signed-off-by: Rick Walsh <rickmwalsh@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-30 16:55:17 -07:00
Dirk Hohndel
6d7faa106f Add test case for multi line dive notes merging
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-30 13:00:32 -07:00
Dirk Hohndel
1b37e0f1a4 Add test for dive site duplication bug
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-30 10:32:38 -07:00
Dirk Hohndel
e0587cb6df Fix subtle bug in dive site import from V2 file
Assume your V2 file contains two locations with different name but
identical GPS location. "Blue Corner" and "Blue Corner, Palau". And you
have many dives there.

When reading a V2 file the GPS is read first and a dive site is looked up
based on that. Let's assume the lookup by gps finds "Blue Corner, Palau".

Now every time we get the "Blue Corner" site in the V2 file we look  up
the GPS, get "Blue Corner, Palau" as dive site, then read the name "Blue
Corner" and say "oops, different site" and create a new one. Resulting in
several dive sites named "Blue Corner" with identical GPS but different
UUID (as we add the dive time into the SHA for the deterministic UUID).

With this commit, if we have a dive site that matches the GPS but has a
different name, we check if we happen to have an exact match for the dive
site information from the XML file (and use it, if we have it) before
creating a new dive site.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-30 10:14:50 -07:00
Rick Walsh
d15a1db428 TestPlan: Do not re-declare bool result
Fixing this error makes TestPlan pass again.

Signed-off-by: Rick Walsh <rickmwalsh@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-30 09:14:58 -07:00
Sander Kleijwegt
d22a135343 Fix edit & show of divesites for new and existing dives.
The UI detects when it should refresh the loction after the
user finished editting a divesite. Creating and editting
divesites is now working even when the current dive is not
saved yet.

Signed-off-by: Sander Kleijwegt <sander@myowndomain.nl>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-29 20:10:32 -07:00
Rick Walsh
954c30c4cf VPM-B Tests: Compare against known Subsurface runtime
We should compare the calculated runtime against the runtime previously
calculated by Subsurface, expecting them to match exactly, in order to detect if
a change has been made.  We still compare against a benchmark, allowing some
difference.

Signed-off-by: Rick Walsh <rickmwalsh@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-29 20:06:56 -07:00
Rick Walsh
4a9433864e VPM-B: Don't break the ceiling due to ongassing on ascent
Signed-off-by: Rick Walsh <rickmwalsh@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-29 20:06:53 -07:00
Rick Walsh
e2178c0e55 VPM-B: Remove obsolete first_ceiling_pressure calculation
We now do the first_ceiling_pressure calculation at the start of the CVA loop.
We don't need to do it before.

Signed-off-by: Rick Walsh <rickmwalsh@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-29 20:06:49 -07:00
Rick Walsh
27ba48a09e Planner: Change where we clear deco and reset gradients
We should run clear_deco as early as we can.  We should calculate the nuclear
regeneration and start gradient after calculating tissue tolerance.  We don't
need to redo nuclear regeration and start gradient after that.

Signed-off-by: Rick Walsh <rickmwalsh@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-29 20:06:46 -07:00
Rick Walsh
2d45e587ba VPM-B: Calculate crushing pressure on descent
By calculating crushing pressure after the manually entered phase, we were doing
it wrong for multi-level dives.

Signed-off-by: Rick Walsh <rickmwalsh@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-29 20:06:43 -07:00
Rick Walsh
7d09f418f8 Use Schreiner water vapour pressure for VPM-B
Inspired gas loading equations depend on the partial pressure of inert gas in
the alveolar.
P_alv = (P_amb - P_H2O + (1 - Rq) / Rq * P_CO2) * f
where:
P_alv	alveolar partial pressure of inert gas
P_amb	ambient pressure
P_H2O	water vapour partial pressure = ~0.0627 bar
P_CO2	carbon dioxide partial pressure = ~0.0534 bar
Rq	respiratory quotient (O2 consumption / CO2 production)
f	fraction of inert gas

In our calculations, we simplify this to use an effective water vapour pressure
WV = P_H20 - (1 - Rq) / Rq * P_CO2

Buhlmann ignored the contribution of CO2 (i.e. Rq = 1.0), whereas Schreiner
adopted Rq = 0.8.
WV_Buhlmann = PP_H2O = 0.0627 bar
WV_Schreiner = 0.0627 - (1 - 0.8) / Rq * 0.0534 = 0.0493 bar

Buhlmann calculations use the Buhlmann value, VPM-B calculations use the
Schreiner value.

Concept explained here:
http://www.divetable.de/workshop/V1_e.htm

Signed-off-by: Rick Walsh <rickmwalsh@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-29 20:06:37 -07:00
Rick Walsh
becc1e6dc4 VPM-B: Use correct gamma values
In other implementations of VPM-B, surface_tension_gamma and
skin_compression_gammaC are taken as 0.0179 N/msw and 0.257 N/msw respectively.
We do pressure calculations in bar, not msw, so our gamma values need to reflect
that.  Previously we had used 0.179 and 2.57, which are close but not quite
correct (10 msw == 1.01325 bar).

Signed-off-by: Rick Walsh <rickmwalsh@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-29 20:06:35 -07:00
Rick Walsh
1e7dd49234 Update expected runtime of VPM-B test to match benchmark
Signed-off-by: Rick Walsh <rickmwalsh@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-29 20:06:32 -07:00
Rick Walsh
961c218c06 VPM-B Tests: Output first ceiling
This is useful for determining why we calculate a difference profile

Signed-off-by: Rick Walsh <rickmwalsh@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-29 20:06:28 -07:00
Sander Kleijwegt
9770369889 Always show the dive site edit button
Update the tooltip and enable only when there is a divesite selected

Signed-off-by: Sander Kleijwegt <sander@myowndomain.nl>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-28 16:16:05 -07:00
Sander Kleijwegt
67abcd0c2c Fix mouse clicks on divesite completer.
Use clicked instead of activated signal on the completerList to
handle the selection of a divesite.

Signed-off-by: Sander Kleijwegt <sander@myowndomain.nl>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-28 16:15:25 -07:00
Sander Kleijwegt
10d0604297 Fix crash when creating a dive site without any dives in logbook.
A divesite uuid is created using the timestamp of the currently
selected dive. When there is no current_dive, use the current
time to create a uuid.

Signed-off-by: Sander Kleijwegt <sander@myowndomain.nl>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-28 16:13:50 -07:00
Dirk Hohndel
d5aacd092d Fix printing on Mac
While I cannot explain for the life of me why this worked on Linux and
Windows and not on Mac, what I have now seems to work on all three
platforms.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-28 09:15:56 -07:00
Dirk Hohndel
4360cee196 Cmake: install grantlee plugins on Mac
And add a small message that two potential ERRORS that are thrown in the
deploy step are actually harmless.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-27 13:53:32 -07:00
Dirk Hohndel
84c8213e14 Fix build script
A git pull seems to cause things to go wrong. Just fetching the repository
and checking out the version that we want seems to work better.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-27 13:28:25 -07:00
Dirk Hohndel
035e08e633 QtBT: avoid crash at exit if no BT device found
If localDevice isn't valid we never initialize the discory agent, so
let's not dereference it in the destructor unless it is valid.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-27 09:23:38 -07:00
Miika Turkia
837daa08ea Remove unused function and define
These were left unused by cleaning up the import function parameters.

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-27 08:59:56 -07:00
Miika Turkia
14999341e0 Update tests to use cleaner CSV parsing "API"
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-27 08:59:50 -07:00
Miika Turkia
8e08fdcc85 Clean up CSV import parameters
Continuing the crusade against excessive number of parameters for some
functions. This should be the last of the import functions to be cleaned
up.

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-27 08:59:44 -07:00
Robert C. Helling
c5f92c7501 Rename variable to better reflect what it does
The pressure for the Boyle compensation is of the first ceiling,
i.e. the ceiling seen from the bottom rather than the first
stop.

Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-27 07:03:53 -07:00
Robert C. Helling
fe00abc774 Compute first stop pressure for each round of CVA
Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-27 07:03:41 -07:00
Dirk Hohndel
80e7213582 Update INSTALL and build.sh
They now reference the Subsurface-branch branches of Marble and
libdivecomputer and v0.23.1 of libgit2.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-26 11:44:56 -07:00
Sander Kleijwegt
57e15bf789 Explicitly show the menubar after mainwindow initialisation.
At least on Ubuntu with xfce instead of Unity this appears to be necessary
to get a menu bar for the application.

Fixes #833

Signed-off-by: Sander Kleijwegt <sander@myowndomain.nl>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-26 11:01:37 -07:00