Some users try to run Subsurface as root for example to get around
permission problems with dive computer devices. This is a bad idea
since config files get touched as root and then cannot be read
as normal user anymore.
This patch allows running as root only with verbose option on. We can
assume if somebody manages to start subsurface as root this happens
from the command line.
For some reason, I couldn't get translation working at this stage.
Windows version is a stub.
Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
On iOS it seems that I get a fix every second. Even though the
QGeoPositionInfoSource is set up with an update interval of 5 minutes...
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This is in the Mac support file that wasn't compiled on Linux when I tried to
finish the cleanup.
Now this compiles without warnings on Mac and iOS as well.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
The old expression wass correct because if dive_table.dives[j]->number is != 0,
then !dive_table.dives[j]->number is 0 and vice versa. But come on...
The new code seems much more natural and easier to read.
And of course the Apple compilers by default gave a warning because they
suspected a precedence bug with the old code.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
The saved_git_id could be updated in is_git_repository() under certain
circumstances, so we need to make sure we compare to the sha that was
current as we entered this function. Since the pointer is just to a static
buffer we need to actually copy it (and then free it later).
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Otherwise parse_file() thinks that this data has already been loaded and
doesn't re-read it, even though our internal data structures have been
erased - so a subsequent parse_file after clear_dive_file_data() that
opens the same git repository finishes successfully, but leaves the
dive_table empty which is of course incorrect.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Trying to clean up the signed vs. unsigned issues it becomes clear that
forcing depth to be unsigned causes way too many problems in the code.
So this commit goes the opposite direction; since we clearly aren't
limited INT_MAX vs UINT_MAX, simply make more of the depth related
variables signed.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Add a symbol to each line of output table indicating whether a segment is an
ascent, descent, constant depth (user entered) or deco stop
Signed-off-by: Rick Walsh <rickmwalsh@gmail.com>
Signed-off-by: Robert C. Helling <helling@atdotde.de>
This was broken when introducing loading images from the server. Now it first tries the
server and if that fails tries the actual URL.
Still, the image does not show up immediately, since the DivePictureModel is
unavailable to the image downloader to be told to update the images.
This needs to be fixed but in the mean time, the image is shown when the dive
is reselected (possibly on the next run) since it is then loaded from the cache.
Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
as otherwise we crash when the picture is freed before the
worker thread (to load from the net or to compute hashes)
is finished
Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
While on the desktop we show the error to the user, in Subsurface-mobile
it's only appended to the log; so in order to improve debuggability it
makes sense to show the full error there.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This updates the gas model to use the new virial coefficients from the R
script, and simplifies the expression a tiny bit by avoiding the
division by 1000 for the gas fractions, and replacing it with a multiply
by 0.001 at the end.
The virial coefficients for Oxygen and Nitrogen changed in the last
digits due to the use of a different tool for the least-square fitting.
That also accounts for the change in format (the coefficients are not
using scientific notation).
The coefficients for Helium changed noticeably more, since they are now
based on the new least-squares fit from the raw data.
But the actual end result does not change appreciably, the main
advantage is that now the numbers are easily reproducible.
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Lubomir pointed to exactly where he got his data from, so I added that
raw Helium data to the R script, and let the least-squares fit just take
care of the interpolation between 273K and 323K.
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
It annoyed me that we hand-waved a bit about how the virial factors were
actually computed in the gas-model.c file, so here's an actual R script
that computes them and plots the results.
You can run it with (for example):
R --vanilla < compressibility.r
and it will generate a Rplots.pdf of the plots, and the coefficients
will be shown on stdout.
The result actually differs in insignificant ways from the values that
Lubomir computed, which is likely just due to tools. I used R, Lubomir
seems to have used
http://polynomialregression.drque.net/online.php
but the actual curve is pretty much the same.
NOTE! R is not entirely happy about the non-linear fit of the Helium
curve: the fit is *so* precise that it failes the R relative-offset
convergence criterion. That is apparently generally a sign of
artificial data.
That is probably because Lubomir generated them from the linear mix of
two polynomial fits, rather than a linear mix of the original data. But
maybe the original data was artificial?
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This started out as cleaning up warnings - but it actually turned into a
matter of semantics and correctness. Which lead to changes in .h files
which will have a ton of ripple effects.
A lot more of this to come.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>