aboutsummaryrefslogtreecommitdiffstats
path: root/core
AgeCommit message (Collapse)Author
2017-02-19Properly handle dive sites loaded from XMLGravatar Linus Torvalds
We used to always create a new dive site structure when loading dive site data from XML. That is completely bogus, because it can (and does) create duplicate dive sites with the same UUID. Which makes the whole UUID pointless. So instead, look up the existing dive site associated with the UUID loaded from the XML, and try to merge the data properly if we already had dive site information for that UUID. Reported-by: Alessandro Volpi <volpial@gmail.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2017-02-19dive merging: merge water temperature too, not just air temperatureGravatar Linus Torvalds
I have no idea why we only merged air temperatures. But it was very explicit (even the function doing the merging was named "merge_airtemp()"), and water temperatures were left alone. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2017-02-17Handle negative dates (before the epoch) betterGravatar Linus Torvalds
The Qt model sorting for the dive date was using a unsigned number, which doesn't work for dates before 1970. Also, the dive date parsing got the year 1900 wrong. Not that we really care, because other parts of date handling will screw up with any date before the year 1904. So if you claim to be diving before 1904, you get basically random behavior. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2017-02-15Fix crash when merging dives with a missing dive computer modelGravatar Linus Torvalds
The test for the dive being a planned dive was completely bogus: - it should use "same_string()" which correctly checks for NULL - the string it checks for is obviously spelled wrong anyway. Reported-by: Alessandro Volpi <volpial@gmail.com> Fixes: a031dbbbd ("When merging planned dives keep all cylinders") Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2017-02-11Set up gaslist only in the beginning of diveplanGravatar Robert C. Helling
In the beginning of the diveplan, divedatapoints of zero duration indicate available gases with the depth giving the suggested switch depth. Zero-duration datapoints in the middle of the dive do not have this meaning and should thus be ignored when composing the gaslist. The tests should have these gas defining segments in the beginning. This fixes a problem when replanning a dive that would change to random gases during deco. Signed-off-by: Robert C. Helling <helling@atdotde.de>
2017-02-11Always show manually added gaschanges in notesGravatar Robert C. Helling
In the manually entered part, we dont wait until the next stop. Signed-off-by: Robert C. Helling <helling@atdotde.de>
2017-02-10Reset VPM-B state between repetitive divesGravatar Robert C. Helling
This resets the maximum crushing pressures and the maximal ambient pressure between repetitive dives to prevent anomalies that a dive produces a shorter deco when following another one than without. Reported-by: sfuchs@gmx.de Signed-off-by: Robert C. Helling <helling@atdotde.de> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-02-09Make cylinder merging a bit more carefulGravatar Linus Torvalds
This makes some further updates to the new cylinder merging code: - avoid re-using the cylinder if the usage type (OC/diluent/O2) is different between the two dives, even if the gasmix might be the same. - avoid re-using a cylinder if the user has manually added pressure data for it (and the pressures don't match) - when deciding to reuse a cylinder, make sure that we merge as much of the type information as makes sense. This will potentially result in more cylinders that might need manual cleanup, but at least we won't be throwing out user data. And in most cases where merging happens, none of this is an issue (because the data comes fresh from a dive computer, and won't have been manually edited to trigger the new rules). Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2017-02-09Rewrite cylinder merging code from scratchGravatar Linus Torvalds
The old cylinder merging code depended on the preferred dive having all the cylinders, and the newly merged dive was just forced to pick from that existing set of cylinders. That worked ok if you have a "main" dive computer that you have all the gases programmed for, and you download that first, and then you download any secondary data later. But it completely messed up if the second dive computer had gases that the first one didn't know about, and just basically ended up doing random things. This rewrites the whole thing to actually try to create a union of the two sets of cylinders when merging, with sane matching so that if the cylinders match you won't get duplicates. Miika Turkia hit this when he only used one gas, but had several gases defined in his OSTC that he downloaded after his Vyper (with had just the single gas defined). This should fix that case (at least it does for my xml merging test-case that showed the same problem after some munging). Reported-by: Miika Turkia <miika.turkia@gmail.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2017-02-05Finish removal of informational_prefsGravatar Dirk Hohndel
And make export-html build again. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-02-05Merge informational_prefs into git_prefsGravatar Joakim Bygdell
There is no need to have two variables for the same purpose. [Dirk Hohndel: changed to keep the two separate functions as otherwise we no longer parse existing repos successfully] Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-02-05MOBILE: Read profile settings from gitGravatar Joakim Bygdell
Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com>
2017-02-05Save profile settings to gitGravatar Joakim Bygdell
In order to streamline the view between desktop and mobile we need to save selected profile related settings to git. Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com>
2017-02-04Treat gaschanges at 1s as inital gas useGravatar Robert C. Helling
When the first leg in the planner is not cylinder 0, a gaschange event at t=1s is inserted. In the profile, we should treat that as inital gas, so no pressure information is printed for cylinder 0 that is used nominally for one second. This fixes a problem reported by Willem. Signed-off-by: Robert C. Helling <helling@atdotde.de>
2017-02-04Bugfix planner output formating (linebreaks)Gravatar Stefan Fuchs
Changed the markup with <div> and <br> tags of the planner output in a way that is is a good compromise for both displaying in UI and printing. Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
2017-02-03Don't do strcmp on NIL pointerGravatar Robert C. Helling
This is what we have same_string() for... This prevents a crash when saving a dive in the planner. Signed-off-by: Robert C. Helling <helling@atdotde.de> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-02-03Same typo, two more timesGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-02-03Fix typoGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-02-03Win32: add the --win32log option to log stdout and stderr to filesGravatar Lubomir I. Ivanov
Adding --win32log as the first command line option on Windows will now log all stdout and stderr output to the files subsurface_err.log and subsurface_out.log in the working directory. This change required a new argument 'bool logfile' to be added to: subsurface_console_init() which is defined in all platform files (linux.c, macos.c, etc.) Example usage: subsurface.exe --win32log -v -v -v Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2017-02-03Do not count gas used in planned dives for statisticsGravatar Robert Helling
This is important if in one dive we have the real dive and a planned version of the dive as different computers using different sets of cylinders. [Dirk Hohndel: an early version of this was mistakenly pushed out by me; I reverted that and added this commit since fixing things up as I had done for the other two patches made things nearly unreadable] Signed-off-by: Robert C. Helling <helling@atdotde.de> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-02-03Correct: Handle more tanks than gasmixesGravatar Robert Helling
When Suunto Vytecs are used in gauge mode they don't record gasmixes. If a tank pressure sensor is present they nevertheless record the pressures. This patch handles this situation by assuming the tanks contain air (and warning the user about this). [Dirk Hohndel: I had mistakenly pushed out an earlier version of this commit, so this fixes things up to the final version] Reported-by: antonnorth@gmail.com Signed-off-by: Robert C. Helling <helling@atdotde.de> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-02-03Correct "When merging planned dives keep all cylinders"Gravatar Robert Helling
When merging a real dive with a planned dive (for comparison), we should not try to be clever in merging similar cylinders, rather keep the union of both cylinder sets as the two versions of the dive might differ in exctly which gas and how much of it was used. Increase MAX_CYLINDERS to 20 to make room for this. We warn if we exceed this number. [Dirk Hohndel: I had mistakenly pushed out an earlier version of this commit, so this fixes things up to the final version] Signed-off-by: Robert C. Helling <helling@atdotde.de> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-02-03Revert "In statistics, ignore gas use of planned dives"Gravatar Dirk Hohndel
This reverts commit 1d8662006cbb5edae941315e30ede381c23a817b. Mistakenly pushed to master Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-02-03Deal with some of the whitespace issues in planner.cGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-02-03Print SAC values from prefs in diveplanGravatar Stefan Fuchs
Print the SAC values from preferences into the diveplan. These are the values used for calculation of gas consumption. Signed-off-by: Stefan Fuchs <sfuchs@gmx.de> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-02-03Add ATM pressure and altitude to diveplanGravatar Stefan Fuchs
Print the ATM pressure and the altitude used for calculation into the resulting diveplan. Moved this info together with the deco model info below the runtime table. There is one drawback in this implementation: Altitude will be recalculated from surface pressure and therefore may differ slightly from altitude entered in the UI. Signed-off-by: Stefan Fuchs <sfuchs@gmx.de> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-02-02In statistics, ignore gas use of planned divesGravatar Robert C. Helling
When merged with real dives, those would double count otherwise. Signed-off-by: Robert C. Helling <helling@atdotde.de>
2017-02-02When merging planned dives keep all cylindersGravatar Robert C. Helling
When merging a real dive with a planned dive (for comparison), we should not try to be clever in merging similar cylinders, rather keep the union of both cylinder sets as the two versions of the dive might differ in exctly which gas and how much of it was used. Increase MAX_CYLINDERS to 20 to make room for this. Signed-off-by: Robert C. Helling <helling@atdotde.de>
2017-02-02Handle more tanks than gasmixesGravatar Robert C. Helling
When Suunto Vytecs are used in gauge mode they don't record gasmixes. If a tank pressure sensor is present they nevertheless record the pressures. This patch handles this situation by assuming the tanks contain air (and warning the user about this). Reported-by: antonnorth@gmail.com Signed-off-by: Robert C. Helling <helling@atdotde.de> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-02-01Initialize the surface timeGravatar Robert C. Helling
Otherwise we return garbage when there is no dive in the dive list. Closes #184 Signed-off-by: Robert C. Helling <helling@atdotde.de>
2017-01-23Allow user to disable a cylinder in plannerGravatar Robert C. Helling
In the cylinder table, the last column ("use") always showed OC-GAS. Editing was enabled, but the user had to guess to enter a small integer meaning dilluent or CCR oxygen cylingder. I guess, nobody has ever done that. This patch makes this column clickable. A click toggles if the cylinder is used for planning or not. This wait it is much easier to investigate the consequences of gas loss on a plan. Signed-off-by: Robert C. Helling <helling@atdotde.de>
2017-01-22QML UI: allow magic phrase for multiple buddies to be localizedGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-01-17Make event string translation when downloading from libdivecomputer more obviousGravatar Linus Torvalds
We had hardcoded the exact translation of the event numbers. They haven't changed (although we did have what appears to be a spurious entry for "non stop time" at the end that libdivecomputer doesn't have an enum for). Instead, use an explicit array index initializer array, so that it's obvious that the two match up (and if the sample event numbers ever change, we should cope with it gracefully). Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2017-01-16Add support for libdivecomputer using DC_SAMPLE_GASMIXGravatar Linus Torvalds
New libdivecomputer versions use DC_SAMPLE_GASMIX to indicate a gas change (which contains the cylinder index we're changing to) rather than SAMPLE_EVENT_GASCHANGE*. Unlike the old GASCHANGE model, and despite the name, DC_SAMPLE_GASMIX does not actually say what the mix is, it only specifies a cylinder index. We had already extended SAMPLE_EVENT_GASCHANGE2 to have the cylinder index in the otherwise unused "flags" field, so this is not all that different from what we used to do. And subsurface internally already had the logic that "if we know what the cylinder index is, take the gas mix from the cylinder data", so we've already been able to transparently use _either_ the actual gas mix or the cylinder index to show the event. But we do want to make it an event rather than some sample data, because we want to show it as such in the profile. But because we are happy with just the cylinder index, we'll just translate the DC_SAMPLE_GASMIX thing to the SAMPLE_EVENT_GASCHANGE2 event, and nothing really changes for subsurface. libdivecomputer has made other changes, like indicating the initial cylinder index with an early DC_SAMPLE_GASMIX report, but we've seen that before too (in the form of early SAMPLE_EVENT_GASCHANGE events), so that doesn't really end up changing anything for us either. HOWEVER, one thing that is worth noticing: do *not* apply this patch and then use an old libdivecomputer library that sends both the DC_SAMPLE_GASMIX samples _and_ the deprecated SAMPLE_EVENT_GASCHANGE events. It will all *work*, but since subsurface will take either, you'll then get duplicate gas mix events. It's not like that is in any way fatal, but it might be a bit confusing. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2017-01-16Use real gas compressibility in plannerGravatar Robert C. Helling
Modify formluas for gas use to take into account the compressibility correction for real gases. This introduces also the inverse formula to compute the pressure for a given amount of gas. Signed-off-by: Robert C. Helling <helling@atdotde.de>
2017-01-14Prevent crash on Mac when typing comma in GPS coordinates fieldGravatar Dirk Hohndel
Our attempt to skip any white space after the comma causes an ASSERT (strangely only on Macs). This closes #158 Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-01-12Add cylinder equipment tooltips with gas volumeGravatar Linus Torvalds
This adds tooltips for the equipment tab for each cylinder, showing the amount of gas used. When you mouse over the size and working pressure fields, the tooltip will show the amount of gas used (along with start and end gas volumes). And when you mouse over the start and end pressures, it will show the start and end gas volumes, and the Z factor used. I started doing this because of the gas volume questions in the last day or two (and a few from a few weeks ago). When even Robert Helling starts wondering about the effects of compressibility on the SAC calculation, our numbers are clearly too opaque. With these tooltips, at least you can see what went into the used gas calculations, instead of having to add debugging options to print out Z factors. [ This patch also adds a "rint()" to get the rounding right in the gas_volume() function. Although rounding to the nearst milliliter really doesn't matter, it's the right thing to do after doing FP calculations ;^] Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2017-01-12ostctools: Add support for profile version 0x24Gravatar Anton Lundin
Signed-off-by: Anton Lundin <glance@acc.umu.se>
2017-01-12ostctools_import: Switch to using dc_parser_new2Gravatar Anton Lundin
Instead of creating the individual parsers, and keeping track of their arguments, this just uses the "new" dc_parser_new2 function ment for buffer parsing. Signed-off-by: Anton Lundin <glance@acc.umu.se>
2017-01-12Stop accessing the internals of dc_descriptor_tGravatar Anton Lundin
This removes our own declaration of dc_descriptor_t and all our accesses to its internals, and switches to use the libdivecomputer functions to access those instead. Signed-off-by: Anton Lundin <glance@acc.umu.se>
2017-01-12ostctools: Correct argument order to get_descriptorGravatar Anton Lundin
This corrects the argument order, which was changed back in 00629c861cc9, but not on this place. Whups. Signed-off-by: Anton Lundin <glance@acc.umu.se>
2017-01-06Add some additional parameters to help textGravatar Miika Turkia
Signed-off-by: Miika Turkia <miika.turkia@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-01-06Rename prefs.deco_mode to prefs.planner_deco_modeGravatar Robert C. Helling
This is to avoid confusion with planner.display_deco_mode. When accessing the "current deco mode" use the decoMode() helper function. Signed-off-by: Robert C. Helling <helling@atdotde.de>
2017-01-06Fix deco_mode confusionGravatar Robert C. Helling
We have two prefernces determining the deco_mode (BUEHLMANN vs VPMB vs RECREATIONAL): One for the planner (deco_mode) and one for displaying dives (display_deco_mode). The former is set in the planner settings while the latter is set in the preferences. This patch clears up a confusion which of the two to use by introducing a helper function that selects the correct variable. Signed-off-by: Robert C. Helling <helling@atdotde.de>
2017-01-03Display surface interval in diveplanGravatar Robert C. Helling
...instead of just stating "repetitive dive". As requested by a user. Signed-off-by: Robert C. Helling <helling@atdotde.de>
2016-12-31Hooking up av1.xslt for log importGravatar Miika Turkia
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2016-12-30Fix picture hashing logic for pictures on the web.Gravatar Robert C. Helling
Signed-off-by: Robert C. Helling <helling@atdotde.de>
2016-12-28android: Add a subsurface_user_is_root for androidGravatar Anton Lundin
This is to compile the desktop ui for android Signed-off-by: Anton Lundin <glance@acc.umu.se> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-12-28Use get_descriptor instead of hard-coded switch'sGravatar Anton Lundin
This starts using the newly lifted out get_descriptor in configure dive computer, instead of previously hard-coded out of date switch-statements. Signed-off-by: Anton Lundin <glance@acc.umu.se> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-12-28Rename ostc_get_data_descriptor to get_descriptorGravatar Anton Lundin
This renames and cleans up ostc_get_data_descriptor into get_descriptor, for more generic use. Signed-off-by: Anton Lundin <glance@acc.umu.se> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>