aboutsummaryrefslogtreecommitdiffstats
AgeCommit message (Collapse)Author
2019-08-08Planner: use planner's dive in interpolate_transition()Gravatar Berthold Stoeger
Instead of passing the global displayed_dive to calc_crushing_pressure(), use the dive the planner is working on. A small step in making the planner thread-safe. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-08-08Parser: remove global stateGravatar Berthold Stoeger
The parser had global state in the form of a linear regression and the "plot_depth" variable. Collect that in the deco_state struct and pass it down the call-chain. Move out the code to update the regression data to not bother other callers of tissue_tolerance_calc(). Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at> Signed-off-by: Robert C. Helling <helling@atdotde.de>
2019-08-08Cleanup: remove unused function printdecotableGravatar Berthold Stoeger
It is unclear where this function has ever been used. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-08-08Cleanup: make local functions in planner.c of static linkageGravatar Berthold Stoeger
A number of functions were not used outside of planner.c. Make them static. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-08-08Cleanup: move planner/deco related declarations planner/deco.hGravatar Berthold Stoeger
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-08-08Cleanup: move file-related function declarations to file.hGravatar Berthold Stoeger
A number of architecture-dependent functions were declared in dive.h. Move them to file.h so that not all file-manipulating translation units have to include dive.h. This is a small step in avoiding mass-recompilation on every change to dive.h Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-08-08Cleanup: move error reporting function declarations to errorhelper.hGravatar Berthold Stoeger
Move the declarations of the "report_error()" and "set_error_cb()" functions and the "verbose" variable to errorhelper.h. Thus, error-reporting translation units don't have to import the big dive.h header file. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-08-08Cleanup: replace macro by inline function in gas-model.cGravatar Berthold Stoeger
Replace a macro calculating a degree-three polynomial by an inline function. Moreover, calculate the powers 1, 2 and 3 of the pressure inside the function. The compiler will be smart enough to optimize this to the same code. The only important thing is to write "x*x*x*coeff" instead of "coeff*x*x*x". The compiler can't optimize the latter because ... wonderful floating point semantics. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-08-08Move the Suit text box from the Notes tab to the Equipment tabGravatar willemferguson
Sqash latest commit with previous one. Signed-off-by: willemferguson <willemferguson@zoology.up.ac.za>
2019-08-08Desktop user manual: dc managementGravatar willemferguson
The relevant text in the present manual is obsolete. Update the text dealing with dive profiles from several sive computers for one specific dive. One image is added. Deal with creating a new cylinder type. Signed-off-by: willemferguson <willemferguson@zoology.up.ac.za>
2019-08-08Desktop: display trip time on main-tabGravatar Berthold Stoeger
On the main tab, the trip time was not shown when switching to a trip. Implement showing of the trip date in a function, as the undo-code will also have to update the trip date in certain circumstances. Fixes #2207 Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-08-08Indicate negative cylider pressureGravatar Robert C. Helling
The planner can produce negative cylinder pressures when more gas is used than available. Let's color the pressure graph in a highly visible color to alert the user of the fact that current gas planning is insufficient. Signed-off-by: Robert C. Helling <helling@atdotde.de>
2019-08-08Fix math in valueAtGravatar Robert C. Helling
DiveCartesianAxis::valueAt() is supposed to be the inverse of posAtValue(). This fixes the math such that inverted orientations are correctly taken care of. Signed-off-by: Robert C. Helling <helling@atdotde.de>
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>