summaryrefslogtreecommitdiffstats
path: root/core/units.h
AgeCommit message (Collapse)Author
2020-09-04Implement Seac SeacSync databaser parser.Gravatar James Wobser
Dives for the seac action computer are imported by the seacsync program into two tables in an sqlite3 database. The dive information is read from the headers_dive table. The dive_data table is then queried for each dive to get samples. The seac action computer is the only current supported computer by the seacsync program. It only supports two gas mixes, so the parser will toggle between two cylinders whenever it detects a change in the active O2 mix. Dive start time is stored in UTC with a timezone offset. A helper function to read this was added to qthelper. Default cases have been added to some switch statements to assist in future development for other dive types and salinity. Example database has been added to ./dives/TestDiveSeacSync.db Signed-off-by: James Wobser <james.wobser@gmail.com>
2020-05-05cleanup: Change Salty to BrackishGravatar Monty Taylor
In the code, the difference between SALTYWATER and SALTWATER is hard to see. More importantly, in the UI - Brackish is the word for water that has more salt that freshwater but less salt that seawater. The docs already use the word to clarify what is meant.
2020-05-01cleanup: move FRACTION macro from dive.h to units.hGravatar Berthold Stoeger
There appears to be no reason to slurp in all dive.h when compiling membuffer.c. units.h might not seem like the perfect place, but it is the most fitting I found. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-01-18mobile-widgets: add pure interface for passing values to QMLGravatar jan Iversen
Add a header file that contains a duplicate of the enums, that are needed in QML in one class. the unit enums are added imidiatly, since they are needed or will be neede shortly in Settings and DivePlannerSettings This class will also contain Q_PROPERTY and signal/slot for variables used in QML. This is done to allow e.g. deco_mode qPrefUnits::planner_deco_mode() void qPrefUnits::set_planner_deco_mode(deco_mode) as strongly typed in C++ and DECO_MODE planner_deco_mode() void set_planner_deco_mode(DECO_MODE) as strongly typed in QML Remark: wrong assignments gives errors in QML The advantage over using strings or the value directly is that QML detects typos and flags them as errors/warnings. It is important to note that the class may only contain a) a function call to the implementation b) a reference to a global variable e.g. prefs. Added note to the original definitions of the enums that they have been duplicated. Signed-off-by: jan Iversen <jan@casacondor.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-01-10code cleanup: use explicit zero_locationGravatar Dirk Hohndel
Again, several different ways to achieve the same thing. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-01-10code cleanup: consistently initialize zero duration_tGravatar Dirk Hohndel
There were three different ways (two of which generated warnings) in a single source file. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-08-29 Fix broken windows build with latest MXEGravatar Paul Buxton
Replaces some enums with names that do not clash with windows #defines. Specifically: ERROR -> ERRORED, PASCAL->PASCALS, IGNORE->IGNORED,FLOAT->FLOATVAL Signed-off-by: Paul Buxton <paulbuxton.mail@googlemail.com>
2019-06-19Cleanup: move unit-related functions to own translation unitGravatar Berthold Stoeger
Create a units.c translation unit. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-05-15Convert the atmospheric pressure in the Information Tab to an editable fieldGravatar willemferguson
The Information tab shows the atmospheric pressure. Make this value editable and also ensure that changes to it are undo-able. Signed-off-by: willemferguson <willemferguson@zoology.up.ac.za>
2019-05-11Cleanup: move parse_location() declaration into header fileGravatar Berthold Stoeger
The parse_location() function was used in three places. In two of them, the declaration was in the translation unit. Instead, move the declaration into a header file, to avoid duplication and the possibility of inconsistencies. The "units.h" header was chosen as this is where location_t is defined. Moreover, make the string argument to parse_location() "const char *", so that it can be used on non-owned buffers. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-05-05Cleanup: remove unused macro SURFACE_PRESSURE_STRINGGravatar Berthold Stoeger
The last user was removed in c3f07b9f81f09421a92d42d1b98e7c984b75e20d. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-04-12Pedantic: K are an absolute scale, which are not given in degreesGravatar Berthold Stoeger
Since somewhere in the 1960s. "Fix" a few comments. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-10-21Add 'location_t' data structureGravatar Linus Torvalds
Instead of having people treat latitude and longitude as separate things, just add a 'location_t' data structure that contains both. Almost all cases want to always act on them together. This is really just prep-work for adding a few more locations that we track: I want to add a entry/exit location to each dive (independent of the dive site) because of how the Garmin Descent gives us the information (and hopefully, some day, other dive computers too). Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2018-05-18core: removed clang warnings from units.hGravatar jan Iversen
lbs_to_grams and to_feet returns int but uses a function that returns long, causing clang to warn about conversion loss due to implicit conversion. Adding a cast, shows that it is correct. Signed-off-by: Jan Iversen <jani@apache.org>
2018-03-02Choose water presets from a qcombobox in planner, custom value possibleGravatar Oliver Schwaneberg
Add a combo box for water types with defaults for fresh water, sea water and the EN 13319. All values taken from units.h, where EN 13319 was added beforehand. Custom values can be entered through a spinbox. Also changed "Salinity" in TapDiveInformation.ui to "Water type". Translation required! Signed-off-by: Oliver Schwaneberg <oliver.schwaneberg@gmail.com>
2018-02-24Correct comments for struct temperature_t value rangeGravatar Stefan Fuchs
Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
2018-02-24Use temperature_t for temperatures in struct stats_tGravatar Stefan Fuchs
Use struct temperature_t for temperatures in struct stats_t and use get_temperature_string() when printing these temperatures for statistics and HTML export. Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
2017-11-24Change prefs.show_units_table to boolGravatar Stefan Fuchs
Bool is the correct choice for this option. int was used before because it was not clear to me how and if I can use bool in this C file. Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
2017-11-17Fix typo: LENGHT -> LENGTHGravatar Berthold Stoeger
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-10-09Display units in dive list table based on prefs optionGravatar Stefan Fuchs
Add a preferences option which enables or disables display of units in the main dive liste table. Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
2017-05-26Adopt O2 and He densities to 20degCGravatar Robert C. Helling
Signed-off-by: Robert C. Helling <helling@atdotde.de>
2017-05-26Compute and display gas densityGravatar Robert C. Helling
This appears to be critical for work of breathing so it might be worthwhile to compute. So far only in infobox. For background, see https://www.youtube.com/watch?v=QBajM3xmOtc Signed-off-by: Robert C. Helling <helling@atdotde.de>
2017-05-06Wire up duration units preference UIGravatar Dirk Hohndel
Now we track the preference, but we don't act on it, yet. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-04-29Add SPDX header to remaining core filesGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-03-11Merge branch 'master' of https://github.com/dje29/subsurfaceGravatar Dirk Hohndel
2017-03-11Use abbreviations with dots.Gravatar Martin Měřinský
2017-03-08Change calls to rint into lrint avoiding conversion warningsGravatar Jeremie Guichard
Using gcc option "-Wfloat-conversion" is useful to catch potential conversion errors (where lrint should be used). rint returns double and still raises the same warning, this is why this change updates all rint calls to lrint. In few places, where input type is a float, corresponding lrinf is used. Signed-off-by: Jeremie Guichard <djebrest@gmail.com>
2016-04-04Move subsurface-core to core and qt-mobile to mobile-widgetsGravatar Dirk Hohndel
Having subsurface-core as a directory name really messes with autocomplete and is obviously redundant. Simmilarly, qt-mobile caused an autocomplete conflict and also was inconsistent with the desktop-widget name for the directory containing the "other" UI. And while cleaning up the resulting change in the path name for include files, I decided to clean up those even more to make them consistent overall. This could have been handled in more commits, but since this requires a make clean before the build, it seemed more sensible to do it all in one. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>