aboutsummaryrefslogtreecommitdiffstats
path: root/core
AgeCommit message (Collapse)Author
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>
2017-09-15Properly clear sensor pressure data for synthetic plotinfo entriesGravatar Linus Torvalds
We only cleared the first sensor data when we created new synthetic plot info entries, because we only used to have one (well, we had the o2 data, but apparently nobody ever noticed that it didn't get properly interpolated, probably because people who have CCR dives with o2 pressures are few, and the pressure drops are gradual anyway). Clear all the pressure data, so that the interpolation code doesn't think we have some existing real sensor data for the plot info entries in between proper sample entries. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-09-15xml: save the right sensor pressure when we have multiple sensor readingsGravatar Linus Torvalds
The XML saving code got the multi-sensor case completely wrong, because it still had one place where it would always save the first pressure, rather than the pressure from the right sensor. This was hidden by the fact that old data would be saved using the legacy model that only ever used the first sensor slot. Only if you actually had multiple sensor slots used would the bug trigger. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-09-14Refine cylinder usage testsGravatar Miika Turkia
Consider cylinder used also if the first and last sample pressure differ enough Signed-off-by: Miika Turkia <miika.turkia@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-09-13Make the info window show all the pressures we haveGravatar Linus Torvalds
We used to only show the first pressure we had, from back when we only supported a single sensor. Reported-by: Stefan Fuchs <sfuchs@gmx.de> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-09-13Detect dive mode on Shearwater DB importGravatar Miika Turkia
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2017-09-13Don't assume CCR mode when importing from ShearwaterGravatar Seppo Takalo
Logic was assuming CCR mode if field "averagePPO2" was present. Signed-off-by: Seppo Takalo <seppo.takalo@iki.fi>
2017-09-13Fix cylinder changes when importing from Shearwater databaseGravatar Seppo Takalo
Re-do the logic to use add_gas_switch_event() instead of creating event manually. Fix the SQL query to find the proper dive id from dive log number. Signed-off-by: Seppo Takalo <seppo.takalo@iki.fi>
2017-09-13Fix Shearwater cylinder detection logicGravatar Seppo Takalo
Fix the SQL query to find proper dive id instead of assuming log number to be the same as id. Signed-off-by: Seppo Takalo <seppo.takalo@iki.fi>
2017-09-13Ignore missing pressure values when importing from ShearwaterGravatar Seppo Takalo
Shearwater seems to report missing AI sensors as a pressure reading 4092 (raw) which is 564 bar. Signed-off-by: Seppo Takalo <seppo.takalo@iki.fi>
2017-09-11Inform user if there was no dive profile in DL7/ZXU fileGravatar Miika Turkia
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2017-09-11Import dive number from DL7 logGravatar Miika Turkia
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2017-09-11Do not merge dives with zero durationGravatar Miika Turkia
As these are probably manually entered dives with incomplete data, it is better not to merge them. See #561 Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2017-09-11Do not save non-existent timeGravatar Miika Turkia
Note that git storage still encodes the time into file name. Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2017-09-11Do not save duration if it is zeroGravatar Miika Turkia
See #561
2017-09-11Do not save heartbeat to XML if it has not changedGravatar Miika Turkia
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2017-09-11Do not save bearing to XML if it has not changedGravatar Miika Turkia
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2017-09-06Add Cochran dive computers to FTDI listGravatar Dirk Hohndel
Based on information from John Van Ostrand <john@vanostrand.com>. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-09-06Implemented serial_set_break for FTDIGravatar John Van Ostrand
Setting break is required to wake up Cochran DCs (it doesn't make sense to me, but it's needed). Signed-off-by: John Van Ostrand <john@vanostrand.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>