summaryrefslogtreecommitdiffstats
path: root/dive.c
AgeCommit message (Collapse)Author
2011-11-01Use unit functions to get column headers, add unit function for pressureGravatar Dirk Hohndel
Finally getting more consistent overall in how we convert between the different units and how we decide which units to display. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2011-11-01More consistency improvementsGravatar Dirk Hohndel
Treat SAC and OTU consistently: - SAC is now a member of struct dive - it's calculated / populated at the same time with a helper function with consistent API Create get_volume_units function that returns volumes (e.g. used in SAC rates) based on preferred units - make sure we have these conversions just once in the code. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2011-11-01Add new helper function to get temperature and unitGravatar Dirk Hohndel
Designed along the lines of get_depth_units - except we don't define a specific number of digits to show. Use this in the one spot we need it right now in profile.c Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2011-10-25Remember the event names as we encounter themGravatar Dirk Hohndel
First step to being able to filter the events that we display in the profile. We could (in theory) walk all the dives in the divelist when we need this data, but it seems much more convenient to have them in an array in one place. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2011-10-23Add completions to the dive location, buddy and divemaster entriesGravatar Linus Torvalds
This way you can just type the first few characters of a location you've been to before, and it will show you a list of possible completions. Same for buddies and divemasters (which take the completions from a list of people you've used before). Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-10-22Add cylinder data to cylinder model as we record each diveGravatar Linus Torvalds
This way the cylinder model list will contain all the different cylinders that we have ever seen, rather than only containing the models that we have *edited*. That makes it much more practical to add new dives with the same cylinders that we've used before, because now those cylinders will show up as cylinder models even if we haven't looked and edited the old dives first. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-10-19Don't overwrite the end pressure with sample data if one already existsGravatar Linus Torvalds
If we have en explicit end pressure in the dive information, we should not change it just because we also have some samples. The sample data may not be complete (read: "Linus wireless connection dropped during the dive again, and he fixed up the end pressure manually afterwards"). The beginning pressure already works correctly, because it will only use the sample data for the first sample if no pressure existed before. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-10-04Make the dive merging code more tolerantGravatar Dirk Hohndel
Depending on the tool used to import a dive from the uemis Zurich we end up with different time stamps for the dive - just by a few seconds, but the existing code insisted on an exact match. We now allow for up to 60 seconds in difference and still consider two dives as the same. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2011-09-29Yes Linus, gas pressure can indeed go up during a diveGravatar Dirk Hohndel
At first glance it seems logical to make the ending pressure be the lowest pressure observed during a dive. But if you do valve shut down drills with a tech setup (where you have a fully redundant double tank setup with two valves, two regulators and a manifold in between), then you continue to breath from what is indeed the same "tank", but still the valve on which your air pressure transmitter sits does get shut down and de-pressurized. So your pressure goes down by quite a bit, and then comes back up when the valve is turned back on. And the ending pressure of the dive (which is used for things like the SAC calculation) is indeed potentially higher than the lowest pressure observed during a dive. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2011-09-22Merge latitude and longitude data properlyGravatar Linus Torvalds
When merging two identical dives and one of them has lat/long data, pick it up correctly for the merged dive. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-22Merge dive events correctly tooGravatar Linus Torvalds
It's very similar to the sample merging. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-22Start handling dive eventsGravatar Linus Torvalds
Parse them, save them, take them from libdivecomputer. This doesn't merge them or show them in the profile yet, though. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-22Properly merge dive buddies and divemaster informationGravatar Linus Torvalds
When we merge dives, we didn't merge these fields properly. Do it. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-21Add helper function for doing depth unit calculationsGravatar Linus Torvalds
.. and use it for printing too. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-20Separate out the UI from the program logicGravatar Dirk Hohndel
The following are UI toolkit specific: gtk-gui.c - overall layout, main window of the UI divelist.c - list of dives subsurface maintains equipment.c - equipment / tank information for each dive info.c - detailed dive info print.c - printing The rest is independent of the UI: main.c i - program frame dive.c i - creates and maintaines the internal dive list structure libdivecomputer.c uemis.c parse-xml.c save-xml.c - interface with dive computers and the XML files profile.c - creates the data for the profile and draws it using cairo This commit should contain NO functional changes, just moving code around and a couple of minor abstractions. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2011-09-12Plot a sick kind of temperature curveGravatar Linus Torvalds
.. without the actual text, because I'm a "random plots that cannot actually be interpreted" kind of guy. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-12Abstract out dive/sample allocation a bitGravatar Linus Torvalds
We're going to start to want to allocate dives and samples for the libdivecomputer import too, so let's clean things up a bit for that. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-12Avoid using type 'gasmix_t': use 'struct gasmix' insteadGravatar Linus Torvalds
libdivecomputer already uses 'gasmix_t' for its own gasmix thing. I don't like th eway we step on each others name spaces, but hey, might as well just use 'struct gasmix' and avoid the typedef. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-05Report errors when opening filesGravatar Nathan Samson
Signed-off-by: Nathan Samson <nathansamson@gmail.com>
2011-09-05Sanitize and fix cylinder pressure overviewGravatar Linus Torvalds
Doing per-dive cylinder start/end pressures is insane, when we can have up to eight cylinders. The cylinder start/end pressure cannot be per dive, it needs to be per cylinder. This makes the save format cleaner too, we have all the cylinder data in just one place. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-04Clean up 'fixup_dive()' a bitGravatar Linus Torvalds
We don't want to override potentially more exact values for water temperature etc either. The sample save interval may be longer than some internally kept state of key per-dive values like that. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-04Generate date string for the dive list dynamicallyGravatar Linus Torvalds
.. and sort based on the 'time_t' value itself. This allows us to use a more compact date format that doesn't need to sort alphabetically, because sorting by date is always based on the date value. So we can use just a two-digit year, and skip the seconds, to keep the column narrow, while still sorting correctly. Also, "Depth" is a nice header string, but it is wider than the column itself, which makes the whole column wider than necessary. So put the units in the header instead of in the string, keeping things narrow. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-04Merge branch 'compiler-warning' of https://github.com/nathansamson/diveclogGravatar Linus Torvalds
* 'compiler-warning' of https://github.com/nathansamson/diveclog: Removed the unused startemp and enttemp calculations. This fixes a compiler warning too. Fix up trivial conflict in dive.c due to the temperature simplification (commit 9961c7f89ce6: "Remove redundant temperature readings").
2011-09-04Remove redundant temperature readingsGravatar Linus Torvalds
I'm aiming to really differentiate in dive log software by making my XML export files be *clean*, dammit. That means that we don't have random names, we don't have crazy random units, and we don't have redundant information. So when the temperature doesn't change, just don't report it. That's already what "no sample" means, just clean things up. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-04Removed the unused startemp and enttemp calculations. This fixes a compiler ↵Gravatar Nathan Samson
warning too. Signed-off-by: Nathan Samson <nathansamson@gmail.com>
2011-09-03Merge https://github.com/mrjbq7/diveclogGravatar Linus Torvalds
* https://github.com/mrjbq7/diveclog: dive.c: Fix spelling.
2011-09-03Do better cylinder information managementGravatar Linus Torvalds
Instead of just tracking gasmix, track the size and workng pressure of the cylinder too. And use "cylinder" instead of "tank" throughout. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-03dive.c: Fix spelling.Gravatar John Benediktsson
2011-09-03Only update mean/max depths with computed ones if they are way offGravatar Linus Torvalds
The computer may track "real" max depth more closely than it tracks samples. So we trust the non-computed mean/max depths more than the computed ones. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-03Add various dive fixups, and show pressure (if any) in the plotGravatar Linus Torvalds
Now the dive profile plot *really* needs some units. The pressure is just a random line otherwise. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>