Add call of initial calculation of critical radius and start gradient,
so the VPM could work.
Currently without CVA, so the gradient isn't improved.
Only one iteration is run.
Signed-off-by: Jan Darowski <jan.darowski@gmail.com>
Check during the trial_ascent() if existing pressure gradient is
smaller than previously calculated max gradient. If not, ascent
is impossible from the vpm-b's point of view.
Signed-off-by: Jan Darowski <jan.darowski@gmail.com>
Calculate the max difference between tissue saturation and ambient
pressure that can be accepted during the ascent.
Partial results are kept for later improving in next CVA iterations
Signed-off-by: Jan Darowski <jan.darowski@gmail.com>
Removed recreational mode from ui and pref and replaced it with
new deco_mode enum.
Added radio button ui selection.
Set default deco_mode to Buehlmann algorithm.
Signed-off-by: Jan Darowski <jan.darowski@gmail.com>
This function calculates the size of nuclei at the end of deco,
then simulates their regeneration, to the moment before the deco.
This is redundant as nuclear regeneration is a very slow process.
Function should be called with time in seconds, just before the ascent.
Signed-off-by: Jan Darowski <jan.darowski@gmail.com>
According to mathematica
In[4]:= f[x_] := x^3 - b x^2 - c
In[18]:= Solve[f[x] == 0, x]
Out[18]= {{x ->
1/3 (b + (
2^(1/3) b^2)/(2 b^3 + 27 c + 3 Sqrt[3] Sqrt[4 b^3 c + 27 c^2])^(
1/3) + (2 b^3 + 27 c + 3 Sqrt[3] Sqrt[4 b^3 c + 27 c^2])^(1/3)/
2^(1/3))}, {x ->
b/3 - ((1 + I Sqrt[3]) b^2)/(
3 2^(2/3) (2 b^3 + 27 c + 3 Sqrt[3] Sqrt[4 b^3 c + 27 c^2])^(
1/3)) - ((1 - I Sqrt[3]) (2 b^3 + 27 c +
3 Sqrt[3] Sqrt[4 b^3 c + 27 c^2])^(1/3))/(6 2^(1/3))}, {x ->
b/3 - ((1 - I Sqrt[3]) b^2)/(
3 2^(2/3) (2 b^3 + 27 c + 3 Sqrt[3] Sqrt[4 b^3 c + 27 c^2])^(
1/3)) - ((1 + I Sqrt[3]) (2 b^3 + 27 c +
3 Sqrt[3] Sqrt[4 b^3 c + 27 c^2])^(1/3))/(6 2^(1/3))}}
For the values of b and c encounterd in the algorithm, the first solution is in fact the
only real one that we are after. So we can use this solution instead of doing a binary
search for the root of the cubic.
Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Jan Darowski <jan.darowski@gmail.com>
Add new structures holding vpm-b state.
Add function calculating current crushing pressure.
Call it from add_segment() on every ambient pressure change.
It determines what pressure acts on nuclei during the descent
and thus their size at the beggining of the deco.
Signed-off-by: Jan Darowski <jan.darowski@gmail.com>
This function calculates the pressure inside the nucleon
during the impermeable phase.
In the original code, Newton's method is used, for simplicity, we
use binary search for finding cubic equations root.
Signed-off-by: Jan Darowski <jan.darowski@gmail.com>
Created vpmb_config structure based on buehlmann_config.
Set it's default values to ones taken from the existing C implementation.
Signed-off-by: Jan Darowski <jan.darowski@gmail.com>
Remove several very noise messages on dive site handling (this seems to
work well now, so I think we can remove most of them - a couple were left
that indicate actual issues).
And also remove all the calls to "translate" when outputting data to
stderr. Error messages that indicate issues where the user will basically
have to come and ask the developers for help shouldn't be localized. They
should be in English to make it easier for us to figure out what's going
on.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
No point in searching for the right tag if the user picked no taxonomy to
be shown. And no point in showing an empty value, either.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
There are a number of web servies we could use. All have their drawbacks.
This one is free with free data. It's daily limits are reasonably high.
For many coordinates I tested the results were good, for others at least
not terrible.
We can always consider supporting multiple such services. But for now this
seems like a reasonable choice.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
When libdivecomputer switched to the DC_FIELD_TANK API it apparently
stopped creating fake pressure samples at the start and end of a dive for
dive computers that don't have continuous pressure reporting but that
instead only report those two values.
This updates our code to take those values into account.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
A bit more complex than I tought it would be (and a ton of trial
and error to find the right spot on the delegate to draw stuff)
this delegate follows the current style (so it should be okaish
on a dark and on a light theme)
This is supposed to work on a QCompleter, but it doesn't (I really don't
know why, so maybe I'll remove that completer. sigh.)
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
All of dive site information is now exposed to the model
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This is a functional but hard to expand model for the dive sites.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This isn't perfect - I'd like to have them show behind the word Location
instead as what we have now creates movement in the position of the fields
on the screen which I think is distracting.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
If taxonomy data are available we are switching a dive site entry from
single item with attributes to an item that has children. This is
backwards compatible and older versions will simply ignore the children.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This is designed to store taxonomy information for dive sites, including
information where the data came from.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This was intended to help us fine libssh2, but since it works as is now,
and the typo makes the entry pointless, I'm pretty sure that this isn't
needed.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This updates the android build script to something that uses CMake.
This can't produce a working APK yet, but it at least builds the shared
object which should be wrapped into the APK.
Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This is the first step to be able to build Subsurface with CMake for
Android.
Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Qt for android doesn't have any printing support, so this fixes
NO_PRINTING so we can build against a Qt without any printing support at
all.
Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This re-introduces the NO_USERMANUAL flag, which is needed due to the
fact that Qt-Android doesn't have a WebView to view the manual in.
Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
If we download dive site locations from the companion app we can be
slightly smarter if the user overwrite the location feel on the Notes tab.
We can be pretty sure that they wanted to keep the GPS location and just
correct the dive site name (or possibly assign that location to an
existing dive site).
This tries to accomplish that.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This may be too subtle... the current dive site now has a brighter flag
than the others. I may need to make it an even bigger difference or maybe
make the flag a little bigger or something... but it's a start.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>