aboutsummaryrefslogtreecommitdiffstats
AgeCommit message (Collapse)Author
2019-08-08Limit gas compressibility argument range to halfway sane valuesGravatar Linus Torvalds
The curve fitting for our gas compressibility was only done in the sane range of 0-500 bar, which is what a scuba cylinder can reasonably be expected to perhaps have. But the planner ends up happily using negative cylinder pressures when you run out of gas, and then the compressibility gives nonsensical results. That's clearly a planner bug, but the nonsensical gas compressibility values made it harder to see what could be wrong. So we just clamp the inpot range to the range we have verified against experimental data. If you try to get compressibility for negative pressures, you get the compressibility for an ideal and imaginary gas. And if you try to get compressibility for pressures over 500 bar, we'll just assume that it's 500 bar. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2019-08-04Cleanup: use clear_git_id() instead of setting saved_git_idGravatar Berthold Stoeger
For better encapsulation, use clear_git_id() in clear_dive_file_data() instead of setting saved_git_id directly. Thus, memory management of the saved_git_id value is encapsulated and can be modified more easily. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-08-04Coding style: add spaces in load-git.cGravatar Berthold Stoeger
Add spaces before and after multiplication and addition operators. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-08-04Git: Make parser reentrantGravatar Berthold Stoeger
The git parser was using a number of global static variables. Remove them by introducing a parser state, which is passed down to the call hierarchy. Advantages: 1) Removes global variables and makes the parser (mostly) reentrant. 2) More flexible - e.g. when parsing samples, the parser can now access the dive to check if the cylinder number is valid. 3) Less weak typing through "void *". Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-08-04Cleanup: make functions in core/load-git.c localGravatar Berthold Stoeger
The function get_divemode() and git_tree_entry_blob() were not used outside of load-git.c. Make them of static linkage. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-08-02[smtk-import] fix mem leaks on site/location failure managementGravatar Salvador Cuñat
Signed-off-by: Salvador Cuñat <salvador,cunat@gmail.com>
2019-08-02[smtk-import] avoid infinite loop on index failureGravatar Salvador Cuñat
As Berthold points out, a failure to match the site or location index will result in an infinite loop with previous patch. With this one the loop will end after reading the last table row even if no idx is matched. But ... If we asume this situation is possible the retrieved data would be wrong, and ending the function without filling the site structure is mandatory too. Signed-off-by: Salvador Cuñat <salvador.cunat@gmail.com>
2019-08-02fix site/location build issueGravatar Salvador Cuñat
We were assuming these tables were sorted with their indexes, but it happens to be false, under some circustances at least. Reported-by: Andreas Hagberg <scubasoft@gmail.com> Signed-off-by: Salvador Cuñat <salvador.cunat@gmail.com>
2019-08-01Prepare for 4.9.1 releasev4.9.1Gravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-07-29Desktop: correct tooltip for filter close buttonGravatar Dirk Hohndel
This button only closes the filter panel but doesn't clear it. Reported-by: Adric Norris <landstander668@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-07-27Crash fix: prevent crash in MapLocationModel::reloadGravatar Berthold Stoeger
Commit 0c387549164d7eec3ea6647c54ada2fba7f8d5e6 introduced a bug in MapLocationModel::reload() by setting an entry in the name-to-location map before the location was initialized. Move the setting of the map entry back where it was before: after the assignment of the location variable. Moreover, define the location variable directly on allocation of the location to avoid thus bugs in the future. Why did we not get a "might be used unitialized" warning anyway? Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-07-27Core: split copy_cylinders() in two functionsGravatar Berthold Stoeger
copy_cylinders() copied the cylinders of one dive onto another dive and then reset to the original gas values. Presumably, when copy and pasting cylinders from one dive to another, only the types should be copied, not the gases. Moreover, the function could either copy all or only the used cylinders. Firstly, the code was bogus: when restoring the pressures the indices were mixed up: the old indices were used. Thus, when there where uncopied cylinders, not all pressure values were restored. Secondly, it is not clear that all callers actually want to restore the pressure data. It rather appears the two (out of three) callers actually just want to copy the cylinders. Therefore, split the function in 1) copy_cylinders(): copy the cylinders with pressure data 2) copy_cylinder_types(): copy only the cylinder information Since there is only one caller of copy_cylinder_types(), the "used_only" argument can be removed. Since all cylinders are copied there is no point in storing the pressure data. Don't overwrite it in the first place. The resulting two functions should be distinctly easier to understand. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-07-27Desktop: fix index in weightsystems_equal()Gravatar Berthold Stoeger
The weightsystem_equal() function compares weightsystems of two dives to decide whether the "commit changes" message should be shown and to decide which dives are edited when changing multiple dives. Due to an index mixup the function returned wrong results for more than two weightsystems. Fix it. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-07-27Cleanup: remove TankItem::diveCylinderStoreGravatar Berthold Stoeger
The last user of this member variable was removed in commit 96ed09bf145a5e108ca8098a1a5814784bcbebd2. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-07-19Bluetooth: autodetect Shearwater NERD modelsGravatar Dirk Hohndel
This should allow it to work with Subsurface-mobile as well. Fixes #2187 Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-07-19Android: ensure higher build number for arm64 APKGravatar Dirk Hohndel
Google Play allows uploading two APKs, but only if the arm64 one has a higher build number. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-07-19Cleanup: remove bogus mark_divelist_changed() callsGravatar Berthold Stoeger
The parsers / downloaders parse into a separate table and do not directly change the divelist. Therefore, they shouldn't call mark_divelist_changed(). Likewise split_dive_at() doesn't modify the dive list and therefore shouldn't call this function. Calling the function has the unwanted side-effect that undoing the change will not clear the *-symbol in the title of the main window. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-07-19Undo: make editing of dive number undoableGravatar Berthold Stoeger
When pressing F2 in the dive list, the number can be edited. Make this action undoable by implementing a EditNumber command. This command is differs from the other undo commands, as not the currently selected dives are changed. This means that the EditCommand needs an alternative constructor taking a single dive. This constructor was implemented in the base class so that all edit commands can now be called with a single dive. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-07-18Android: small change to keep exports togetherGravatar Dirk Hohndel
Simply move that export to the top of the file with the others. Suggested-by: Anton Lundin <glance@acc.umu.se> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-07-18Android: fix review commentGravatar Jan Mulder
Fix review comment by Anton on GitHub. Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2019-07-18Android: fix location of the build apksGravatar Jan Mulder
With all upgrading, the build apks now show up in a slightly different location. Correct this in the scripting. Notice that this is debug building only. Release building is outside the repo. Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2019-07-18Android Docker: make a nice version tag fileGravatar Jan Mulder
Trivial. The final touch command was missing the proper quotes, so it created a bunch of strangely names files from the date command. Just good for the developers that like to peek into the docker image. Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2019-07-18Android: hack around the build issue with a custom containerGravatar Dirk Hohndel
Local testing seems to indicate that the build should work with this container. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-07-18Android: Switch to Qt 5.12.4 containerGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-07-18Android: rework build of OpenSSL to get it to build link and runGravatar Jan Mulder
This is squashed commit consisting of a number of subjects, all intended to get our app to build, link and run on device, but as the steps are small (but non-trivial), I document them in this one commit. 1) Do not use OpenSSLs install targets, but simply copy the wanted build artifacts manually. The main reason for this, is that the install targets want to install a lot more than we build, so it also builds parts of the OpenSSL suite that we will never use. 2) As Android does not like shared libraries with embedded versioning (and the used androiddeployqt actively prevents adding versioned libraries to the build), strip all this data from the generated shared libraries. This trick was already there, but its adapted to all possible conflicts. 3) The OpenSSL config script seems rather broken, resulted in failed builds, and calling the underlying Configure is simpler. 4) Finally, parts of the OpenSSL code uses stdio things like stdout, stderr, etc. These showed up as undeclared external on build time. Well, luckily, there was an easy way out using 2 -D(efines). This feels hacky, but does the job (and we are not interested in the output of OpenSSL in our app). Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2019-07-18Android: Qt 5.12.4, OpenSSL 1.1.1cGravatar Jan Mulder
The main reason for upgrading of the Qt version is the hunt for a broken BT/BLE stack, preventing downloads from BT/BLE enabled DCs, in relation to arm64 architecture builds. (And the absolute need for an arm64 build in relation to the publication of the Android app in Googles Play store). In addition, Qt 5.12.4 starts supporting OpenSSL 1.1.1c, and trying to use our current OpenSSL 1.0 series is highly discouraged by Qt (and OpenSSL itself). So, upgrade both in unison. But ... be careful bisecting issues on this commit, as it does break our build. That will be fixed in the next commit. This fixes the BT/BLE download for arm64! Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2019-07-18Android: newer version of Gradle pluginGravatar Jan Mulder
Using more recent versions of the Android NDK results in a build failure saying something like "No toolchains found in the NDK toolchains folder for ABI with prefix: mips64el-linux-android". Mips support went away after Android NDK, Revision r17c, and we are using r18b at this moment. Too old Gradle stuff gets confused by this. The solution is simple. Use a newer version of the Gradle plugin. Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2019-07-18Cleanup: remove unused weightsystem_none() functionGravatar Berthold Stoeger
This function was used to count the number of weightsystems used in a dive. Since the weightsysems are now collected in a dynamic table it became unused. Remove. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-07-18Core: dynamically resize weight tableGravatar Berthold Stoeger
Replace the fixed-size weightsystem table by a dynamically relocated table. Reuse the table-macros used in other parts of the code. The table stores weightsystem entries, not pointers to weightsystems. Thus, ownership of the description string is taken when adding a weightsystem. An extra function adds a cloned weightsystem at the end of the table. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-07-18Core: Implement same_weightsystem() function to compare weightsGravatar Berthold Stoeger
This will be used later when joining and editing dives. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-07-18Cleanup: declare functions in profile.h as externGravatar Berthold Stoeger
We seem to do this in other C-headers, so for consistency also do it here. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-07-18Cleanup: make the plot-pressure type an enumGravatar Berthold Stoeger
Sadly, this doesn't give any type safety. But at least it documents the function arguments. Make the last item in the enum as a number-of-pressure-entries sentinel. Use that to size the pressure-values array. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-07-18Cleanup: introduce function to set pressure valuesGravatar Berthold Stoeger
Instead of assigning the the lvalue of the SENSOR_PRESSURE macro, introduce a general function to set pressure values. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-07-18Cleanup: update comment in core/gaspressures.cGravatar Berthold Stoeger
The comment to populate_pressure_information() was mentioning gas pressures that didn't exist. Remove these parts. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-07-18Cleanup: replace pressure reading macros by inline functionsGravatar Berthold Stoeger
Replace the INTERPOLATED_PRESSURE and SENSOR_PRESSURE macros by inline functions. Generate a common inline function that reads a pressure value for a dynamic sensor. Not all SENSOR_PRESSURE macros can be replaced, because the macro is also used to set the value and C sadly doesn't know the concept of "return reference from a function". Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-07-18Cleanup: turn GET_PRESSURE macro into inline functionGravatar Berthold Stoeger
There is absolutely no reason to use a macro here. The only argument that can be made is consistency with the other pressure-macros, but those too are questionable. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-07-18Cleanup: remove non-existing pressures in debug_print_pressures()Gravatar Berthold Stoeger
DILUENT_PRESSURE and INTERPOLATED_DILUENT_PRESSURE do not exist anymore. No point in trying to output them. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-07-18Cleanup: remove unused macro SAC_WINDOWGravatar Berthold Stoeger
Last user was removed in ae1e9b11a537eb0ba9b649cb876dae4cc4628045 Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-07-18Cleanup: Remove unused function calls in main tabGravatar Berthold Stoeger
per_cylinder_mean_depth() and selected_dives_gas_parts() are used in the dive-information and statistics tab, respectively. Nevertheless, these functions are called on the main tab as well and the result is trashed. Therefore remove the calls. Must have been an artifact. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-07-18Cleanup: remove includes from qthelper.hGravatar Berthold Stoeger
To reduce interdependencies, remove the dive.h and divelist.h includes in qthelper.h Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-07-18Cleanup: move deco function declarations to deco.hGravatar Berthold Stoeger
Another tiny step in making dive.h smaller: move function declarations to deco.h if these functions are defined in deco.c and don't directly concern dives. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-07-18Cleanup: remove includes from qt-models/models.hGravatar Berthold Stoeger
qt-models/models.h included dive.h and divelist.h. Remove these unnecessary includes, to reduce interdependencies. A drop in the bucket, for sure. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-07-18Cleanup: fix include weirdness concerning string_to_*() functionsGravatar Berthold Stoeger
The string_to_*() functions were declared in dive.h and qthelper.h. Moreover in one file they were declared with C in the other with C++ linkage. This only works because qthelper.h includes dive.h first. Fix this anomaly by declaring the functions only in qthelper.h, but moving them from the C++ to the C part. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-07-18Cleanup: move cylinderuse_from_text() to equipment.cGravatar Berthold Stoeger
Since this function doesn't act on a dive and is only related to cylinders, move it to equipment.c and equipment.h. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-07-16Latest translationsv4.9.0Gravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-07-15Update list of supported dive computersGravatar Dirk Hohndel
The last minute libdivecomputer update brought in a new support dive computer. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-07-15update parse-descriptor.plGravatar Dirk Hohndel
libdivecomputer is a submodule. Just hardcode the path to descriptor.c. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-07-15Bluetooth: recognize Ratio iX3m GPS dive computersGravatar Dirk Hohndel
We cannot tell them apart by Bluetooth name, so pick one of the names. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-07-15Update libdivecomputerGravatar Dirk Hohndel
- Add support for the Aqualung i550C - Update Ratio iX3M GPS naming and note that they support rfcomm - misc cleanups Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-07-14Fix up XML saving of remaining bottom time dataGravatar Linus Torvalds
While testing the cylinder type saving fix, I noticed that the RBT saving was broken. Instead of saving RBT whenever it changed, we'd save it when it was non-zero. Which doesn't match the git save format, and also doesn't match what we do when loading an xml file (where we default to the previous RBT value, and a sample RBT will modify it). Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>