aboutsummaryrefslogtreecommitdiffstats
path: root/core
AgeCommit message (Collapse)Author
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>
2017-09-06Changed serial_ftdi flush to a reset if DC_DIRECTION_ALLGravatar John Van Ostrand
The USB reset flushes both buffers, but it also solves a problem waking up a Cochran DCs. Signed-off-by: John Van Ostrand <john@vanostrand.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-09-06Changed backoff strategy for short reads.Gravatar John Van Ostrand
Back off was exponential starting at 10ms, which for high baud rate and no flow-control connections might cause buffer overrun. This was causing problems when reading Cochran DCs, the hearbeat byte was being missed. Signed-off-by: John Van Ostrand <john@vanostrand.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-09-04Unify credential statesGravatar Jan Mulder
Having two different enums around with more or less the same definition has lead to unclear code. After removing two not needed states on the mobile end, the remaining step to one enum for the credential state becomes almost is simple rename operation. Unfortunately, I do not know a way to embed a plain C enum from pref.h into the QMLManager object. So after this, there are still 2 enums around, but now identical. This commit is not changing any functionality. Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2017-08-29adding comments as advisedGravatar Marc Arndt
2017-08-29fixing indentationGravatar Marc Arndt
2017-08-29Ignore Divesoft Button Press EventsGravatar Marc Arndt
Prevent button press events from showing on the profile graph when we import divesoft DLF files. Reported-by: Marc Arndt Signed-off-by: Marc Arndt <marc@marcarndt.com>
2017-08-29Show variations in Runtime stringGravatar Robert C. Helling
Signed-off-by: Robert C. Helling <helling@atdotde.de>
2017-08-29Compute variations of plansGravatar Robert C. Helling
Print out partial derivatives of stop times with respect to variation of depth and duratin of last manual segment. Signed-off-by: Robert C. Helling <helling@atdotde.de>
2017-08-29Store a table of deco stops in plannerGravatar Robert C. Helling
... in addition to struct diveplan which combines all kinds of information Signed-off-by: Robert C. Helling <helling@atdotde.de>
2017-08-29Cache all Buehlmann factorsGravatar Robert C. Helling
not just the last one. Signed-off-by: Robert C. Helling <helling@atdotde.de>
2017-08-29Allow for o2 breaks in binary search stop time finderGravatar Robert C. Helling
Signed-off-by: Robert C. Helling <helling@atdotde.de>
2017-08-29Find deco stop time by binary search instead of iterationGravatar Robert C. Helling
This allows to go to much smaller granularity without severe performance penalty. It should also increase performance for long decompression times. Currently this leads to missing cached tissue factors, the caching has to be adopted to this. Also, for the time being this breaks the bottom gas breaks feature. Signed-off-by: Robert C. Helling <helling@atdotde.de>
2017-08-29Make plan take dive and decotimestep as argumentsGravatar Robert C. Helling
...rather than use a global variable and a macro. This should be a no-op in preparation to allow planning several versions of a dive. Signed-off-by: Robert C. Helling <helling@atdotde.de>
2017-08-29Change color to red if minimum gas is violated.Gravatar Robert C. Helling
Signed-off-by: Robert C. Helling <helling@atdotde.de>
2017-08-26Another signed/unsigned warningGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-08-26Adjust signature to match data we needGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-08-26Remove unused functionGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-08-26Assignment instead of test for equalityGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-08-26Time is unsigned hereGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-08-26Remove some unused variablesGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-08-26Hide signed/unsigned comparison warningGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-08-24Shearwater PerdixGravatar Miika Turkia
Reportedly the case 2 corresponds to Perdix, so it might be that both Petrel and Perdix use same model number (or the model is mistaken before). Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2017-08-24Support for air pressure on Shearwater Desktop importGravatar Miika Turkia
Fixes #548 Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2017-08-24Grab correct dive number on Shearwater Desktop importGravatar Miika Turkia
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2017-08-21Improve error message when opening dive computer failsGravatar Dirk Hohndel
Instead of the (usually incorrect) text about insufficient privileges, just mention a generic error and suggest that the user creates a libdivecomputer log file. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-08-20Update the OSTC dive computer configuration to use the generic 'timesync' ↵Gravatar Linus Torvalds
interface Jef made the OSTC interface be a generic 'dc_device_timesync()' and so the old OSTC-specific code doesn't exist any more. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-08-10fix weights roundingGravatar Jan Mulder
Simplify and fix prestation of weights. Due to the attempt to round only the grams part (by just adding 50 to it, and truncating afterwards) a weird effect was introduced. For example, a value 0.98 was presented as 0.10. Just replay the old logic, and see what happens. Rewrote the logic to a simpler and better one. fixes: #532 Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2017-08-10DLF: Parse more measurements, import GPSGravatar Anton Lundin
This add support for parsing more measurements, and now imports GPS data to. Signed-off-by: Anton Lundin <glance@acc.umu.se>
2017-08-10DLF: Parse Divesoft Liberty data betterGravatar Anton Lundin
There is something with ndl / tts / temp in the Liberty DLF files. If that bit is set, the values are bogus. There is something more to it here which I haven't figured out. Signed-off-by: Anton Lundin <glance@acc.umu.se>
2017-08-10DLF: Parse diluent changes as a gaschange eventGravatar Anton Lundin
Signed-off-by: Anton Lundin <glance@acc.umu.se>
2017-08-10DLF: Import setpoint changes.Gravatar Anton Lundin
Signed-off-by: Anton Lundin <glance@acc.umu.se>
2017-08-10DLF: Restructure loop into a for loopGravatar Anton Lundin
We always step forward 16 bytes, so make it a for loop so a continue won't throw us into a eternal loop. Signed-off-by: Anton Lundin <glance@acc.umu.se>
2017-08-04configure ostc3: Correct code for right buttonGravatar Anton Lundin
Back when I wrote this code I made a typo. This fixes it. Reported-By: Alexander Gottwald <jugendtrainingtsck@gmail.com> Signed-off-by: Anton Lundin <glance@acc.umu.se> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-08-03Fix Poseidon MkVI txt file import sensor pressuresGravatar Linus Torvalds
When I unified the sample pressures in commit 11a0c0cc7018 ("Unify sample pressure and o2pressure as pressure[2] array") I did all the obvious conversions, including the conversion of the Poseidon txt file import: case POSEIDON_PRESSURE: - sample->cylinderpressure.mbar = lrint(val * 1000); + sample->pressure[0].mbar = lrint(val * 1000); break; case POSEIDON_O2CYLINDER: - sample->o2cylinderpressure.mbar = lrint(val * 1000); + sample->pressure[1].mbar = lrint(val * 1000); break; which was ObviouslyCorrect(tm). But as so often is the case, obvious doesn't actually exist. The old "o2cylinderpressure[]" model had an implicit sensor associated with it, and that implicit sensor mapping wasn't obvious, and didn't get fixed. It turns out that the way the Poseidon sensor mapping works, the O2 cylinder is cylinder 0, and the diluent cylinder is cylinder 1, so just use the add_sample_pressure() helper to set both sensor index and pressure value. And since we now do all the sensor indexing right, we can also get rid of some manual cylinder sample pressure code, because the generic dive fixup will just DTRT. It used to screw up because the diluent sensor number was wrong before, and the import code tried to work around that by hand. Reported-by: Anton Lundin <glance@acc.umu.se> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-08-03Always show the ascent to the initial deco stopGravatar Robert C. Helling
...even when not showing transitions, this makes the first stop look more like a stop (since it does not include several minutes of ascent). Signed-off-by: Robert C. Helling <helling@atdotde.de>
2017-08-01android: access() is declared in unistd.hGravatar Anton Lundin
Calling access() makes no sense at all on android, but this atleast fixes a compilation error on ndk 15+. Signed-off-by: Anton Lundin <glance@acc.umu.se>
2017-08-01Null check before writing to pointerGravatar Anton Lundin
In the serial api for libdivecomputer is ok to send NULL as the int pointer actual, if you dont't care about how many bytes that where actually read or written. This makes sure we don't crash if the ble backend where ever used with such a backend. Signed-off-by: Anton Lundin <glance@acc.umu.se>
2017-07-30For more manual gas pressure detailsGravatar Linus Torvalds
So the manual gas pressure case keeps showing issues, and in many ways it really is a fairly complex thing, since it needs interpolation of the intermediate pressures - possibly over several gas changes. So you might have beginning and ending pressures for one cylinder, but then use another cylinder in between. We've historically got all the code to do this, but the big rewrite for multiple cylinder pressures didn't get all the details right, and so here's a few more fixes for the case that was shown by a dive by Robert Helling. Hopefully we're approaching the old code situation, except now with concurrent gas pressure handling support. Reported-by: Robert Helling <helling@atdotde.de> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-07-30Fix another cylinder pressure plotting special caseGravatar Linus Torvalds
The core to plot manually entered pressures without any sample data did the obvious thing: it ended the pressures at the end of the dive as indicated by the last sample. However, that obvious thing didn't actually work, because sometimes the last sample is long long after the dive has actually ended, and we have no plot_info data for that. This depends on the dive computer used: most dive computers will not report samples after the end (even if they may internally remember them in case the diver just came up to the surface temporarily), but some definitely do. The OSTC3 is a prime example of that. Anyway, the code was fragile and wrong - even if passed a time past the end of the plot_info data, "add_plot_pressure()" should just have associated that with the last entry instead. Which also allows us to simplify the whole endtime logic entirely, and just use INT_MAX for it. Gaetan Bisson's test-case also showed another oddity: we would plot the gas pressure even for cylinders that had no has use (ie beginning and ending pressures were the same). That's kind of pointless in so many ways. So limit the manual pressure population to cylinders that actually have seen use. Reported-by: Gaetan Bisson <bisson@archlinux.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>