aboutsummaryrefslogtreecommitdiffstats
path: root/core
AgeCommit message (Collapse)Author
2017-12-19git storage: invalidate cache on merge dive siteGravatar Jan Mulder
In hindsight a very simple bug to fix, but it requires some knowledge on the inner workings of our git storage. The changes on merge of dive sites were simply not saved (completely) because the git storage code has a cache that we need to invalidate selectively (ie. for the dive we just gave a new dive site uuid) to get things finally embedded in the overall commit. The main reason this bug went unnoticed for more than 2 years is that most people use the XML/SSRF format (where this problem is non exsistent), and dive site merging is probably not a very much used feature either. Fixes: #939 Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2017-12-18core: ignore bogus m in cylinderGravatar Jan Mulder
A bogus key/value pair was introduced in the cylinder, consisting of a lonely "m" without value. This is caused by commit 46004c39e26 and fixed in 48d9c8eb6eb0. See referenced commits for more info. Just ignore this key/value pair. No processing is broken due to this, as the git storage stores only metric SI type data. In fact, the m unit is superfluous anyway. Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2017-12-18Allow to read factor cache concurrentlyGravatar Robert C. Helling
In a session with the profile I saw that the planner spends a lot of time waiting to obtain the lock for the factor cache. Most of the time we are only reading that cache and that is save to do in parallel (according to the Qt IRC channel). So we can use a QReadWriteLock instead of a QMutex. This appears to be quite a performance boost, in particular for VPM-B Signed-off-by: Robert C. Helling <helling@atdotde.de>
2017-12-18Elevate "can't write hashes" message from debug to warning levelGravatar Berthold Stoeger
I never realized that my hashes weren't written, because it only outputs a debug instead of a warning message. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2017-12-18core: fix git storage save (regression 4.7.4 -> 4.7.5)Gravatar Jan Mulder
Commit 46004c39e266fe7 introduces a new field in the logbook outputs (depth of a cylinder). While in XML the depth unit is stored with a space between value and unit (m), in our git storage, the unit m is without space. As the git storage parser uses a space to separate individual key/value pairs, the erroneously saved space results in parsing warnings when opening the logbook. The unwanted space is normally saved just after download of a new dive from the dive computers, so all desktop-git-storage uses are affected, and more worrying, mobile beta users. Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2017-12-17CLeanup: remove duplicate typedefGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-12-17Cleanup: durations are now signedGravatar Dirk Hohndel
Somehow a whitespace fix snuck in here. Oops. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-12-17Unify float calulations: use doubleGravatar Berthold Stoeger
Internal floating point (FP) calculations should be performed using double unless there is a very good reason. This avoids headaches with conversions. Indeed, the vast majority of FP calculations were already done using double. This patch adapts most remaining calculations. Not converted where things that were based on binary representations and variables which weren't used anyway. An analysis of all instances follows: core/plannernotes.c, l.404: This was a comparison between two floats. On the left side, first an integer was cast to float then multiplied with and integer and divided by a constant double. The right hand side was an integer cast to a float. Simply divide by 1000.0 first to convert to double and continue with calculations. On the right hand side, remove the cast, because the integer will be implicitely cast to double for comparison. This conversion actually emits less instructions, because no conversion to double and back is performed. core/planner.c, l.613: Same analysis as previous case. subsurface-desktop-main.cpp, l.155: A local variable representing the version OpenGL version. Turn this into integer logic. Not only does this avoid dreaded FP rounding issues, it also works correctly for minor version > 10 (not that such a thing is to be expected anytime soon). abstractpreferenceswidget.[h/cpp]: A widget where the position is described as a float. Turn into double. desktop-widgets/divelogexportdialog.cpp, l.313: total_weight is described as float. Use double arithmetics instead. This instance fixes a truncation warning emitted by gcc.
2017-12-14Remove function isCloudUrl()Gravatar Berthold Stoeger
The function isCloudUrl() was only called in one place, parse_file(). But, isCloudUrl() could only return true if the filename was of the git-repository kind (url[branch]). In such a case, control flow would never reach the point where isCloudUrl() is called, since is_git_repository() returns non-NULL and the function returns early. Therefore, remove this function. Moreover, adapt the affected if-statement by replacing "str && !strcmp(str, ...)" with the more concise "same_string(str, ...)". Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2017-12-13Enable removal of pictures from different dives at the same momentGravatar Stefan Fuchs
Suggested-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at> Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
2017-12-13applying gps fixes: group repetitive code under a macroGravatar Jan Mulder
See 2182167b533b4c. Keep the dupicated code in sync. Originally-by: Salvador Cuñat <salvador.cunat@gmail.com> Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2017-12-13Do not prefer gps fixes just for being into dive timeGravatar Jan Mulder
See commit 6f42ab46da1b5956. Unfortunately, this code is duplicated (and an obvious candidate for code cleanup). So replicate the mentioned commit here. In fact, the mentioned issue #666 talkes about the mobile app, and the fix was only done for the desktop. Originally-by: Salvador Cuñat <salvador.cunat@gmail.com> Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2017-12-13Add pSCR divemode detectionGravatar Jan Mulder
In libdivecomputer, a new divemode is added (DC_DIVEMODE_SCR) useful for dive computers that have specfic functionality for semi-closed rebreathers. At this moment, only the HW computers seem to provide this. This commit takes care of proper recognition of this new divemode when importing data from a dive computer. Tested on an actual import from an OSTC3 that contained dives in this new mode. Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2017-12-13Rename DC_DIVEMODE_CC to DC_DIVEMODE_CCRGravatar Jan Mulder
This is just code cleanup. Jef renamed the CCR divemode constant in libdivecomputer, but added a define to be backward compatible as as well (so this rename did not break our Subsurface build). Obviously, this breaks the build for people that build against an older libdivecomputer, but I see no reason to do that. Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2017-12-12Update to the latest libdc versionGravatar Dirk Hohndel
This gets us the first merge with the upstream iostream implementation. This requires a small change for serial_ftdi.c to build. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-12-11Use the copy_string() helper function in set_filename()Gravatar Berthold Stoeger
copy_string() does the same as the current code, but in one instead of four lines. Strictly speaking, it does not exactly the same thing because the empty string ("") case is handled differently. copy_string() returns NULL instead of a copy of "", which is probably preferred anyway. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2017-12-11Remove second parameter (bool force) in set_filename()Gravatar Berthold Stoeger
The last force=false case was removed in commit 96d1cc570e31396039e4970d2bf75d5f00f1e550. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2017-12-10location service: reduce default thresholdsGravatar Salvador Cuñat
Current values (1000m, 10 min) may be too long to choose an accurate fix while automatically applying gpsfixes to dives. They are fine if we are diving from a static position, but will give wrong positions e.g. while drift diving. Reducing the default values to shorter 100m, 5min won't hurt most dives from shore or static boats, but will make other diving styles get more accurate gpsfixes. signed-off-by: Salvador Cuñat <salvador.cunat@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-12-08Cleanup: remove unused parameterGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-12-08Cleanup: rename file to avoid confusionGravatar Dirk Hohndel
Depending on the tooling, both divesite.c and divesite.cpp would compile into divesite.o. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-12-07Show BT device names firstGravatar Robert C. Helling
Show them left of address (so they are in the user's view) rather than on the right. Signed-off-by: Robert C. Helling <helling@atdotde.de>
2017-12-06Allocate CheckCloudConnection object on stackGravatar Berthold Stoeger
Fixes a memory leak: CheckCloudConnection was allocated on the heap, but never deleted. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2017-12-06Remove self-include of core/checkcloudconnection.hGravatar Berthold Stoeger
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2017-12-05Gracefully handle cloud authentication failure in verbose modeGravatar Berthold Stoeger
If the credential functions return GIT_EUSER, a call to git_remote_fetch fails, but giterr_last() may return NULL. This led to a crash in verbose mode. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2017-12-04Gracefully handle deletion of a picture that doesn't existGravatar Berthold Stoeger
The list iteration in dive_remove_picture() was buggy and would crash if handled a picture that is not in the list. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2017-12-03Free unused git repository in git_create_local_repo()Gravatar Berthold Stoeger
In this function, a repository is created, but the returned object is not used. Might just as well free it. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2017-12-02Add debug output for vendor/product tuplesGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-12-02Add Heinrichs Weikamp BLE dive computers for iOSGravatar Dirk Hohndel
Not all OSTC 2, 3, and Sport support BLE, but newer models do. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-12-02iOS: save BT DeviceInfo on discoveryGravatar Murillo Bernardes
On iOS save all discovered devices. Later qt_ble_open queries this list in order to actually connect to the remove device. The Desktop code stores this data with the list items and only saves when the "Save" button is clicked. This is not supported with the current ConnectionListModel implementation. Signed-off-by: Murillo Bernardes <mfbernardes@gmail.com>
2017-12-02Fix file:// handling for git access.Gravatar Berthold Stoeger
Currently, in is_remote_git_repository(), git URLs of the form "file://..." are recognized as local and the "file://" prefix is removed. The shortened URL is then processed as if it was a remote URL, which of course has to fail. So far so good - this is not a remote repository after all. But the removal of the prefix is not propagated to the calling is_git_repository() function and handling as a local git repository therefore fails likewise. To fix this issue, move removal of the "file://" prefix one level up to the is_git_repository() function. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2017-12-01Remove unnecessary #include and correct whitespaceGravatar Robert C. Helling
Signed-off-by: Robert C. Helling <helling@atdotde.de>
2017-12-01Document background computation of variationsGravatar Robert C. Helling
Update changelog, update user manual, clarify meaning in dive notes. Signed-off-by: Robert C. Helling <helling@atdotde.de>
2017-12-01Disable plan variation in recreational modeGravatar Rick Walsh
Calculating variations when in recreational mode doesn't make sense, and can prevent variations from being calculated when switching back to Buhlmann or VPM-B modes. Signed-off-by: Rick Walsh <rickmwalsh@gmail.com>
2017-12-01Round up diveplan duration the same way values in diveplan are roundedGravatar Stefan Fuchs
Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
2017-12-01Actually compute variations in backgroundGravatar Robert C. Helling
This reenables the computation of plan variations but now in a separate thread. Once finieshed, a signal is sent to update the notes. Signed-off-by: Robert C. Helling <helling@atdotde.de>
2017-12-01Cut off excessive deco timesGravatar Robert C. Helling
before we run out of memory. Diving deep with air and small GFhigh can cause those (try GF 30/70 at 75m with 25+min bottom time) Signed-off-by: Robert C. Helling <helling@atdotde.de>
2017-11-29Fix signed/unsigned issueGravatar Dirk Hohndel
Also deal with an unused argument in the case of a Subsurface-mobile build. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-11-29Remove commented out codeGravatar Miika Turkia
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2017-11-29Move Divinglog DB import into its own fileGravatar Miika Turkia
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2017-11-29Move Cobalt DB import to its own fileGravatar Miika Turkia
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2017-11-29Move Shearwater DB import into its own fileGravatar Miika Turkia
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2017-11-29Move Suunto DB import into its own fileGravatar Miika Turkia
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2017-11-28Merging dives: Improve merging of divemaster, buddy and notesGravatar Stefan Fuchs
Change the merging behavior for the following information: Divemaster, buddy, suit: From "(a) or (b)" to "a, b" Notes: From "(a) or (b)" to "a\n--\nb" Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
2017-11-27Hopefully fix Android buildGravatar Miika Turkia
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2017-11-27Move Cobalt and Divinglog DB parsing to parse-db.cGravatar Miika Turkia
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2017-11-27Move atoi_n to parse.cGravatar Miika Turkia
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2017-11-27Move Shearwater DB parsing into parse-db.cGravatar Miika Turkia
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2017-11-27Move metric variable to parse.cGravatar Miika Turkia
This is required when moving Shearwater DB parsing into parse-db.c Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2017-11-27Move add_dive_site to parse.cGravatar Miika Turkia
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2017-11-27Move Suunto DB imports into parse-db.cGravatar Miika Turkia
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>