aboutsummaryrefslogtreecommitdiffstats
path: root/core
AgeCommit message (Collapse)Author
2017-11-16windows.c: enable verbose level 1 for desktop usageGravatar Lubomir I. Ivanov
If the user has not started Subsurface from a terminal make sure that verbosity is enabled (verbose = 1), so that the log files are populated with information useful for debugging. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2017-11-16During DC import reset cns, ndl, other values inbetween divesGravatar Stefan Fuchs
Reset cns and heartbeat to 0 Reset ndl and bearing to -1 Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
2017-11-16For surface samples init ndl and compass bearing from prev sampleGravatar Stefan Fuchs
This avoids printing useless info to the XML file. Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
2017-11-16libdivecomputer.c init sticky values for samples for current sampleGravatar Stefan Fuchs
When filling samples with values during DC import fill sticky values like CNS, NDL, stoptime,... immediately into current sample. Otherwise we will not fill the sticky values into the last sample created. Add two new sticky values: heartbeat and bearing Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
2017-11-13New fixup function fixup_dc_ndlGravatar Stefan Fuchs
Fixup the NDL value to '-1' at the very beginning of a dive. Some dive computer report a NDL of 0 at the very beginning of a dive and then only some 10 seconds later they report the correct value like 240 min for the first time. Translate this 0 at the beginning of a dive into our internal '-1' for no info available. Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
2017-11-13Init every struct sample with default valuesGravatar Stefan Fuchs
Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
2017-11-13Display values in info box only if value is interestingGravatar Stefan Fuchs
Type duration_t changed from uint to int. Default value of '-1' introduced for some of the values in struct sample: NDL used -1 as default. Bearing uses -1 as default (no bearing set). Display pXX, EAD, END, density, MOD only if values are larger than 0. In profile don't display data from two first and two last plot_data entries in info box. Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
2017-11-13Make Bluetooth naming consistentGravatar Berthold Stoeger
Currently, on Linux, after selecting a Bluetooth device the name of the device is shown. On reopening the download dialog, on the other hand, the address is shown. In the device selection dialog both are shown. This patch changes the download dialog such that both, name and address, are shown. The bulk of the patch introduces the name of the device in the preferences and DCDeviceData. It has to be noted that DCDeviceData is an encapsulation of the libdivecomputer device_data_t. Nevertheless, the new Bluetooth-name field is, at the moment, not passed through to libdivecomputer. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2017-11-13Better error message on BLE connection timeoutGravatar Berthold Stoeger
On BLE connection timeout a weird error-message was shown, because the controller was still in connecting state and no error string was set. Therefore, handle the timeout case with a special case label. Moreover, remove three unnecessary calls to disconnectFromDevice(), which is called in the destructor of the controller anyway (verified by looking at Qt source). Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2017-11-12Typo: modp02 -> modpO2Gravatar Berthold Stoeger
Fixes two function names, where O2 was written as 02. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2017-11-10Fix warningGravatar Jan Mulder
Commit 97712559192ca82d introduces a compiler warning due to mismatched pointer types. Fixed here. Reported-by: Stefan Fuchs <sfuchs@gmx.de> Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2017-11-09Print version when run in verbose modeGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-11-09Add details about key libraries when showing versionGravatar Dirk Hohndel
Also fixed a spelling error and apparently some whitespace issue. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-11-09CNS can be higher than 255%Gravatar Jan Mulder
I'm sure this bug has heen here forever, but the CNS clock is not very relevant for most divers, and even some technical divers do not care about this value. However, doing long decompression dives, the value can easily grow over 100%, and a lot further. For example, the OSTC computers use 2 bytes to store the CNS value in the profile data, and I have multiple dives in my logbook going way over 255%. This all said. Just store the CNS value in an unsigned 16 bit. Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2017-11-09Planner don't add minimum gas switch time more than onceGravatar Stefan Fuchs
Avoid adding the minimum gas switch time more than once even if we skip some available deco gas. Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
2017-11-08VPMB: calculate time of final ascent properlyGravatar Rick Walsh
Commit d15779a calculates final stop based on stoplevels[2], but if final stop is 6m/20ft, we should use stoplevels[3]. This fixes it. Signed-off-by: Rick Walsh <rickmwalsh@gmail.com>
2017-11-08VPMB: time_clear_ceiling is only valid after time_deep_ceilingGravatar Rick Walsh
Some messed up logic was producing negative deco_time values for some no-deco dives. The CVA wouldn't converge and unrealistic VPMB ceilings were displayed in the profile. This fixes it. See #762 Signed-off-by: Rick Walsh <rickmwalsh@gmail.com>
2017-11-08VPMB profile: remember deco_time when restoring deco_stateGravatar Rick Walsh
Otherwise the CVA won't iterate properly. Signed-off-by: Rick Walsh <rickmwalsh@gmail.com>
2017-11-08VPMB: final_tts may be calculated before final sampleGravatar Rick Walsh
We calculate tts every 30s, not every sample. Consider that when determining the time that the ceiling would have cleared if it's after the surfacing time. Signed-off-by: Rick Walsh <rickmwalsh@gmail.com>
2017-11-08VPMB profile: use deco_time rather bottom_time from plannerGravatar Rick Walsh
This makes the calculations in profile.c a little simpler, especially now we adopt consistent final ascent rate to determine deco_time since d15779a27 Signed-off-by: Rick Walsh <rickmwalsh@gmail.com>
2017-11-08VPMB in profile: deepest ceiling occurs just after bottom timeGravatar Rick Walsh
This lets us calculate deco_time for real dives closer to the planner value. Signed-off-by: Rick Walsh <rickmwalsh@gmail.com>
2017-11-08VPMB: calculate deco_time assuming final ascent always takes the same timeGravatar Rick Walsh
If we consider the actual time to ascend from the final stop when calculating deco_time, then slowing the final ascent can lead to the final stop being extended, which is completely nonsensical. For consistency with the original VPMB implementation, we can't ignore the final ascent time completely, but if we assume it is always the same (take default ascent rate of 9m/min) then slower the final ascent won't lead to a longer final stop. Signed-off-by: Rick Walsh <rickmwalsh@gmail.com>
2017-11-08VPM-B: move bottom_time into deco_stateGravatar Rick Walsh
Removing ext variable from profile.c should facilitate future performance gains Signed-off-by: Rick Walsh <rickmwalsh@gmail.com>
2017-11-08Do not save dive sites that are not usedGravatar Jan Mulder
As it is not possible to delete dive sites from the logbook, we need to make sure that we never save sites that are not tied to any dive. With this change, unused site that are currently in the logbook will also be removed, so it will also clear up (wrong) historical data. Supposed to fix #786 Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2017-11-07Save font_size in correct groupGravatar Jan Mulder
A change of the font_size in preferences ended up in the wrong preferences group (the GeneralSettings group), appearing to the user as a non-saved preference. Fix is simple. Just set the the correct group before saving a change in font_size. Fixes: #780 Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2017-11-06Add "Aladin" to the list of recognized BT names.Gravatar Berthold Stoeger
Recognize Aladin as the Bluetooth name of the Scubapro Aladin Sport Matrix. Note that the Scubapro Aladin H Matrix most likely also identifies itself using this BT name. But it probably uses the same BT protocol (i.e. the G2 protocol) and therefore this should not pose a problem. Ultimately a common name should be found. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2017-11-06Fix typo which prevented correct translation of word "Density"Gravatar Stefan Fuchs
Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
2017-11-04Disable o2 break option if last stop is not at 6m/20ftGravatar Stefan Fuchs
Disable the possibility to plan o2 breaks of option "last stop at 6m/20ft" is not set. Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
2017-11-04O2 breaks code enhancements and cleanupGravatar Stefan Fuchs
Remove unused variables o2time and breaktime or convert into boolean. Never consider minimum gas switch time when switching to o2. Reflect this behavior also in the UI. Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
2017-11-04Replace QMap::operator[] with QMap::value()Gravatar Berthold Stoeger
QMap::operator[] creates a new default constructed entry in the map if no entry with the given key exists. While not problematic (since typically nullptrs are inserted) this is usually not what you want for read access. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2017-11-03win32: optimize the console and logging logicGravatar Lubomir I. Ivanov
Currently one has to explicitly use --win32console and/or --win32log to enable a dedicated console (a console window that opens next to the Subsurface window) or to enable file logging on Win32. This patch makes the following changes: - removes the --win32* command line arguments - removes the dedicated console window support - if the app starts from a shortcut and not from a console, always redirect stderr and stdout to _err & _out log files - if the app starts from a console redirect stderr and stdout to that console Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2017-11-02Fix resource leaks in qt-ble.cppGravatar Berthold Stoeger
1) Destroy QLowEnergyService objects in destructor of BLEObject. 2) Let BLE object take ownership of the controller so that the latter can be destroyed in the destructor of the former. This introduces a certain ownership subtlety, which could be solved by allocating the controller object in the BLE object. But let's first do the less intrusive thing. 3) Destroy the BLE object for two error conditions. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2017-10-31When O2 breaking, add segment with current mix not with nextGravatar Robert C. Helling
Signed-off-by: Robert C. Helling <helling@atdotde.de>
2017-10-31Don't do the minimal gaschanging stops during O2 breaktingGravatar Robert C. Helling
Signed-off-by: Robert C. Helling <helling@atdotde.de>
2017-10-31Correct time bookkeeping when doing O2 breaksGravatar Robert C. Helling
These got mangled with previous changes to stop length determination. Fixes #662 Signed-off-by: Robert C. Helling <helling@atdotde.de>
2017-10-30VPM-B ceiling: calculate deco_time similar to planned VPM-B divesGravatar Rick Walsh
When planning a VPM-B dive, the "deco time" ends at surfacing, which is after ascending after a full-minute deco stop is complete, after ceiling clears. We should take this into account when calculating the ceiling outside of the planner. Signed-off-by: Rick Walsh <rickmwalsh@gmail.com>
2017-10-30VPM-B ceiling outside of planner: over-estimate deco_time on first iterationGravatar Rick Walsh
This means the iterations converge from an over-estimate, consistent with planning VPM-B dives Signed-off-by: Rick Walsh <rickmwalsh@gmail.com>
2017-10-30whitespace (planner.c)Gravatar Rick Walsh
Signed-off-by: Rick Walsh <rickmwalsh@gmail.com>
2017-10-30VPMB profile: use bottom_time to calculate deco_time in plannerGravatar Rick Walsh
This corrects the issue where the displayed ceiling in the profile was "broken" by the planner, especially for shorter and shallower dives. Also fixes issue outside of planner where the deepest VPM-B ceiling was shown too early, messing up the deco_time calculation. VPM-B plans respond to change in O2% in gas as expected (in my testing) Fixes: #630 Signed-off-by: Rick Walsh <rickmwalsh@gmail.com>
2017-10-30Planner remove unnecessary gas consumption info from notesGravatar Stefan Fuchs
If we consumed 0l/0bar in total from a cylinder there is no need to also state that we consumed 0l/0bar during ascend. Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
2017-10-30Add a useful error message if we fail to connect to cloud serverGravatar Dirk Hohndel
Because now we are trying to open a URL as if it was a local file. Again, the goal is to accelerated debugging if things go wrong. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-10-30Improve parsing of git error messageGravatar Dirk Hohndel
This is rather fragile code, and the capitalization of the error message in libgit2 changed at some point. But commit 794739b4c0 ("strstr is a case sensitive compare") didn't really fix the problem - as it broke that same check for older libgit2 versions. Instead use our new helper function to make it work with libgit2 old and new. Also, add some more error output so the next time we run into this it's more obvious what broke and where. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-10-30Add new helfer for strcasestrGravatar Dirk Hohndel
That's not a standard functions, so let's just build it. This is not the most efficient way to write it, but it will do. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-10-29Mark missing translationsGravatar Dirk Hohndel
Reported-by: Pedro Neves <nevesdiver@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-10-29Remove three obsolete preferences options for geocodingGravatar Stefan Fuchs
These options are not used any longer/were never used and can be removed to not confuse the users. Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
2017-10-28Planner: Do not translate VARIATIONSGravatar Salvador Cuñat
This string is substituted with the runtime increments derived of slight variations in depth or bottom time in: diveplannermodel.cpp:1058: displayed_dive.notes = strdup(notes.replace("VARIATIONS", QString(buf)).toUtf8().data()); Translating it avoids substitution and we just get the translated string. Signed-off-by: Salvador Cuñat <salvador.cunat@gmail.com>
2017-10-26Clear error string when starting dive computer dowload.Gravatar Berthold Stoeger
Fixes minor interface inconsistency: After a failed download, the error message was also shown on subsequent successful downloads. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2017-10-26git save: create a better commit message for initial commitGravatar Dirk Hohndel
When we create an empty repo we should simply state that in the commit message. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-10-26git save: don't save the git_id if just creating empty repoGravatar Dirk Hohndel
Otherwise the following call to do_git_save will potentially have incorrect information about the cache validity of the dives in the divelist. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-10-26git save: remove redundant 'subsurface' from commit messageGravatar Dirk Hohndel
The user agent string already contains the (correctly capitalized) program name. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>