Commit graph

285 commits

Author SHA1 Message Date
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
Jeremie Guichard
2b06a0b223 Fix potential double/float to int rounding errors
Not using lrint(f) when converting double/float to int
creates rounding errors.
This error was detected by TestParse::testParseDM4 failure
on Windows. It was creating rounding inconsistencies
on Linux too, see change in TestDiveDM4.xml.

Enable -Wfloat-conversion for gcc version greater than 4.9.0

Signed-off-by: Jeremie Guichard <djebrest@gmail.com>
2017-03-09 23:07:30 +07:00
Jeremie Guichard
406e4287eb Change calls to rint into lrint avoiding conversion warnings
Using gcc option "-Wfloat-conversion" is useful to catch
potential conversion errors (where lrint should be used).
rint returns double and still raises the same warning,
this is why this change updates all rint calls to lrint.
In few places, where input type is a float, corresponding
lrinf is used.

Signed-off-by: Jeremie Guichard <djebrest@gmail.com>
2017-03-08 14:04:17 +07:00
Martin Měřinský
d6bfcd5245 In weights table 'weight' is redundant and no used for other types. 2017-03-07 16:22:27 -08:00
Martin Měřinský
186a80fffe Enable translate 'All' in yearly statistics. 2017-03-07 16:22:03 -08:00
Dirk Hohndel
e9debdf281 Add helper to parse duration text
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-03-04 12:16:49 -08:00
Martin Měřinský
b14301a84c heartrate, heartbeat > heart rate 2017-03-04 12:08:17 -08:00
Martin Měřinský
fccfb968c1 Consistent 'salt water' versus 'fresh water'. 2017-03-04 12:08:17 -08:00
Dirk Hohndel
a3a23f63a6 Add subsurface_stat for Mac
Which is also used on iOS.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-02-24 01:14:39 -08:00
Jeremie Guichard
5ed93a9d9e Fix "Load/Save to cloudstorage" for non-ASCII user names
On Windows that would fail because stat() doesn't deal well with our
utf8 strings.

Added new subsurface_stat() portability function to replace stat().
Added Windows implementation of subsurface_stat() using wstat(),
with conversion to ut16 of the inputed path.
Other platform implementations (linux, android) make use of the normal stat().

Added non ASCII test case in TestGitStorage::testGitStorageLocal()

Signed-off-by: Jeremie Guichard <djebrest@gmail.com>
2017-02-24 01:10:22 -08:00
Dirk Hohndel
da50bb1ae5 Dive merge: don't pick an empty dive site
When merging, we should treat an empty dive site (which will be deleted
on save) the same as not having a dive site.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-02-21 18:22:56 -08:00