Commit graph

295 commits

Author SHA1 Message Date
Dirk Hohndel
b368ecd5aa Add SPDX header to remaining core files
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-04-29 13:32:55 -07:00
Dirk Hohndel
6399eaf271 Add SPDX header to core C files
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-04-29 13:32:55 -07:00
Robert C. Helling
5c98cf35d7 Change the Bluetooth connect call signature
By copying a line from the Linux bluetooth code I can download
from OSTC dive computers on Mac. Don't ask me why this works.

Signed-off-by: Robert C. Helling <helling@atdotde.de>
2017-04-28 17:55:22 -07:00
Jan Mulder
12a59ef313 Correct divesite geocoding translation
See https://github.com/Subsurface-divelog/subsurface/issues/345. The
menues where not translated. The basis of this error is a simple
typo in core/taxonomy.c where the classname was mis-spelled in the
QT_TRANSLATE_NOOP. In addition, to pull and translate the strings
from C code, the normal tr() does not work, and the functionality
from the gettextfromc class is used.

Fixes: #345

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2017-04-26 05:34:40 -07:00
Jan Mulder
9b5d3b60ab Do not carry po2 setpoint data over dive boundaries
The file static po2 value, used to set the setpoint data, was not re-initialized
at the parsing of a dive during import from the divecomputer. So, in one import session,
the po2 was transferred from one dive to the next, obviously resulting in weird bugs, due
to possible wrong po2 settings.

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2017-04-24 07:51:12 -07:00
Dirk Hohndel
2182f00177 Reduce default verbosity
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-04-22 12:38:59 -07:00
Robert C. Helling
dfe5092222 Identify user provided notes in plain text in replan
This is another attept at the problem if identifying a potentially
user supplied text in the dive notes upon replannig a dive.

It gets rid of the user visable position markers (*!* and ***) and
cirumvents problems with mark-up by first converting the old notes
to plan text (assuming that user only enters plain text in the notes
field as we do in other places as well). Then the automatically added
part is identified by locating the disclaimer in the text (if the user
edited/delted the disclaimer or changed langue in between it is her
problem to manually delete the old plan).

Everything from the disclaimer on is deleted and replaced by the new plan.

If the disclaimer is not found, the new plan is appended to the old notes.
This way we make sure no information gets automatically deleted.

Signed-off-by: Robert C. Helling <helling@atdotde.de>
2017-04-20 10:57:47 -07:00
Jan Mulder
9b8fc9f64a Show % after Büllmanns GFs
2 strings in the planner output showed based on "Bühlmann ZHL-16B with GFLow = "
gradient factors without % after the factor. While this is fine for an
abbreviated form like GF 40/80, this looks strange for a verbose sentence like
the 2 corrected ones.

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2017-04-20 10:57:11 -07:00
Miika Turkia
0bce84b09d Support for new DM5 blob format
Currently we do not know what the extra data in the sampleBlob is, but
the block size must be adjusted nevertheless.

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2017-04-20 10:55:19 -07:00
Miika Turkia
58a25d33ce Attempt latin1 parsing on import
We parse input XML using UTF-8 encoding by default. If this fails, try
latin1 instead.

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2017-04-18 18:13:05 -07:00
Stefan Fuchs
a5d54b04a7 Handle notes from planner
New strategy to identify old planner output in notes when
replanning a dive: Text anchors ("*!*" and "***") added for planner output

For backwards compatibility: If there is no anchor but an old table
delete everything.

Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
2017-04-16 07:42:32 -07:00
Jef Driesen
f8203b8efe Cleanup some unnecessary include statements
Some of these header files are no longer necessary, and will be removed
from libdivecomputer in the near future.

Signed-off-by: Jef Driesen <jef@libdivecomputer.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-04-13 18:02:47 -07:00
Jef Driesen
241bd9aa15 Fix building against upstream libdivecomputer
The custom_serial.h header doesn't exist in upstream libdivecomputer.

Signed-off-by: Jef Driesen <jef@libdivecomputer.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-04-13 18:02:39 -07:00
Miika Turkia
e355037e20 Ignore empty cylinders on Cobalt import
It appears that Cobalt might include additional gas mixes, and only way
to determine what is used appears to be to ensure that start and end
pressures are greater than 0. One would assume there to be something
else available in the database, but I was not able to spot it.

Fixes #297

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2017-04-11 17:26:31 -07:00
Robert C. Helling
6afcbeef4d Move version and date around notes to save space
This prints this information in the header near
"Subsurface" where I guess at least the version information
belongs. Plus it saves a line.

Signed-off-by: Robert C. Helling <helling@atdotde.de>
2017-04-06 18:29:11 -07:00
Stefan Fuchs
c9c9b1b399 Add creation date and Subsurface version to planner output
Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
2017-04-06 18:29:11 -07:00
Dirk Hohndel
34a42d7f04 Shift fake tank pressures up by 30bar
This is a rather arbitrary value, intended to create actually valid
pressure values for Uwatec Memomouse users - since we treat 0bar as
invalid pressure value, this simply creates an arbitrary '30bar + delta'
to '30bar' consumption graph (since all the Memomouse devices give us is
the pressure delta that was used during the dive).

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-03-30 11:44:45 +02:00
Dirk Hohndel
09b5f9b99c Accept 0 as valid endpressure for Uwatec devices
Instead of delivering the actual start and end pressure, memomouse
gives you a start pressure that matches the delta between actual
start and end pressure, and an end pressure of zero. Who the heck
knows why it does that, but the information is better than nothing,
so we should accept it.

Fixes #286

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-03-29 14:00:16 +02:00
Robert C. Helling
1b744c7639 Always show notes when replanning
... as per popular request. Plus adding const keyword to constant
strings.

Signed-off-by: Robert C. Helling <helling@atdotde.de>
2017-03-28 13:31:45 -07:00
Robert C. Helling
d344779c47 Fix missing slash in markup
Reported-by: Stefan Fuchs
Signed-off-by: Robert C. Helling <helling@atdotde.de>
2017-03-28 13:31:45 -07:00
Robert C. Helling
eefa390e5f Handle notes in replan
Upon replanning a dive, we want to delete the old
dive plan in the notes and replace it with the actual.

This fixes a problem when we failed to detect the old plan due
to the deco model name appearing in the disclaimer that was used
as a marker for the notes.

This patch also adds translation markers for the deco model name strings..

Fixes #285

Signed-off-by: Robert C. Helling <helling@atdotde.de>
2017-03-28 13:31:45 -07:00
Jan Mulder
bb31c77597 minimal pO2 threshold: split max threshold into min and max
Nothing really special here. Just a split of the only p02 max threshold into
a min threshold and max threshold, and the adaptation of the UI. Change of
translatable strings included.

ref: https://github.com/Subsurface-divelog/subsurface/issues/259

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2017-03-28 11:17:03 -07:00
Miika Turkia
1d0281c923 Fix a crash when git init fails
This can occur e.g. if directory permissions prevent one from writing to
the local cloud storage directory. (Such a crash was discussed on
mailing list.) The error message on GUI is misleading, claiming that
cloud connection failed...

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
---
We probably should check the return value of other git operations as
well, but going for bare minimum for now.
2017-03-28 11:12:36 -07:00
Jeremie Guichard
597539ce39 Fix double to int truncation in C++ code
Wfloat-conversion enabled for C++ part of the code
Fix warnings raised by the flag using lrint

Original issue reported on the mailing list:
The ascent/descent rates are sometimes not what is expected.
E.g. setting the ascent rate to 10m/min results in an actual
ascent rate of 9m/min.
This is due to truncating the ascent rate preference,
then effectively rounding up the time to reach each stop to 2s intervals.
The result being that setting the ascent rate to 10m/min
results in 20s to ascend 3m (9m/min), when it should be exactly 18s.

Reported-by: John Smith <noseygit@hotmail.com>
Reported-by: Rick Walsh <rickmwalsh@gmail.com>
Signed-off-by: Jeremie Guichard <djebrest@gmail.com>
2017-03-24 09:39:25 -07:00
Jan Mulder
d6003209d6 Subsurface-mobile: do send decimal GPS to Google
Sending nicely readable formatted coordinates to Google Maps does not
result in a correctly positioned map. Google likes unreadable
decimal format.

Little hacky solution. Added a gps_decimal attribute, populate that
with the standard function for format a coordinate to string, but
reset the preferences value temporarly so that it always converts it
to decimal style.

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2017-03-24 09:35:00 -07:00
Stefan Fuchs
258aa70d04 Add 10l 200bar and 232bar cylinder
Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
2017-03-20 21:38:20 -07:00
Stefan Fuchs
6f21d2749e Tests for minimum gas
Add automatic tests in TestPlan for minimum gas:
- Copy minimum gas result (pressure) to diveplan.
- Add cylinder size and working pressure for bottom gas to every dive in TestPlan
  Hint: Unrealistic cylinder sizes (100l, 200l) have to be used for the very long and deep dives in TestPlan
- Add minimum gas check for every dive
- Add two additional test dives in TestPlan which produce sane minimum gas results with 24l tank
  Hint: Deco check for these new dives is commented out at the moment

Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
2017-03-19 17:11:52 -07:00
Stefan Fuchs
ce420d7720 Prevent overflow in minimum gas calculation
For the "crazy" long and deep dives in "TestPlan" an overflow happened here.
Rearranged the calculation to have more margin.

Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
2017-03-19 17:11:52 -07:00
Martin Měřinský
3d89914633 Use GFLow, GFHigh (not GFlow, GF Low, GF low). 2017-03-13 10:28:06 -07:00
Martin Měřinský
4f96afff99 Safetystop > Safety stop 2017-03-13 10:28:06 -07:00
Lubomir I. Ivanov
b2c13f4178 qtserialbluetooth.cpp: mark qt_serial_get_transmitted() as unused
The function is unused, to silence the warning add the "unused"
GCC attribute to the function declaration.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-03-12 09:19:08 -07:00
Lubomir I. Ivanov
7bfeb95613 planner.c: fix a couple of float -> int cast warnings
Use lrint() to fix both:

1)
core\planner.c:902:23: warning: conversion to 'int' from 'doub
le' may alter its value [-Wfloat-conversion]

2)
core\planner.c:907:21: warning: conversion to 'int32_t' from '
double' may alter its value [-Wfloat-conversion]

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-03-12 09:19:06 -07:00
Lubomir I. Ivanov
bcad5ddd38 Only enable -Wmissing-field-initializers for Clang
The following pragma is Clang specific:

It produces a warning:
warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]

Only enable it for Clang by checking the __clang__ macro.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-03-12 09:18:59 -07:00
Dirk Hohndel
11a8ab6b1b Undo one lrint change
As here we actually do want the rounded floatingpoint value.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-03-11 08:52:38 -08:00
Dirk Hohndel
16276faa45 Remove unused static functions
These became obsolete with commit e2bbd0ceec ("Rewrite cylinder
merging code from scratch").

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-03-11 08:51:16 -08:00
Dirk Hohndel
a733aaf967 Remove unused variable
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-03-11 08:43:24 -08:00
Dirk Hohndel
08284275e7 Merge branch 'master' of https://github.com/dje29/subsurface 2017-03-11 08:41:41 -08:00
Dirk Hohndel
b8b858a9d2 Fix build after merges
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-03-11 08:38:24 -08:00
Martin Měřinský
2784ce175a Dive No. > Dive # 2017-03-11 08:09:07 -08:00
Martin Měřinský
c4310396a9 divespot > dive spot 2017-03-11 08:09:07 -08:00
Martin Měřinský
9dccf50396 divelog > dive log 2017-03-11 08:09:07 -08:00
Martin Měřinský
f24e0ba5ec divemode > dive mode 2017-03-11 08:09:07 -08:00
Martin Měřinský
95d5771513 We use 'setpoint' in UI. Use it also for documentation and comments. No semantic change. 2017-03-11 08:09:07 -08:00
Martin Měřinský
dcf2542215 Use abbreviations with dots. 2017-03-11 08:09:07 -08:00
Martin Měřinský
a9d361574e unkn > unknown 2017-03-11 08:09:07 -08:00
Martin Měřinský
9b93397ec2 SAC: %.*f%s/min versus SAC:%.*f %s 2017-03-11 08:09:07 -08:00
Robert C. Helling
eae4bd82a5 Change type of divedatepoint.depth to depth_t
... for consistency, while we are at it.

There are still some internal depth variables which are ints
somebody might take a go at those.

Signed-off-by: Robert C. Helling <helling@atdotde.de>
2017-03-11 08:03:25 -08:00
Robert C. Helling
295b1b78d8 Make depth conversion work for negative depths
This is needed in the altitude pressure conversion as there
negative altitudes are possible (for diving in the netherlands
or the Dead Sea).

Signed-off-by: Robert C. Helling <helling@atdotde.de>
2017-03-11 08:03:25 -08:00
Stefan Fuchs
8a4d3876d6 Disable minimum gas calculation for recreational mode
Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
2017-03-11 08:01:35 -08:00
Stefan Fuchs
7f8c3592ce Minimum gas calculation - Calculations and UI parameters
Add minimum gas calculation to planner output.
Add the two UI parameters prefs.sacfactor and prefs.problemsolvingtime.
Connect UI signals and slots for recalculation of diveplan.

Disable minimum gas calculation if there was already a warning before.
If minimum gas result is larger then cylinder start pressure give warning message instead of result.

Add line break before pO2 warnings but only if warnings exist.

Signed-off-by: Joachim Ritter <jritter@bitsenke.de>
Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
2017-03-11 08:01:35 -08:00