Commit graph

12147 commits

Author SHA1 Message Date
Jan Mulder
fd03621a4b Mobile: honour location service time threshold
Independ of the settings, the threshold to reset the GPS data was
hard coded to 5 minutes. Now, honour the entered (and updated during
a session) time to refresh the GPS data in the location service.

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2017-07-25 22:12:19 +09:00
Linus Torvalds
adb4b66a05 Try to sanely download multiple concurrent cylinder pressures
This tries to sanely handle the case of a dive computer reporting
multiple cylinder pressures concurrently.

NOTE! There are various "interesting" situations that this whole issue
brings up:

 - some dive computers may report more cylinder pressures than we have
   slots for.

   Currently we will drop such pressures on the floor if they come for
   the same sample, but if they end up being spread across multiple
   samples we will end up re-using the slots with different sensor
   indexes.

   That kind of slot re-use may or may not end up confusing other
   subsurface logic - for example, make things believe there was a
   cylidner change event.

 - some dive computers might send only one sample at a time, but switch
   *which* sample they send on a gas switch event.  If they also report
   the correct sensor number, we'll now start reporting that pressure in
   the second slot.

   This should all be fine, and is the RightThing(tm) to do, but is
   different from what we used to do when we only ever used a single
   slot.

 - When people actually use multiple sensors, our old save format will
   start to need fixing.  Right now our save format comes from the CCR
   model where the second sensor was always the Oxygen sensor.

   We save that pressure fine (except we save it as "o2pressure" - just
   an odd historical naming artifact), but we do *not* save the actual
   sensor index, because in our traditional format that was always
   implicit in the data ("it's the oxygen cylinder").

so while this code hopefully makes our libdivecomputer download do the
right thing, there *will* be further fallout from having multiple
cylinder pressure sensors.  We're not done yet.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-07-25 06:11:10 -07:00
Miika Turkia
97b770b837 Error message on mobile cloud credentials
Display proper error message when cloud credentials are incorrect.

See #481

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2017-07-25 10:04:20 +09:00
Miika Turkia
1fe22a28ed CCR is now detected from the log data
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2017-07-24 13:08:04 +09:00
Miika Turkia
685c59214d Map Divinglog's visibility to our stars
good (1) = 5
medium (2) = 3
bad (3) = 1

There seems also to be 0 used in the log, even though it is not
mentioned in the valid selections. This is not giving any stars for this
option...

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2017-07-24 13:08:04 +09:00
Miika Turkia
a7231be9a0 Detect CCR/PSCR from Divinglog import
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2017-07-24 13:08:04 +09:00
Miika Turkia
c69a56b53b Fix TestParse to handle CCR import properly
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2017-07-24 10:03:07 +09:00
Miika Turkia
0e9e1b6043 Fix CCR detection on Divinglog import
Note that I have not been able to do a positive test for this due to
lack of CCR sample data. But at least OC dives are now categorized
correctly.

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2017-07-24 10:03:07 +09:00
Miika Turkia
27bb76e834 Add visibility support to Divinglog import
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2017-07-24 10:03:07 +09:00
Dirk Hohndel
04213e1f03 QML UI: Download from DC: tell user if BT is disabled
This makes much more sense than displaying "No dives"

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-07-23 17:51:48 -07:00
Dirk Hohndel
be8eedb773 QML UI: Download from DC: move label next to buttons
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-07-23 17:45:55 -07:00
Dirk Hohndel
442ba66822 QML UI: remove obsolete comment
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-07-23 17:32:21 -07:00
Dirk Hohndel
8c0a1c2e6d QML UI: better list of downloaded dives
Not the lsit is much more compact and shows a lot more dives even on
smaller screens. And it's similar in style to the dive list.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-07-23 17:30:05 -07:00
Joakim Bygdell
b9e90441ca QML UI: replace theme checkboxes with switches
Replace the theme checkboxes on the settings page
so that we get a unified UI.
These switches are linked and as such can only be activated
deactivation occurs when the user selects another theme.

Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com>
2017-07-23 23:47:22 +09:00
Joakim Bygdell
d51fe03bd9 QML UI: move location services to GPS menu
Move the location services switch to the GPS menu, indicate both with icon and text if the service is active or not.

Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com>
2017-07-23 23:47:22 +09:00
Joakim Bygdell
3b3f6b67f5 QML UI: fix copy paste error
The credential status has nothing to do with GPS functionality.

Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com>
2017-07-23 23:47:22 +09:00
Joakim Bygdell
2187ef6c90 QML UI: fix typo
Simple typo on the overlay drawer.

Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com>
2017-07-23 23:47:22 +09:00
Dirk Hohndel
587882c88b QML UI: remember the last dive computer
We already have the infrastructure to do so, all we needed to
do was hook it all up.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-07-22 16:15:00 -07:00
Dirk Hohndel
686b87e903 QML UI: Download from DC: respond to click on checkbox
Strangely, a click/tap anywhere else worked as expected, but if you hit
exactly on the checkbox, the status change wasn't propagated.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-07-22 16:15:00 -07:00
Dirk Hohndel
05a3bbe65c QML UI: Download from DC: remove unused property
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-07-22 16:15:00 -07:00
Dirk Hohndel
e49a3b01ab QML UI: save credentials as they are bein entered
We removed the action button for saving on the Settings page, so credentials
never got saved.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-07-22 16:15:00 -07:00
Dirk Hohndel
680022aea5 QML UI: don't disclose the current password
This isn't perfect, but at least it doesn't disclose a password that
isn't currently being edited.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-07-22 16:15:00 -07:00
Dirk Hohndel
a03aa44821 QML UI: fix typo
And remove line that's commented out.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-07-22 16:15:00 -07:00
Dirk Hohndel
0b78b0c192 QML UI: allow downloading from libdc simulator
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-07-22 16:15:00 -07:00
Miika Turkia
405f27eb2a Fix comparison data for TestParse
It appears that we used to get additional tts=0:00min tags on Seabear
parsing. I would assume these to be incorrect as there other values
right before these that look more sensible. Also the resent change to
streamline the feature of not storing repeating values causes the test
to fail. Anyway, just grabbing the new result to compare with as it
seems sensible.

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2017-07-23 04:11:00 +09:00
Dirk Hohndel
a24e49361d Add README explaining icon licenses
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-07-22 11:26:06 -07:00
Joakim Bygdell
1659390a54 QML UI: simplify settings page code
In stead of using the fixed 4 column code introduced in f2fcad89b0db9b164d8fd3f89218ad27ca362bd3 use percentages of page width to allow for a more flexible layout since no block really has 4 columns.

Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com>
2017-07-23 03:20:58 +09:00
Joakim Bygdell
a80394d5b6 QML UI: make the theme settings not overflow page width
As per title.

Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com>
2017-07-23 03:20:58 +09:00
Joakim Bygdell
f96dacc94d QML UI: remove the save button from settings page
As per title.

Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com>
2017-07-23 03:20:58 +09:00
Joakim Bygdell
ee210c3bcd QML UI: enable auto-save on settings page
Automatically save changes made on the settings page on completion of text fields or theme checkboxes.

Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com>
2017-07-23 03:20:58 +09:00
Joakim Bygdell
bc0f473908 QML UI: merge all GPS settings in one block
Put all GPS settings in one block and revert to a 2 column layout while maintaing the 4 column widh.

Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com>
2017-07-23 03:20:58 +09:00
Joakim Bygdell
a56e98ffc6 QML UI: Replace checkboxes on settingspage with switches
Replace the checkboxes for location services and developer with switches.

Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com>
2017-07-23 03:20:58 +09:00
Joakim Bygdell
a5d43bc5f8 QML UI: fix typo
Simple typo fix.

Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com>
2017-07-23 03:20:58 +09:00
Rick Walsh
213f68d922 Mobile settings: stylize switches
Signed-off-by: Rick Walsh <rickmwalsh@gmail.com>
2017-07-23 03:20:58 +09:00
Rick Walsh
8d2b59ff31 Mobile Settings formatting
Signed-off-by: Rick Walsh <rickmwalsh@gmail.com>
2017-07-23 03:20:58 +09:00
Joakim Bygdell
6655b37add Mobile: consolidate settings to one page and menu entry
Addresses: #492

Signed-off-by: Rick Walsh <rickmwalsh@gmail.com>

Had a bit of rebase issue with this one.

Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com>
2017-07-23 03:20:58 +09:00
Joakim Bygdell
e80132cdef QML UI: move location service to preferences page
Move the locations service switch to the GPS section of  the preferences page.

Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com>
2017-07-23 03:20:58 +09:00
Joakim Bygdell
98268a0c7e QML UI: add icons to the GPS menu
As per title.

Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com>
2017-07-23 03:20:58 +09:00
Joakim Bygdell
5739294c07 QML UI: add icons to the dive management sub-menu
The title says it all.

Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com>
2017-07-23 03:20:58 +09:00
Joakim Bygdell
72c5125b2e Add more icons
New icons for the dive management  sub-menu
ttps://material.io/icons/
The icons are under Apache License Version 2.0

Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com>
2017-07-23 03:20:58 +09:00
Joakim Bygdell
8419a19810 QML UI: add icons to global drawer
Add an icon to each item in the global drawer

Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com>
2017-07-23 03:20:58 +09:00
Joakim Bygdell
71b6b8e043 Add material icons
Add a couple of icons from the material repository.
https://material.io/icons/
The icons are under Apache License Version 2.0

Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com>
2017-07-23 03:20:58 +09:00
Joakim Bygdell
a66d876ed0 QML UI: add checkbox to show/hide developer menu
Add a checkbox to the preferences page to facilitate selective visibility of the developer menu. With the coresponding function in qmlmanager.

Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com>
2017-07-23 03:20:58 +09:00
Joakim Bygdell
0eef27376a QML UI: reorder the items of the global drawer
Change the order of the items in the global drawer and change the name of some of them.

Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com>
2017-07-23 03:20:58 +09:00
Linus Torvalds
342391e0d1 Show multiple gas pressures in the profile even if the dive isn't CCR
Now that the cylinder pressures are more generalized, we should show
them even for non-CCR dives if we have them.  The most notable example
would be having separate pressure transmitters for both cylinders in a
sidemount setup. The code no longer really depends on any CCR logic.

NOTE! This is still preparatory work, in that this is one part of
supporting multiple simulataneous cylinder pressures, but we are still
lacking in other departments (eg properly filling those fields in when a
dive computer exports multiple pressure sensors etc).

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-07-22 10:38:32 -07:00
Linus Torvalds
92ecbc8c83 parse-xml: use the right dc for filling in extra data
"cur_dc" may be NULL when the XML source isn't a subsurface XML file,
and xml parsing is supposed to use "get_dc()" to pick a dive computer
when the nesting of the XML may not be proper.

Now, XML sources that don't have the proper dive computer nesting
markers generally also do not end up having the extra-data string
information, but one example of this is the simple XML that the
libdivecomputer 'dctool' program generates.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-07-22 10:38:11 -07:00
Linus Torvalds
b9f52d0aff Gas usage statistics: don't require gas switch events
Our "get_has_used()" helper only filled in gas usage for cylinders that
had a gas change event associated with them.  That works really badly
for things like CCR, but also simply for cases where the dive computer
wasn't necessarily explicitly notified about usage, like sidemount
diving etc.

Just remove the logic.  If some use ends up particularly wanting to
ignore some cylinder, they can always do it in the caller instead.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-07-22 10:38:00 -07:00
Linus Torvalds
f2a6a76b3e Fix up o2 pressure sensor handling at load time
Because of how we traditionally did things, the "o2pressure" parsing
depends on implicitly setting the sensor index to the last cylinder that
was marked as being used for oxygen.

We also always defaulted the primary sensor (which is used for the
diluent tank for CCR) to cylinder 0, but that doesn't work when the
oxygen tank is cylinder 0.

This gets that right at file loading time, and unifies the xml and git
sample parsing to make them match. The new defaults are:

 - unless anything else is explicitly specified, the primary sensor is
   associated with the first tank, and the secondary sensor is
   associated with the second tank

 - if we're a CCR dive, and have an explicit oxygen tank, we associate
   the secondary sensor with that oxygen cylinder.  The primary sensor
   will be switched over to the second cylinder if the oxygen cylinder
   is the first one.

   This may sound backwards, but matches our traditional behavior where
   the O2 pressure was the secondary pressure.

This is definitely not pretty, but it gets our historical files working
right, and is at least reasonably sensible.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-07-21 16:34:33 -07:00
Linus Torvalds
ea31800f61 git save format: don't save redundant sample information
When we load sample data from a git save-file, we always default to
using the state from the previous sample (except for the special case of
cylinder pressure where an empty value does not mean "same", but
"interpolate", see core/load-git.c: new_sample()).

But the corollary to that is that it's always redundant to save sample
data that hasn't changed since the previous sample.

For some reason, the rbt, bearing and heartrate sample data didn't
follow that rule, and instead saved with lots of extra reduncancy.

(The alternative would be to clear those samples at load time, and make
them act like the pressure data, but it would appear that all these
three values may as well just have the normal "if no change, don't save
them" semantics).

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-07-21 16:33:45 -07:00
Linus Torvalds
1e38d9239a Start cleaning up sensor indexing for multiple sensors
This is a very timid start at making us actually use multiple sensors
without the magical special case for just CCR oxygen tracking.

It mainly does:

 - turn the "sample->sensor" index into an array of two indexes, to
   match the pressures themselves.

 - get rid of dive->{oxygen_cylinder_index,diluent_cylinder_index},
   since a CCR dive should now simply set the sample->sensor[] indices
   correctly instead.

 - in a couple of places, start actually looping over the sensors rather
   than special-case the O2 case (although often the small "loops" are
   just unrolled, since it's just two cases.

but in many cases we still end up only covering the zero sensor case,
because the CCR O2 sensor code coverage was fairly limited.

It's entirely possible (even likely) that this migth break some existing
case: it tries to be a fairly direct ("stupid") translation of the old
code, but unlike the preparatory patch this does actually does change
some semantics.

For example, right now the git loader code assumes that if the git save
data contains a o2pressure entry, it just hardcodes the O2 sensor index
to 1.

In fact, one issue is going to simply be that our file formats do not
have that multiple sensor format, but instead had very clearly encoded
things as being the CCR O2 pressure sensor.

But this is hopefully close to usable, and I will need feedback (and
maybe test cases) from people who have existing CCR dives with pressure
data.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-07-21 16:33:19 -07:00