aboutsummaryrefslogtreecommitdiffstats
path: root/core
AgeCommit message (Collapse)Author
2017-10-09Use lrint() for all degrees_t related roundingGravatar Lubomir I. Ivanov
In certain places the '(int)' cast is used, while in other the llrint() or lrint() functions. Make the conversation from degrees in the 'double' form to the 'int' degrees_t consistent using lrint(). lrint() is the function which should give the best results, because it accepts a 'double' and results in a 'long' even if degrees_t is 'int'. If the truncation from 'long' to 'int' is discarding some of the precision then the next step would be to turn degrees_t into a 64bit signed integer type. Possible fix for #625. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2017-10-09Display units in dive list table based on prefs optionGravatar Stefan Fuchs
Add a preferences option which enables or disables display of units in the main dive liste table. Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
2017-10-08VPM-B profile: calculate parameters when in planner modeGravatar Rick Walsh
Calculating parameters when in the planner mode is necessary to display the correct ceiling. Fixes #601 Signed-off-by: Rick Walsh <rickmwalsh@gmail.com>
2017-10-08Fix crash when text emptyGravatar Miika Turkia
Exporting to divelogs.de triggered this bug when divesite name is empty. Fixes #656 Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2017-10-07Store RBT value on DivingLog importGravatar Miika Turkia
Fixed-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2017-10-07Fix divinglog import temperature truncationGravatar Linus Torvalds
The code incorrectly divided the temperature by 10 as an integer, causing unnecessary precision loss due to truncation. Fix it, and update the test results for the now improved temperature import. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-10-07Fix divinglog import limit checkingGravatar Linus Torvalds
The divinglog import did horrible things with the strings returned from the sqlite queries, and ended up using uninitialized values at the end of the secondary profile data strings. This rewrites the import logic to track the length of the strings properly when importing the divinglog data. We should run 'valgrind' a whole lot more than we do, I suspect. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-10-07Make compile succeed without BT_SUPPORTGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-10-07Move ConnectionListModel into its own source fileGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-10-07Safeguards for Liquivision importGravatar Miika Turkia
I have received one sample log where after parsing a bunch of dives properly, the sample count hits zero, and after that it is astronomical. In case of zero, the only data we have is dive date and time of a duplicate dive that we already parsed with proper dive profile. So preventing a crash with this hack without properly understanding the weird file format. Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2017-10-07Fix two bugs in taxonomy_set_countryGravatar Dirk Hohndel
The random coincidence that this code actually ended up working in my tests is weird. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-10-05Merge pull request #641 from Subsurface-divelog/taxonomyCrashFixGravatar Subsurface
Taxonomy crash fix
2017-10-05Prevent crash when adding country to dive siteGravatar Dirk Hohndel
We need to make sure that the taxonomy information has been allocated before assigning values to it... Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-10-05divesite.c: use NULL instead of 0 for char* buffersGravatar Lubomir I. Ivanov
Makes it clearer that these are buffers and not integers like `ds->uuid`. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2017-10-05divesite.c: prevent double free()Gravatar Lubomir I. Ivanov
Reported-by: Benjamin Fogel <nystire@gmail.com> Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2017-10-05Explicitly copy a cylinder which was marked as "unused" in the plannerGravatar Stefan Fuchs
When planning a new dive (not replan!!!) based on an existing (planned) dive, the cylinders from the existing selected dive are copied. This patch guarantees that cylinders which had been marked as "unused" are indeed copied as well. Sounds strange at the first moment but makes sense because if one marks a cylinder explicitly as "unused" in the planner instead of deleting it that does mean that one wants to keep this cylinder to have it available and be able to reenable it later-on. Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
2017-10-04White space and clarifying bracesGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-10-04Whitespace changeGravatar Dirk Hohndel
This is just the indentation change for the code that was inside the loop before. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-10-04Simplify the geo reverse lookup functionGravatar Dirk Hohndel
We never actually create a list of dive sites for which we call the reverse lookup service, it's always just displayed_dive_site. So make this all much simpler and just go straight for that. This commit removes a loop, but doesn't change the indentation of the code inside the loop to make it easier to see what was changed. That whitespace change will be in my next commit. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-10-04Change the signature of constructLocationTagsGravatar Dirk Hohndel
We actually want to be able to pass a specific divesite structure and not have it look that up by uuid. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-10-04fixup taxonomy typeGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-10-04Don't add separate country field, use taxonomyGravatar Dirk Hohndel
The more I looked at the code that added the country to the dive site, the more it seemed redundant given what we have with the taxonomy. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-10-04Add taxonomy copy helper functionGravatar Dirk Hohndel
We don't want to just be able to copy all of a dive site. Sometimes we might want to be able to copy just the taxonomy. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-10-04Add taxonomy helper functionsGravatar Dirk Hohndel
Right now we just want direct access to the country, I assume we'll add more like this in the future. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-10-04When finding deepest ceiling, do not round to multiples of 3mGravatar Robert C. Helling
Fixes #630 Signed-off-by: Robert C. Helling <helling@atdotde.de>
2017-10-04Planner minimum gas calculation: Print delta pressure in resultsGravatar Stefan Fuchs
Print the delta between the required minimum gas result and the cylinder pressure at last bottom datapoint in results. Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
2017-10-02[Divesite] request dive countryGravatar Tomaz Canabrava
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-10-02[Divesite] Load / Save divesite country on gitGravatar Tomaz Canabrava
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-10-02[Divesite] Save / Load the country from xmlGravatar Tomaz Canabrava
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-10-02[Divesite] Add country on divesiteGravatar Tomaz Canabrava
Add more information for the divesite, a country can be used to help sorting. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-10-01VPM-B profile: initialize first_ceiling_pressureGravatar Rick Walsh
If we don't set first_ceiling_pressure at start of dive, a shallow ceiling can be shown when it shouldn't be. Fixes #584 Signed-off-by: Rick Walsh <rickmwalsh@gmail.com> Signed-off-by: Robert C. Helling <helling@atdotde.de>
2017-10-01More VPMB state in special structureGravatar Robert C. Helling
... and reset deco information in profile ceiling computation. The planner test then needs to know about the struct holding the deco state. Signed-off-by: Robert C. Helling <helling@atdotde.de>
2017-10-01Use helper function dive_endtime() where apropriateGravatar Stefan Fuchs
Calculating dive.when + dive.duration doesn't always give the correct endtime of a dive especially when a dive has surface interval(s) in the middle. Using the helper function dive_endtime() fixes this issue. Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
2017-10-01Update sample_start and sample_end pressuresGravatar Miika Turkia
When we merge dives, the sample_start and sample_end pressures are only used in-memory for displaying data to the user. However, we should update them as well as this will show the user the correct data in the equipment/cylinder and i.e. SAC calculation. Fixes #577 Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2017-09-28Save Subsurface version to libdivecomputer logfileGravatar Miika Turkia
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2017-09-28Planner prefs: set all ascent rates to 9m/minGravatar Rick Walsh
9m/min (or 10m/min) is the ascent rate assumed by Buhlmann and navy tables, and the default of most other planning software and dive computers. Setting the default to 9m/min allows the default behaviour to be consistent with "expected" behaviour, but does not prevent the user from changing the preference. There is disagreement between some users whether the final ascent ascent duration should be considered when determining the length of the final stop. This change does not alter that at all, but at 9m/min, the difference is <1min. See #592 Signed-off-by: Rick Walsh <rickmwalsh@gmail.com>
2017-09-22BLE: big writes to connected DC (OSTC firmware)Gravatar Jan Mulder
Most writes to a connected DC are small, typically some command bytes to get DC in download mode, or to set some parameter. All this just worked over BLE, however, sending a full firmware update (on an OSTC device) failed, as the underlying BLE interface can only handle small 20 byte BLE packets at once. So, send max ble->packet_size chuncks at once. Tested for the following cases (linux desktop with OSTC3 over BLE): 1) normal download of dive data. 2) read and write settings from configure UI 3) update firmware (from 2.15 to 2.15) And to my surprise, no flow control credit administration is required here. Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2017-09-20BLE support: simplify write functionGravatar Dirk Hohndel
It seems clearer to bail when list is empty... Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-09-20DC download: fix 'no new dives' messageGravatar Dirk Hohndel
Stupidly, commit 731d9dc9bdf ("DC download: tell user when no new dives were found") was missing the conditional when to show that messages. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-09-20Remove option to apply GFlow at maxdepthGravatar Robert C. Helling
This option should have never been there. This is not how gradient factors are supposed to work. It would only trick users to use the wrong value.. Signed-off-by: Robert C. Helling <helling@atdotde.de>
2017-09-20Add a checkbox to turn off plan variationsGravatar Robert C. Helling
... as those come with a performance penalty Signed-off-by: Robert C. Helling <helling@atdotde.de>
2017-09-20Correct comment for deco subsurface_conservatism_factorGravatar Stefan Fuchs
This adapts the comment according to the change done in bd89e33e765d73aa2b48419031d6922b8bf5eb37 Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
2017-09-17BLE on non-Apple OSs: switch back to using BT addressGravatar Dirk Hohndel
While this interface is deprecated, too much in our existing code depends on being able to create the QLowEnergyController with just the address. Additionally, createCentral() is new in Qt 5.7 and therefor this broke builds on Linux distros that are still on 5.6. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-09-17DC download: tell user when no new dives were foundGravatar Dirk Hohndel
Otherwise it almost looks like something went wrong with the download. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-09-17BLE: try to pick the correct descriptor to write toGravatar Dirk Hohndel
The ordering on Mac appears to be random, but after looking through the various successful logs of BLE downloads, it seems we always wrote to the ClientCharacteristicConfiguration descriptor. So try to find that one first, and only grab the first descriptor in the list if we didn't find a ClientCharacteristicConfiguration descriptor. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-09-17BLE: create controller from QBtDeviceInfoGravatar Dirk Hohndel
Creating it from an address is a) deprecated and b) impossible on Mac or iOS. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-09-17BLE: helper function to get QBtDeviceInfo from UUIDGravatar Dirk Hohndel
Right now this will only work if you scan for your BLE dive computer every time. Ideally we should simply initiate a scan and look for that address if it's not found in the hash. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-09-17BLE: if there's no address, use the UUID insteadGravatar Dirk Hohndel
This is not just for IOS, the same applies on a Mac. But I see no issue with enabling that for all OSs. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-09-15Use dive ID instead of dive number when importing from Shearwater dbGravatar Seppo Takalo
Dive IDs are unique but same dive number can appear multiple times within the same database. This can happen for example when user changes the "next log number" from his computer. Signed-off-by: Seppo Takalo <seppo.takalo@iki.fi>
2017-09-15Convert usage of atof() to strtod_flags()Gravatar Seppo Takalo
The provided strod_flags(str, 0, 0) should work as a drop in replacement for atof() but does not care about locales which may cause atof() to fail. strtod_flags() would allow checking of conversion result, but I did not change the existing logic. This was just regexp search&replace change to get rid of atof(). I use flags 0 to get more relaxed conversion. Fixes #574 Signed-off-by: Seppo Takalo <seppo.takalo@iki.fi>