Free a bunch of C-style strings before assigning newly copied strings.
One case was particularly buggy:
prefs.locale.use_system_language = copy_string(qPrintable(value));
Note that prefs.locale.use_system_language is a bool, which of course
always evaluates to true! Probably nobody noticed because a restart
is required when changing locale.
Moreover remove a few double-semicolons.
Stefan Fuchs points out that sometimes you get cylinder duplication when
you merge dives, particularly with a planned dive. For example, if we
had different manual pressures in the two different dives, the cylinders
will be kept separate.
But that also means that we don't want to plot the pressures from those
other cylinders that came from another dive and are now associated with
another dive computer.
Change the "seen" logic for the cylinder to ignore cylinders that are
only mentioned by other dive computers than the active one.
Reported-by: Stefan Fuchs <sfuchs@gmx.de>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
It's already used in core/gaspressures.c where it was declared
privately, and we'll have a new user in the profile code, so just
declare it in a proper header file like it should have been.
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
The "prev" cylinder can never be negative since commit 56c206d19f
("For more manual gas pressure details"), so remove stale code that
checks for a case that cannot happen any more.
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Some BT devices support both, classical and LE, modes. Users could
choose either by prepending or removing "LE:" in the device address
field. After commit d23bd46a1b, the
device field is always disabled in Bluetooth mode.
Therefore, add a mode combo box to the Bluetooth device selection
dialog. In the default mode (auto), the old code path (based on
the Qt device flags) is used. The two other modes (force LE, force
classical) allow the user to force the preferred behavior.
This feature is meant as a stop-gap measure until a more refined
transport choice is implemented. Therefore, the value of the new
combo box is not saved in the settings, to avoid cluttering of
the preferences with soon to be obsolete entries.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
The Windows auto-verbose + log file creation if starting
from a non-terminal has the problem that the print_version()
call is never made becase 'verbose' is updated programatically
in windows.c and not by the user (by passing -v).
To work around the issue:
- move the windows console creation call before *everything* else
- then immediatelly install the message handler
- then see if 'verbose' is set and explicitly call print_version()
print_version() now also has a flag (version_printed), to avoid
printing the version multiple times, if the user decided to add
an extra -v to the Desktop shortcut.
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
If the user has not started Subsurface from a terminal
make sure that verbosity is enabled (verbose = 1), so that
the log files are populated with information useful for
debugging.
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
When filling samples with values during DC import fill sticky values
like CNS, NDL, stoptime,... immediately into current sample.
Otherwise we will not fill the sticky values into the last sample
created.
Add two new sticky values: heartbeat and bearing
Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
Fixup the NDL value to '-1' at the very beginning of a dive.
Some dive computer report a NDL of 0 at the very beginning of a dive
and then only some 10 seconds later they report the correct value
like 240 min for the first time.
Translate this 0 at the beginning of a dive into our internal '-1'
for no info available.
Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
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>
Currently, on Linux, after selecting a Bluetooth device the name of the
device is shown. On reopening the download dialog, on the other hand,
the address is shown. In the device selection dialog both are shown.
This patch changes the download dialog such that both, name and address,
are shown. The bulk of the patch introduces the name of the device in
the preferences and DCDeviceData. It has to be noted that DCDeviceData
is an encapsulation of the libdivecomputer device_data_t. Nevertheless,
the new Bluetooth-name field is, at the moment, not passed through to
libdivecomputer.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
On BLE connection timeout a weird error-message was shown, because
the controller was still in connecting state and no error string was
set. Therefore, handle the timeout case with a special case label.
Moreover, remove three unnecessary calls to disconnectFromDevice(),
which is called in the destructor of the controller anyway (verified
by looking at Qt source).
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Commit 9771255919 introduces a compiler warning due to mismatched
pointer types. Fixed here.
Reported-by: Stefan Fuchs <sfuchs@gmx.de>
Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
I'm sure this bug has heen here forever, but the CNS clock is
not very relevant for most divers, and even some technical divers
do not care about this value.
However, doing long decompression dives, the value can easily
grow over 100%, and a lot further. For example, the OSTC computers
use 2 bytes to store the CNS value in the profile data, and I
have multiple dives in my logbook going way over 255%.
This all said. Just store the CNS value in an unsigned 16 bit.
Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
Commit d15779a calculates final stop based on stoplevels[2], but if final stop
is 6m/20ft, we should use stoplevels[3]. This fixes it.
Signed-off-by: Rick Walsh <rickmwalsh@gmail.com>
Some messed up logic was producing negative deco_time values for some no-deco dives. The CVA wouldn't converge and unrealistic VPMB ceilings were displayed in the profile. This fixes it.
See #762
Signed-off-by: Rick Walsh <rickmwalsh@gmail.com>
We calculate tts every 30s, not every sample. Consider that when determining
the time that the ceiling would have cleared if it's after the surfacing time.
Signed-off-by: Rick Walsh <rickmwalsh@gmail.com>
This makes the calculations in profile.c a little simpler, especially now we
adopt consistent final ascent rate to determine deco_time since d15779a27
Signed-off-by: Rick Walsh <rickmwalsh@gmail.com>
If we consider the actual time to ascend from the final stop when calculating
deco_time, then slowing the final ascent can lead to the final stop being
extended, which is completely nonsensical. For consistency with the original
VPMB implementation, we can't ignore the final ascent time completely, but if
we assume it is always the same (take default ascent rate of 9m/min) then
slower the final ascent won't lead to a longer final stop.
Signed-off-by: Rick Walsh <rickmwalsh@gmail.com>
As it is not possible to delete dive sites from the logbook, we
need to make sure that we never save sites that are not tied to
any dive. With this change, unused site that are currently in
the logbook will also be removed, so it will also clear up
(wrong) historical data.
Supposed to fix#786
Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
A change of the font_size in preferences ended up in the wrong
preferences group (the GeneralSettings group), appearing to the
user as a non-saved preference. Fix is simple. Just set the
the correct group before saving a change in font_size.
Fixes: #780
Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
Recognize Aladin as the Bluetooth name of the Scubapro Aladin Sport
Matrix. Note that the Scubapro Aladin H Matrix most likely also
identifies itself using this BT name. But it probably uses the same
BT protocol (i.e. the G2 protocol) and therefore this should not pose
a problem. Ultimately a common name should be found.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Remove unused variables o2time and breaktime or convert into boolean.
Never consider minimum gas switch time when switching to o2.
Reflect this behavior also in the UI.
Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
QMap::operator[] creates a new default constructed entry in the map
if no entry with the given key exists. While not problematic (since
typically nullptrs are inserted) this is usually not what you want
for read access.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Currently one has to explicitly use --win32console and/or
--win32log to enable a dedicated console (a console window
that opens next to the Subsurface window) or to enable file
logging on Win32.
This patch makes the following changes:
- removes the --win32* command line arguments
- removes the dedicated console window support
- if the app starts from a shortcut and not from a console, always
redirect stderr and stdout to _err & _out log files
- if the app starts from a console redirect stderr and stdout to that
console
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
1) Destroy QLowEnergyService objects in destructor of BLEObject.
2) Let BLE object take ownership of the controller so that the
latter can be destroyed in the destructor of the former. This
introduces a certain ownership subtlety, which could be solved by
allocating the controller object in the BLE object. But let's
first do the less intrusive thing.
3) Destroy the BLE object for two error conditions.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
When planning a VPM-B dive, the "deco time" ends at surfacing, which is after
ascending after a full-minute deco stop is complete, after ceiling clears. We
should take this into account when calculating the ceiling outside of the
planner.
Signed-off-by: Rick Walsh <rickmwalsh@gmail.com>
This corrects the issue where the displayed ceiling in the profile was
"broken" by the planner, especially for shorter and shallower dives.
Also fixes issue outside of planner where the deepest VPM-B ceiling was shown
too early, messing up the deco_time calculation.
VPM-B plans respond to change in O2% in gas as expected (in my testing)
Fixes: #630
Signed-off-by: Rick Walsh <rickmwalsh@gmail.com>
If we consumed 0l/0bar in total from a cylinder there is no need to also
state that we consumed 0l/0bar during ascend.
Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
Because now we are trying to open a URL as if it was a local file.
Again, the goal is to accelerated debugging if things go wrong.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This is rather fragile code, and the capitalization of the error message
in libgit2 changed at some point. But commit 794739b4c0 ("strstr is a
case sensitive compare") didn't really fix the problem - as it broke
that same check for older libgit2 versions.
Instead use our new helper function to make it work with libgit2 old and
new.
Also, add some more error output so the next time we run into this it's
more obvious what broke and where.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
That's not a standard functions, so let's just build it. This is not
the most efficient way to write it, but it will do.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This string is substituted with the runtime increments derived of slight
variations in depth or bottom time in:
diveplannermodel.cpp:1058:
displayed_dive.notes = strdup(notes.replace("VARIATIONS", QString(buf)).toUtf8().data());
Translating it avoids substitution and we just get the translated
string.
Signed-off-by: Salvador Cuñat <salvador.cunat@gmail.com>
Fixes minor interface inconsistency: After a failed download, the
error message was also shown on subsequent successful downloads.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Otherwise the following call to do_git_save will potentially have incorrect information
about the cache validity of the dives in the divelist.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Inexplicably, commit 8b7427c56d ("Move CloudStorage out of the widgets")
didn't just move the code but added a local member 'verbose' that hides
our global variable...
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This became rather obvious with the change to immediately show errors.
The commit also fixes a small memory leak.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
The pressure information of cylinder should be kept intact when
copy-pasting other cylinder related information from other dive.
According to Dirk, the gas mix is wanted to be changed as technical
divers might have always the same multiple cylinders and wish to copy
the gasmix information over.
Fixes#689
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
This line:
dc = &dive->dc
can SIGSEGV for a NULL 'dive' pointer.
return NULL if 'dive' is NULL.
Also handle NULL 'dc' in get_gasmix() and set 'ev' to NULL.
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
current_dc is a macro that determines the dive computer
based on the current dive number. When the planner is started
from an emtpy dive list, the dive number ends up being -1 and
that doesn't produce a valid dive computer. Use the divecomputer
of the displayed_dive instead. This is done via a macro that
can also be used in two other places. Without this patch, the
planner crashed when called on an empty dive list.
Signed-off-by: Robert C. Helling <helling@atdotde.de>
Identify previous dives for CNS calculation in a similar way as it
is done for previous dives for deco calculation.
This is done to identify the previous dives dynamically when moving
around date/time of a dive in the planner.
Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
When changing the date/time of a dive in the planner the dive may end
up in a totaly new position in respect to date/time of other dives in
dive list table. It can be moved to the past or the future before or after
other existing dives. It also could overlap with an existing dive.
This change enables identification of a new "virtual" dive list position
and based on this starts looking for previous dives.
Then it (as before the change) does init the deco calculation with any
applicable previous dive and surface interval.
If some of these applicable dives overlap it returns a neg. surface time
which is then used in the planner notes to prohibit display of results.
Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
For the geo references tags update the following:
- Nicer look w/o "Tags:" text and brackets when inside location UI
- Translation for "Tags:"
- Warning message when no dive site layout categories are set
Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
Tidy up the code which creates the first sample for time = 0 to make
clear that the info for this does NOT come from the first planner point (dp).
No functional change.
Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
In the planner when a dive is created from the diveplan every first
sample with a new gas shouldn't have a pressure value added.
Otherwise the interpolation code for the pressure graph in the profile
will draw the pressure graph incorrectly.
Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
Up to now the cylinder for gas breaks was hardcoded to first cylinder.
With this change the best_first_ascend_cylinder is used if its
O2 is <=32%.
Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
When calculating the dive plan in the planner don't accidently use
another gas with same gasmix instead of the gas stored as
"best_first_ascend_gas".
This is important if you have e.g. a bottom stage and back gas with
same gas mix because then you always want to start your ascent with
the gas you used in last entered dive planner point.
Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
In the planner if one adds two or more cylinders with the same gasmix
(e.g. back gas and bottom stage 18/45) the drop down and data in the
used gas column of the planner points table will be filled with a more
verbose string mentioning also the cyl number and the cyl type
description.
Makes it easier in such a case to select the right cylinder.
Introduces also a helper function which tells you if there is another
cylinder with the same gasmix as the provided cylinder.
This also has an option if it should consider unused cylinders or not.
Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
With an OTA adapter - sadly I can't test that. This driver opens a
specific USB device and will ignore the connection settings. It would be
better to get some visual feedback for that (in the QML UI), but I'll
leave that until this has been verified to work.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit implements possible switching BT on and off during a session,
so not needing a restart of the app when the user forgot to switch
it on when starting the app.
For this, the following needed to be done: 1) create a handler that
reacts on local BT device status changes. 2) repopulate the connection
list in the download screen when a BT status change is detected.
Notice the subtile change of the Q_INVOKABLE btEnabled() function
to a Q_PROPERTY. This gives a nice dynamic behaviour when
switching BT on/off with the app open.
Fixes: #556
Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
Simple rewrite of a piece of code separated to its own function
so that is can be used in other places as well. To avoid code
duplication for dynamic BT on/off switching on mobile.
Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
Preparation primarily for mobile. When we want to switch in
one session from BT to cable connection and vise versa, we
need a way to clear the model data containing the possible
connections in use.
Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
In certain places the '(int)' cast is used, while in other the
llrint() or lrint() functions. Make the conversation from degrees
in the 'double' form to the 'int' degrees_t consistent using lrint().
lrint() is the function which should give the best results,
because it accepts a 'double' and results in a 'long'
even if degrees_t is 'int'. If the truncation from 'long' to 'int'
is discarding some of the precision then the next step
would be to turn degrees_t into a 64bit signed integer type.
Possible fix for #625.
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Calculating parameters when in the planner mode is necessary to display the correct ceiling.
Fixes#601
Signed-off-by: Rick Walsh <rickmwalsh@gmail.com>
The code incorrectly divided the temperature by 10 as an integer,
causing unnecessary precision loss due to truncation.
Fix it, and update the test results for the now improved temperature
import.
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
The divinglog import did horrible things with the strings returned from
the sqlite queries, and ended up using uninitialized values at the end
of the secondary profile data strings.
This rewrites the import logic to track the length of the strings
properly when importing the divinglog data.
We should run 'valgrind' a whole lot more than we do, I suspect.
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
I have received one sample log where after parsing a bunch of dives
properly, the sample count hits zero, and after that it is astronomical.
In case of zero, the only data we have is dive date and time of a
duplicate dive that we already parsed with proper dive profile. So
preventing a crash with this hack without properly understanding the
weird file format.
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
When planning a new dive (not replan!!!) based on an existing (planned)
dive, the cylinders from the existing selected dive are copied.
This patch guarantees that cylinders which had been marked as "unused"
are indeed copied as well. Sounds strange at the first moment but makes
sense because if one marks a cylinder explicitly as "unused" in the
planner instead of deleting it that does mean that one wants to keep
this cylinder to have it available and be able to reenable it later-on.
Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
We never actually create a list of dive sites for which we
call the reverse lookup service, it's always just displayed_dive_site.
So make this all much simpler and just go straight for that.
This commit removes a loop, but doesn't change the indentation of the
code inside the loop to make it easier to see what was changed. That
whitespace change will be in my next commit.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
The more I looked at the code that added the country to the dive site,
the more it seemed redundant given what we have with the taxonomy.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
We don't want to just be able to copy all of a dive site.
Sometimes we might want to be able to copy just the taxonomy.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Print the delta between the required minimum gas result and the cylinder
pressure at last bottom datapoint in results.
Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
Add more information for the divesite, a country can be used to help
sorting.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
If we don't set first_ceiling_pressure at start of dive, a shallow ceiling can
be shown when it shouldn't be.
Fixes#584
Signed-off-by: Rick Walsh <rickmwalsh@gmail.com>
Signed-off-by: Robert C. Helling <helling@atdotde.de>
... and reset deco information in profile ceiling computation.
The planner test then needs to know about the struct holding the deco
state.
Signed-off-by: Robert C. Helling <helling@atdotde.de>
Calculating dive.when + dive.duration doesn't always give the correct
endtime of a dive especially when a dive has surface interval(s) in
the middle.
Using the helper function dive_endtime() fixes this issue.
Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
When we merge dives, the sample_start and sample_end pressures are only
used in-memory for displaying data to the user. However, we should
update them as well as this will show the user the correct data in the
equipment/cylinder and i.e. SAC calculation.
Fixes#577
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
9m/min (or 10m/min) is the ascent rate assumed by Buhlmann and navy tables,
and the default of most other planning software and dive computers.
Setting the default to 9m/min allows the default behaviour to be consistent
with "expected" behaviour, but does not prevent the user from changing the
preference. There is disagreement between some users whether the final ascent
ascent duration should be considered when determining the length of the final
stop. This change does not alter that at all, but at 9m/min, the difference
is <1min.
See #592
Signed-off-by: Rick Walsh <rickmwalsh@gmail.com>
Most writes to a connected DC are small, typically some
command bytes to get DC in download mode, or to set
some parameter. All this just worked over BLE,
however, sending a full firmware update (on an
OSTC device) failed, as the underlying BLE interface
can only handle small 20 byte BLE packets at once.
So, send max ble->packet_size chuncks at once.
Tested for the following cases (linux desktop with
OSTC3 over BLE):
1) normal download of dive data.
2) read and write settings from configure UI
3) update firmware (from 2.15 to 2.15)
And to my surprise, no flow control credit administration
is required here.
Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
Stupidly, commit 731d9dc9bd ("DC download: tell user when no new dives
were found") was missing the conditional when to show that messages.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This option should have never been there. This is not how
gradient factors are supposed to work. It would only trick
users to use the wrong value..
Signed-off-by: Robert C. Helling <helling@atdotde.de>
While this interface is deprecated, too much in our existing code depends
on being able to create the QLowEnergyController with just the address.
Additionally, createCentral() is new in Qt 5.7 and therefor this broke
builds on Linux distros that are still on 5.6.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
The ordering on Mac appears to be random, but after looking through the
various successful logs of BLE downloads, it seems we always wrote to the
ClientCharacteristicConfiguration descriptor. So try to find that one first,
and only grab the first descriptor in the list if we didn't find a
ClientCharacteristicConfiguration descriptor.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Right now this will only work if you scan for your BLE dive computer every
time. Ideally we should simply initiate a scan and look for that address if
it's not found in the hash.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Dive IDs are unique but same dive number can appear multiple times within
the same database. This can happen for example when user changes the
"next log number" from his computer.
Signed-off-by: Seppo Takalo <seppo.takalo@iki.fi>
The provided strod_flags(str, 0, 0) should work as a drop in replacement
for atof() but does not care about locales which may cause atof() to fail.
strtod_flags() would allow checking of conversion result, but I did not
change the existing logic. This was just regexp search&replace change
to get rid of atof(). I use flags 0 to get more relaxed conversion.
Fixes#574
Signed-off-by: Seppo Takalo <seppo.takalo@iki.fi>
We only cleared the first sensor data when we created new synthetic plot
info entries, because we only used to have one (well, we had the o2
data, but apparently nobody ever noticed that it didn't get properly
interpolated, probably because people who have CCR dives with o2
pressures are few, and the pressure drops are gradual anyway).
Clear all the pressure data, so that the interpolation code doesn't
think we have some existing real sensor data for the plot info entries
in between proper sample entries.
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
The XML saving code got the multi-sensor case completely wrong, because
it still had one place where it would always save the first pressure,
rather than the pressure from the right sensor.
This was hidden by the fact that old data would be saved using the
legacy model that only ever used the first sensor slot. Only if you
actually had multiple sensor slots used would the bug trigger.
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Consider cylinder used also if the first and last sample pressure differ
enough
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
We used to only show the first pressure we had, from back when we only
supported a single sensor.
Reported-by: Stefan Fuchs <sfuchs@gmx.de>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Re-do the logic to use add_gas_switch_event() instead of creating event
manually.
Fix the SQL query to find the proper dive id from dive log number.
Signed-off-by: Seppo Takalo <seppo.takalo@iki.fi>