Commit graph

8957 commits

Author SHA1 Message Date
Claudiu Olteanu
74187657e5 Initialize WinSock and hide the information about the local device
On Windows we cannot select a device or show information about the
local device. Therefore we disable the UI section related to local
device details.

Signed-off-by: Claudiu Olteanu <olteanu.claudiu@ymail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-20 22:45:37 -07:00
Claudiu Olteanu
2af14ba445 Add implementation for our custom BTH device discovery service
Implement a custom lookup service for remote Bluetooth devices
discovery. This will be used on Windows platforms to collect
information about the name and the address of a remote Bluetooth
device.

In the beginning we initialize the queryset with the necessary
flags and we start the lookup service. When a device is discovered
we collect information about its name and its address and we
raise a signal with it using the same signature as the one emitted
by QtBluetoothDeviceDiscoveryAgent implementation.

Finally we end the lookup service and we reset the internal flags.

This code was written with the help of the sample code documenting the
relevant APIs provided by Microsoft Corporation at
https://code.msdn.microsoft.com/windowsdesktop/Bluetooth-Connection-e3263296
which is under the MS-LPL. No code from the samples was copied and the
code in this commit is covered by the GPL and not the MS-LPL.

Signed-off-by: Claudiu Olteanu <olteanu.claudiu@ymail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-20 22:45:34 -07:00
Claudiu Olteanu
3b811552aa Add implementation for BTH custom serial write method used on Windows
Implement the write method used for our custom serial implementation
on Windows platforms.

Signed-off-by: Claudiu Olteanu <olteanu.claudiu@ymail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-20 22:45:31 -07:00
Claudiu Olteanu
994087c0b9 Add implementation for BTH custom serial read method used on Windows
Implement the read method used for our custom serial implementation
on Windows platforms.

Signed-off-by: Claudiu Olteanu <olteanu.claudiu@ymail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-20 22:45:28 -07:00
Claudiu Olteanu
23c5dee2f1 Add implementation for BTH custom serial close method on Windows
Implement the close method used on Windows platforms for our custom
serial implementation.

Signed-off-by: Claudiu Olteanu <olteanu.claudiu@ymail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-20 22:45:26 -07:00
Claudiu Olteanu
e2cac92d23 Add implementation for BTH custom serial open method on Windows platforms
Implement the custom serial open method using the WinSocket2 API.
First the device address is converted from text representation into
a sockaddr structure. Then a connection is initiated to the device
using device's Serial Port service.

Signed-off-by: Claudiu Olteanu <olteanu.claudiu@ymail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-20 22:45:23 -07:00
Claudiu Olteanu
7488f5500e Add skeleton for Bluetooth custom serial implementation on Windows platforms
Add a skeleton which will be used to develop the Bluetooth custom
serial implementation for Windows platforms.

Signed-off-by: Claudiu Olteanu <olteanu.claudiu@ymail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-20 22:45:20 -07:00
Claudiu Olteanu
2aa6ffe0c8 Add set_timeout callback for Bluetooth custom serial implementation
The new callback will be usefull when we will implement the support
for Windows. The implementation of native serial set_timeout method
uses a HANDLER on Windows and we will use the WinSock2 API which has
a socket descriptor.

Signed-off-by: Claudiu Olteanu <olteanu.claudiu@ymail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-20 22:45:16 -07:00
Claudiu Olteanu
69c81ed8e4 Reimplement pairingFinished method
The old implementation didn't use the correct deviceLabel pattern.
When the pairing status of a device was changed the name of the device
was missing from the new label. With the new implementation when the
pairing status is changed we replace the old state with the new one and
maintain the device information from the old label.
Also we set the same pairing background colors used in the
addRemoteDevice callback. In this way the label's state is consistent
and the UX is improved.

Signed-off-by: Claudiu Olteanu <olteanu.claudiu@ymail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-20 22:45:13 -07:00
Claudiu Olteanu
a83f59ff09 Clear the BTH discovered devices list on each search
Clear the Bluetooth discovered devices list on each search.
In this way we will show only the devices that are in range
and active during the last scannning. Also if we clear the
list before each call we don't need to check anymore if the
discovered device is already in the list.

Signed-off-by: Claudiu Olteanu <olteanu.claudiu@ymail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-20 22:45:11 -07:00
Claudiu Olteanu
14ca6a4e77 Check the last error when the BTH device scanning is finished
If there is no error reported when the device scanning is finished
then report to the dialog status that the scanning finished
successfully. Otherwise report the last error.

Signed-off-by: Claudiu Olteanu <olteanu.claudiu@ymail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-20 22:45:07 -07:00
Claudiu Olteanu
9f043f4a93 Cleanup Bluetooth local device and the discovery agent on exit
Do some extra cleanup when the BtDeviceSelectionDialog is
destroyed.

Signed-off-by: Claudiu Olteanu <olteanu.claudiu@ymail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-20 22:45:04 -07:00
Tomaz Canabrava
118e978b5a Display dives from the same location on the list
Some dive sites are separated in more than one real dive site
(for instance, a 'blue hole' dive site that has different
entry points on the gps), so instead of checking only the
dive_site id, also check it's name.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-20 22:23:25 -07:00
Dirk Hohndel
a081ffe48e Always save taxonomy data, even if disabled in the prefs
Otherwise, if one of the systems used with cloud storage doesn't have the
preference for geo encoding enabled, the taxonomy data will be lost.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-20 11:05:07 -07:00
Robert C. Helling
0bb65a17cb Use boyle_compensation in profile
otherwise VPM-B planned profiles seem to violate the ceiling. This needs
the first_stop_pressure to be available also in the profile, so I made
it global in planner.c

Important lesson: If you want to use deco_allowed_depth on a tissue_tolerance
that comes from a VPM-B planned dive, you have to call boyles_law() before
add_segment()!

Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-20 07:28:00 -07:00
Robert C. Helling
2a50731139 Leftovers from introduction of in_planner() helper function
I have no idea how these could have been left behind

Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-20 07:25:01 -07:00
Miika Turkia
6c0bcec3e7 Avoid duplicate divesites on Liquivision import
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-19 10:14:56 -07:00
Miika Turkia
9bd683ef35 More precise comments
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-19 10:14:43 -07:00
Sander Kleijwegt
dbf2868dee Restore selection after renumbering dives.
After renumbering any number of selected dives, the selected
dives would still be selected, but this was not visible from
the divelist view. Clicking on subsequent dives would deselect
them while the GUI shows them as selected, any further action
like delete would not be done on the visible selection, but
on the invisible dive->selected state, leading to apparently
very weird behaviour.

Fixes #917

Signed-off-by: Sander Kleijwegt <sander@myowndomain.nl>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-19 10:11:38 -07:00
Sander Kleijwegt
b84e6dfc8a Fix startup crash with missing HOME or LOGNAME environment variables
Check whether setenv returns NULL and if so default to '~' for HOME
and 'default' for LOGNAME.

Signed-off-by: Sander Kleijwegt <sander@myowndomain.nl>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-19 10:11:31 -07:00
Rick Walsh
953470d945 VPM-B: Update critical_volume_lambda
The default value for critical_volume_lambda is 6500 fsw.min (= 199.58 bar.min)
for VPM-B, rather than 7500 fsw.min (= 230.284 bar.min) for VPM.  This is
consistent with V-Planner, MultiDeco, GUE DecoPlanner, HLPlanner and the
comments in the Fortran code explanation.

Signed-off-by: Rick Walsh <rickmwalsh@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-18 09:18:18 -07:00
Robert C. Helling
72806e42bc Replace global in_planner variable by helper function
as promised earlier

Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-18 06:42:01 -07:00
Robert C. Helling
4e89a6020e Get rid of is_ok_vpmb
Since a8ce8, that made deco_allowed_depth work for VPM-B as well, this
function became obsolete but was reintroduced by one of Jan's latest patches.

Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-18 06:40:50 -07:00
Robert C. Helling
159c9eb2c1 Compare ceiling to next stop rather than try to ascent for VPM-B
For VPM-B, to stay within the reference implementation, to decide if we
need to stop we check if the current ceiling is above the next stop depth
rather than trying to ascent and check if we violate a ceiling. This
leads to more conservative profiles.

Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-18 06:40:45 -07:00
Dirk Hohndel
f2b883865c Revert "Pref. to ascent to next stop only when stop is below ceiling"
This reverts commit a6ed36fb73.
2015-08-18 06:40:35 -07:00
Jan Darowski
39794d3478 VPM-B: Fix calculating Boyles compensation on gas change stops.
Previously we were calculating the compensation only on the deco
stops, gas change stops appearing before the first deco stop were
ommited.

Signed-off-by: Jan Darowski <jan.darowski@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-18 06:34:54 -07:00
Robert C. Helling
075221b4ef Explicit names for initialization of deco constants
This patch is purely cosmetic except for the fact it changes the
critical radii to the V-planner with Boyle compensation values.

These values would have been set anyway by Jan's commit
"VPM-B: Set radius constants to values reccomended by V-Planner" which
will conflict with this anyway. This way, the last chunk of Jan's patch
can just be discarded.

Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-17 21:58:09 -07:00
Robert C. Helling
a6ed36fb73 Pref. to ascent to next stop only when stop is below ceiling
Usually, we try to ascent to the next stop and check if we break the
ceiling while doing that. This patch adds a preference value to rather
check if the ceiling is above the next stop before attempting to ascent.

The difference if off-gasing during the ascent is taken into account.

Logically, it does not sound like it could be relevant to ignore that
off-gasing but it leads to more conservative schedules and it seems
the original Fortran VPM-B implementation does just this. So one could
argue it is part of that model (if it makes sense or not), so we should
at least give users the possibility to turn this on.

Maybe we should even make this the default for VPM-B.

This patch just addes the code to have the value in the preferences and
the planner to act accordingly. There is no UI for it, yet. To test, you
have to set it in the code. There could be a later patch with a UI if people
like to have it.

Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-17 21:58:09 -07:00
Robert C. Helling
930e83dfc4 Factor out root of cubic to be used also for update_gradient
We can use the analytic solution of a cubic in two different places.

Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-17 21:47:20 -07:00
Dirk Hohndel
d93984448c Merge branch 'boyle-ready' of https://github.com/Slagvi/subsurface
Fixed merge conflicts in
	deco.c
	dive.h
	planner.c

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-17 21:45:51 -07:00
Miika Turkia
2e8286623d Fix MKVI erroneous sample time
There was a bug in MKVI download tool that resulted in erroneous sample
times. This fix takes care of that and should work similarly as the
vendor's own.

Fixes #916

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-17 21:41:19 -07:00
Robert C. Helling
56c90efba8 Explicit cast to stop compiler warning
Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-17 21:09:22 -07:00
Dirk Hohndel
aa48dfea27 Cmake: automatically create version for Mac bundle
The version info that is used for the Mac bundle is created at cmake run
time, not at make run time.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-17 08:45:15 -07:00
Dirk Hohndel
a41475c339 INSTALL file: update Mac build instructions
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-16 17:42:55 -07:00
Dirk Hohndel
128493ae8a Build script: fix install_name for libssrfmarblewidget on Mac
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-16 17:39:25 -07:00
Dirk Hohndel
530c3a388b Build script: make sure cmake finds Qt on Mac
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-16 16:56:56 -07:00
Dirk Hohndel
fc5bb31a51 INSTALL file: build the latest master / testing branches
The INSTALL file in the sources should show the instructions to build the
latest master - and then be updated to build the latest release as we get
closer to making a release.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-16 14:51:43 -07:00
Dirk Hohndel
476cfec6dc INSTALL file: update the Homebrew install URL
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-16 14:47:00 -07:00
Dirk Hohndel
0a67f7cc95 Build script: make sure we find any library that we installed
Somehow libssh2 wasn't found on Mac builds - this makes sure we always add
the $INSTALL_ROOT/lib as library path.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-16 12:35:25 -07:00
Dirk Hohndel
79f3f18ef6 Cmake: only link against libusb-1.0 if it was found
This should work much better as libusb is really only required if you want
support for all the dive computers (e.g., Atomics Aquatics Cobalt family).

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-16 12:33:28 -07:00
Robert C. Helling
a8ce8c3ef1 Some unification between Buehlmann and VPM-B
This patch makes deco_allowed_depth() work both for Buehlmann as well as
VPM-B (as long as the VPM-B internal variable total_gradient[] is valid).
As a bonus, in VPM-B mode, in the planner, the ceilings are VPM-B ceilings
and not Buehlmann GF.

Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-15 09:10:29 -07:00
Jan Darowski
ffe2884f72 VPM-B: Set radius constants to values reccomended by V-Planner.
V-Planner reccomends smaller values for the VPM with the Boyles
compensation. Also missing units comments were added.

Signed-off-by: Jan Darowski <jan.darowski@gmail.com>
2015-08-15 15:55:46 +02:00
Jan Darowski
6856e87689 VPM-B: Add conservatism levels to the ui. Fix planner settings disabling.
Conservatism level can now be changed from gui, is saved in settings.
Also way of disabling the planner settings in the ui was improved
to support more deco models and be called at the widget creation.

Signed-off-by: Jan Darowski <jan.darowski@gmail.com>
2015-08-15 15:16:51 +02:00
Jan Darowski
cad866013b VPM-B: Add conservatism levels to deco.c
Signed-off-by: Jan Darowski <jan.darowski@gmail.com>
2015-08-15 14:36:07 +02:00
Jan Darowski
499ec9af2f VPM-B: Add surface decompression time.
Now, we calculate the volume of free gas not only based on the deco
time but also time on the surface, needed for the full desaturation.

Signed-off-by: Jan Darowski <jan.darowski@gmail.com>
2015-08-15 14:32:36 +02:00
Dirk Hohndel
2455a5dec7 Merge branch 'custom-print' of github.com:neolit123/subsurface 2015-08-15 05:22:07 -07:00
Jan Darowski
c0fde4f50f VPM-B: Add Boyles compensation to the planner.
Signed-off-by: Jan Darowski <jan.darowski@gmail.com>
2015-08-15 14:21:18 +02:00
Jan Darowski
a828d528f9 VPM-B: Add simple Boyle's law compensation.
This is a very basic implementation that uses bin search for solving the cubic.
It's not called anywhere at this stage, needs to be changed to analytic solution.

Signed-off-by: Jan Darowski <jan.darowski@gmail.com>
2015-08-15 14:09:51 +02:00
Gehad elrobey
f3c5699714 Printing: remove silly white line at end of each page
QPrinter::pageRect() doesn't always return the correct value of the
printable area, which results in white horizontal lines of un-rendered
area at the bottom of each page, Use QPrinter::pageLayout() instead
which fixes the issue.

QPrinter::pageLayout() is added in QT 5.3, So use pageRect for previous
versions.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
2015-08-15 15:05:26 +03:00
Gehad elrobey
5892fb5762 Printing: fill the QPainter background color before rendering
While rendering a dynamically sized view port, it may not fit the full
page size, But the background color should be the same for the whole
page, So fill the page background color with the template background
color before rendering.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
2015-08-15 15:05:22 +03:00