freedive mode

170 views
Skip to first unread message

Peter Tot

unread,
Dec 31, 2014, 5:12:44 PM12/31/14
to subsurfac...@googlegroups.com

 for years i was switching to windows to use suunto dm. the only reason the freedive mode was for my suunto d4. lately i decided to edit every freedive log manually. it would be great if subsurface could do the job instead me. is there any plan to pick this challenge?

 i'm using subsurface 4.3 on fedora 21.

 thnx.

  peter

Dirk Hohndel

unread,
Dec 31, 2014, 5:18:55 PM12/31/14
to subsurfac...@googlegroups.com
On Wed, Dec 31, 2014 at 02:12:44PM -0800, Peter Tot wrote:
>
> for years i was switching to windows to use suunto dm. the only reason the
> freedive mode was for my suunto d4. lately i decided to edit every freedive
> log manually. it would be great if subsurface could do the job instead me.
> is there any plan to pick this challenge?

Well, can you tell us a bit more what is missing from being able to do
that today? What can you do in Suunto DM that you can't do in Subsurface?

/D

Peter Tot

unread,
Dec 31, 2014, 6:01:00 PM12/31/14
to subsurfac...@googlegroups.com
 but of course. i'm a scuba and freedive instructor. so i have a lot of dives on a daily base. suunto dm can group my dives by scuba and freedive. which is great when i start my day with free-dives, and keep on with scuba.
 
 sometimes i'm in the water for short scuba dives, and after a couple of days pretty hard to remember when i switched to bubble-maker mode.

 peter

Dirk H

unread,
Dec 31, 2014, 6:08:55 PM12/31/14
to subsurfac...@googlegroups.com

So the interesting question is, how does DM4 know. In guessing your switching modes on the dive computer and DM4 recognizes that?
And then how are these dives separated in the UI?

/D

--
You received this message because you are subscribed to the Google Groups "Subsurface Divelog" group.
To unsubscribe from this group and stop receiving emails from it, send an email to subsurface-dive...@googlegroups.com.
To post to this group, send email to subsurfac...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/subsurface-divelog/543f0a90-686c-4d66-a6d5-e960dd61fb82%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Peter Tot

unread,
Dec 31, 2014, 6:37:35 PM12/31/14
to subsurfac...@googlegroups.com
 
 yup. there is a switch on the d4. air/nitrox/free.
the ui separates by modes. free and scuba. nitrox, as i remember, as well.

 also the dives numbered separately by modes.

 peter


Linus Torvalds

unread,
Dec 31, 2014, 6:44:18 PM12/31/14
to subsurfac...@googlegroups.com
On Wed, Dec 31, 2014 at 3:37 PM, Peter Tot <apneista...@gmail.com> wrote:
>
> yup. there is a switch on the d4. air/nitrox/free.
> the ui separates by modes. free and scuba. nitrox, as i remember, as well.

Hmm. I don't think libdivecomputer actually gives us the mode. Jef?

Linus

Jef Driesen

unread,
Jan 1, 2015, 4:53:33 AM1/1/15
to subsurfac...@googlegroups.com
It does. Look for DC_FIELD_DIVEMODE. It will return freedive, gauge, oc or cc.
It's even integrated in subsurface, but both freedive and gauge gets mapped to
omen circuit there.

Jef

Dirk Hohndel

unread,
Jan 1, 2015, 12:46:35 PM1/1/15
to subsurfac...@googlegroups.com
OK, so we have the data, we just don't use it in a reasonable way.

And of course we have discarded this data in the past, so we only "have"
it for newly downloaded dives after we changed things around.

Hmm.

I'll need to come up with a good design for this...

/D

Dirk H

unread,
Jan 1, 2015, 1:10:16 PM1/1/15
to subsurfac...@googlegroups.com
Peter,

would it work for you if Subsurface automatically tagged freedives as such? This way you could use the filter function to look at just your freedives...

/D

--
You received this message because you are subscribed to the Google Groups "Subsurface Divelog" group.
To unsubscribe from this group and stop receiving emails from it, send an email to subsurface-dive...@googlegroups.com.
To post to this group, send email to subsurfac...@googlegroups.com.

Peter Tot

unread,
Jan 1, 2015, 1:52:17 PM1/1/15
to subsurfac...@googlegroups.com
  yes. it would be great.
   (the option to remove cylinders in the equipment could be a bonus also)

 thnx

  peter

Robert Helling

unread,
Jan 1, 2015, 3:45:48 PM1/1/15
to subsurfac...@googlegroups.com
Hi,

On 01 Jan 2015, at 18:46, Dirk Hohndel <di...@hohndel.org> wrote:

I'll need to come up with a good design for this...

my proposal would be to have free dive as a fourth member of enum dive_computer_type (besides OC, CCR and PSCR, and yes, that is a terrible variable name and is in urgent need to be refactored, I will do this a bit later) and to make that enum transparent to the user via a combo box.

Just as a prototype, here is what I am doing on my PSCR branch (based on b9d146bab37db1fe9f95828ff314fdd89bf818a8), where I have already provided for this member.

These patches are not ready to be merged (they need some more debugging and  cleaning up) but just as an idea how to implement it to the UI.

Let me know what you think.

Best
Robert
0001-Rebreather-type-selector-UI.patch
0002-Prepare-for-PSCR-calculations.patch
0003-Maintab-combobox-to-set-dive-type.patch

Giorgio Marzano

unread,
Sep 30, 2015, 5:13:27 AM9/30/15
to Subsurface Divelog

Hi, 


In the last weeks I bothered Jef Driesen to have my dive computer (a "Mares Smart Apnea") supported by libdivecomputer. Now it is working fine, and I am here resuming this long gone thread because I would like to suggest some further improvement to the freedive mode: 

Typical freediving sessions are actually a sequence of dives interlaced with surface intervals but, as of now ,subsurfacs  handles them as a unique depth profile obtained (by libdivecomputer) chaining each dive. To fit actual freedivers needs it should:

1) Do not take into account surface times when computing avg depth and similar stats
2) Compute and display overall stats, as max depth, avg depth, max dive time, avg dive time, ...
3) Display single dive profiles and stats with the chart of descent and ascent, and relative speeds, max and minimum temperature for each dive, max depth, dive duration and surface time, date and hour of the dive and  so on 
3b) (Or at least) allow the user to modify the sampling interval of the plot profile and improve navigation at deep zoom

Since a picture is worth a thousand words, this is an example of the "Mares  DiveOrganizer" SW, provided with the dive computer (sorry, the picture text is in italian). You can see on the top left the chart of the dive, on the top right the list of the dives in the session, and in the bottom part of the screen some session wide stats.


Since freediving (and spearfishing) is getting popular I think that a better support in subsurface could be an interesting thing.

Thanks and sorry for my macaronic english :)

Giorgio

Jef Driesen

unread,
Oct 1, 2015, 5:32:22 AM10/1/15
to subsurfac...@googlegroups.com, Giorgio Marzano
> <https://www.deeperblue.com/wp-content/uploads/2015/09/DiveOrganizerScreenshot.jpg>
>
> Since freediving (and spearfishing) is getting popular I think that a
> better support in subsurface could be an interesting thing.

A bit more background info on how Mares dive computers do record
freedives, might be useful to know here. In freedive mode they record
the entire freedive session as one single dive. Just like a regular
dive, each freedive session has a header containing some general
information about the entire session, like total divetime, maximum
depth, etc. The main difference is in the samples. Each sample is no
longer a regular sample, but a complete "subdive" with its own header
(containing general info for that subdive only) along with the regular
samples.

So the dataformat of a freedive session is more like a container with
one or more individual freedive profiles. Since libdivecomputer has no
such concept, it will generate a single profile for the entire sessions.
The result is a profile containing lots of surface time, alternating
with (short) freedives. The interesting parts of the profile (e.g. the
individual freedives) are not made visual very well (e.g. just tiny
spikes).

Jef

Dirk Hohndel

unread,
Oct 1, 2015, 6:34:18 AM10/1/15
to subsurfac...@googlegroups.com, Giorgio Marzano
So a quick way to get what is needed would be to do the opposit of dive
merging... take a dive as delivered to us from libdivecomputer and
splitting it up at the "edges" of each surface interval.

Jef, are these marked in some ways as being freedives (I haven't looked at
the libdivecomputer patches, yet - I'm on a dive trip right now with very
limited time)? Can you share some data files that I could use with the
simulator to see what Subsurface really gets here?

/D

Giorgio Marzano

unread,
Oct 1, 2015, 7:27:10 AM10/1/15
to Subsurface Divelog, marzano...@gmail.com
Thanks to you all for your answers.

As of now libdivecomputer doesn't mark surface intervals. 

I am wondering since some time if it would fit better to implement "tagging" of surface intervals in libdivecomputer; it would be easy to implement on the Mares Smart Apnea frontend, i.e. generating some new fake "event" (a la "gaschange") at the end of each dive. But it may (not sure here) not be straightforward in other dive computers. 

A more general but less clean way to approach the problem may be to detect surface intervals (depth < 0.5m and duration > 2s and mode == freedive) directly at application level. Most of the dive detail could be recalculated (depths and times), but not all (temperature maybe)

I attach here an XML file generated by the "universal" utility from my dive computer (TBH not from the actual released patch, but from something very very close). What other kind of data could I provide?

Giorgio
out.dive.fullprofile.xml

Linus Torvalds

unread,
Oct 1, 2015, 7:37:08 AM10/1/15
to subsurfac...@googlegroups.com, marzano...@gmail.com


On Oct 1, 2015 7:27 AM, "Giorgio Marzano" <marzano...@gmail.com> wrote:
>
> A more general but less clean way to approach
> the problem may be to detect surface intervals
> (depth < 0.5m and duration > 2s and mode ==
> freedive) directly at application level. Most of
> the dive detail could be recalculated (depths
> and times), but not all (temperature maybe)

Well, I wouldn't suggest doing that automatically, but I guess we could add the inverse of "merge selected dives" in the divelist menu in Subsurface.

So we could have a "split selected dives" option, and just break them up at the surface samples.

It *might* even be a sensible operation for scuba, on case somebody is *really* good at changing a tank. Some dive computers have a fairly long timeout for the dive to end (ie you really want to see something as two dives with a five minute surface interval, rather than as one dive with five minutes bobbing around on the surface).

        Linus

Giorgio Marzano

unread,
Oct 1, 2015, 8:09:14 AM10/1/15
to Subsurface Divelog, marzano...@gmail.com
Hi, 

I would suggest to do as follows:

- libdivecomputer shall report "surface interval" events inside the dive profile data when a dive computer explicitly handles separate subdive; such . "surface intervals" events will (may?) have additional information, i.e. depths, speeds and temperatures, provided by the dive computer.

- subsurface shall break dives by default when libdivecomputer returns a "surface interval" event

- subsurface shall break freediving dives by default when a surface interval is detected (i.e. depth < 0.5, duration > 3s)

- subsurface shall implement a "split selected dives" option for both freediving and scuba modes (and maybe also a "join selected dives" one?)

This way libdivecomputer will keep reporting only data which is actually generated by the DC, and subsurface will handle other cases.

Giorgio

Dirk Hohndel

unread,
Oct 1, 2015, 12:41:38 PM10/1/15
to subsurfac...@googlegroups.com, marzano...@gmail.com

In an open source project sentences with "shall" always rub me the wrong way.
But hey, I'm always open to patches and I'm sure so is Jef when it comes to adding those events that you believe "shall" be there.
As for your instructions as to how Subsurface "shall" behave, see below.

> On Oct 1, 2015, at 8:09 AM, Giorgio Marzano <marzano...@gmail.com> wrote:
>
> - libdivecomputer shall report "surface interval" events inside the dive profile data when a dive computer explicitly handles separate subdive; such . "surface intervals" events will (may?) have additional information, i.e. depths, speeds and temperatures, provided by the dive computer.

I'll let Jef comment on that.

> - subsurface shall break dives by default when libdivecomputer returns a "surface interval" event

I don't think so. That's the user's decision.

> - subsurface shall break freediving dives by default when a surface interval is detected (i.e. depth < 0.5, duration > 3s)

Certainly not for the next release - and I'm not sure what the right logic here might be. I think I'd much rather make this a manual process.

> - subsurface shall implement a "split selected dives" option for both freediving and scuba modes (and maybe also a "join selected dives" one?)

We are considering adding the spilt function for the upcoming release (assuming Linus finds the time). We already have the "merge selected dives" option.

Please don't get me wrong. I appreciate feedback and suggestions. But this is free software, written by people in their spare time... and it's primarily targeting scuba and to a lesser extend rebreather divers. If it is useful for free divers and we can make small adjustments here or there, sure. But let's make sure we keep expectations and reality in sync.

/D

Giorgio Marzano

unread,
Oct 1, 2015, 2:19:17 PM10/1/15
to Subsurface Divelog
I am sorry, really. didn't meant to be unpolite.

English is not my language as you could have guessed. :)

"Shall" is the common way I have been instructed to use to phrase and mark requirements describing the desired behaviour of a system. I had some work rejected because of some 'should' or 'will'.

I was just making a proposal for the requirements that should guide the implementation of the feature I am asking. This is why I wrote "I would suggest".

It was not my intention to bully anyone (especially when answering to Linus :) ). I have a deep respect of your work and for the time you spent on this project.

Please accept my apologies

Giorgio

Giorgio Marzano

unread,
Oct 1, 2015, 3:44:04 PM10/1/15
to Subsurface Divelog, marzano...@gmail.com

Il giorno giovedì 1 ottobre 2015 18:41:38 UTC+2, Dirk ha scritto:

In an open source project sentences with "shall" always rub me the wrong way.

Sorry again. See my other post. If we were on reddit I could write a "TIFU trying to appear smart and professional". Or, even worst "TIFU by bullying Linus Torvalds' :O
 
But hey, I'm always open to patches and I'm sure so is Jef when it comes to adding those events that you believe "shall" be there.


 I know. In the last weeks I already supplied him some idea and some code  to implement the front end and the parser of my dc. I also started discussing with him my idea by email, but I wanted to check how subsurface was impacted by the change and if you were interested in supporting a better freedive mode. This is why I came here.


 
> - subsurface shall break dives by default when libdivecomputer returns a "surface interval" event

I don't think so. That's the user's decision.

> - subsurface shall break freediving dives by default when a surface interval is detected (i.e. depth < 0.5, duration > 3s)

Certainly not for the next release - and I'm not sure what the right logic here might be. I think I'd much rather make this a manual process.



Not making any pressure here about the schedule. About whether it should be automatic or manual consider that a freedive session could  easily count 30 or 40 dives to split. This is why I would enable it by default in freedive mode. Of course the user could be able to disable it in the settings.



 

We are considering adding the spilt function for the upcoming release (assuming Linus finds the time). We already have the "merge selected dives" option.


These are both great news (for me) 

 
Please don't get me wrong. I appreciate feedback and suggestions. But this is free software, written by people in their spare time... and it's primarily targeting scuba and to a lesser extend rebreather divers. If it is useful for free divers and we can make small adjustments here or there, sure. But let's make sure we keep expectations and reality in sync.

/D

I will never apologise enough. I am not new to open source, some time ago (15 years!!! OMG!) I worked on pnm2ppa, a ghostscript filter for an hp printer family. Not that impressive, I know, but I mention that to assure you that I really treasure open source and I try to contribute as I can. I am not into qt and, in general, gui programming but I checked out subsurface and would like to have a look at it.


I think that the changes we are discussing may really improve the experience for freedivers using subsurface. I know there are only a few, but it's a discipline which is gaining momentum, and there is still not a good divelog SW, free or commercial. Subsurface is available in multiple platforms, is free, has a mobile assistant. It could easily become "The freedivelog". 



G 


Tomaz Canabrava

unread,
Oct 1, 2015, 3:52:13 PM10/1/15
to Subsurface Divelog, marzano...@gmail.com
Hey...

I will never apologise enough. I am not new to open source, some time ago (15 years!!! OMG!) I worked on pnm2ppa, a ghostscript filter for an hp printer family. Not that impressive, I know, but I mention that to assure you that I really treasure open source and I try to contribute as I can. I am not into qt and, in general, gui programming but I checked out subsurface and would like to have a look at it.


 You know who else wasn't into Qt? Dirk, Linus and the whole Subsurface team. :)
I was the guinea pig that ported almost 100% of the interface from C/GTK to C++/Qt in the first Subsurface in Qt version ( others started to really help in that regard later ), and nowdays you will see some code from linus, tons of code from lubomir, miika, gehard, dirk...
Qt is easy and if you wanna help I can spare a bit of time to get you started and answer all your questions.


I think that the changes we are discussing may really improve the experience for freedivers using subsurface. I know there are only a few, but it's a discipline which is gaining momentum, and there is still not a good divelog SW, free or commercial. Subsurface is available in multiple platforms, is free, has a mobile assistant. It could easily become "The freedivelog". 



G 


--
You received this message because you are subscribed to the Google Groups "Subsurface Divelog" group.
To unsubscribe from this group and stop receiving emails from it, send an email to subsurface-dive...@googlegroups.com.
To post to this group, send email to subsurfac...@googlegroups.com.

Dirk Hohndel

unread,
Oct 1, 2015, 4:24:53 PM10/1/15
to subsurfac...@googlegroups.com
No apologies necessary. As I said - it's just something I react to.
My feedback on the ideas was independent of my bickering about the way
things were phrased. I would really prefer this to be driven by the user
because it isn't clear to me at all what the right thresholds are.

The exception may be if libdivecomputer TELLS me that this is a freedive.
Then we may set different defaults or something along those lines. But
that won't happen in time for 4.5

/D

Dirk Hohndel

unread,
Oct 1, 2015, 4:39:42 PM10/1/15
to subsurfac...@googlegroups.com, marzano...@gmail.com
On Thu, Oct 01, 2015 at 12:44:04PM -0700, Giorgio Marzano wrote:
>
> Sorry again. See my other post. If we were on reddit I could write a "TIFU
> trying to appear smart and professional". Or, even worst "TIFU by bullying
> Linus Torvalds' :O

Bullying Linus is a fun thing to try. Right now we're both scuba diving
and spending a bit of time on "collecting data" and "testing" Subsurface...
So if we are lucky he'll write that code today.

> > But hey, I'm always open to patches and I'm sure so is Jef when it comes
> > to adding those events that you believe "shall" be there.
>
> I know. In the last weeks I already supplied him some idea and some code
> to implement the front end and the parser of my dc. I also started
> discussing with him my idea by email, but I wanted to check how subsurface
> was impacted by the change and if you were interested in supporting a
> better freedive mode. This is why I came here.

We are - within certain limits.

And an additional factor is that we are maybe a week from our next
release, so there won't be any bigger changes anymore, mostly bug fixes.
The "split dive" suggestion is so useful and so obvious that I'm willing
to take it at this extremely late state. It's useful for freedivers but
also useful for divers - I actually had a situation just this week where
one of my dive computers stayed in dive mode during an extremely short
surface intervall while the others started a new dive. Being able to split
that dive will be nice.

> > > - subsurface shall break dives by default when libdivecomputer returns a
> > "surface interval" event
> >
> > I don't think so. That's the user's decision.
> >
> > > - subsurface shall break freediving dives by default when a surface
> > interval is detected (i.e. depth < 0.5, duration > 3s)
> >
> > Certainly not for the next release - and I'm not sure what the right logic
> > here might be. I think I'd much rather make this a manual process.
>
> Not making any pressure here about the schedule. About whether it should be
> automatic or manual consider that a freedive session could easily count 30
> or 40 dives to split. This is why I would enable it by default in freedive
> mode. Of course the user could be able to disable it in the settings.

As I said in my other email - if the dive computer explicitly reports this
as freedive, then yes, this is something we could consider.

As for the manual process - my assumption is that you select "split dive
at surface intervals" (or whatever the menu text is) and then it splits it
in as many dives as there are segments. It wouldn't be 30 or 40
operations...

> > Please don't get me wrong. I appreciate feedback and suggestions. But this
> > is free software, written by people in their spare time... and it's
> > primarily targeting scuba and to a lesser extend rebreather divers. If it
> > is useful for free divers and we can make small adjustments here or there,
> > sure. But let's make sure we keep expectations and reality in sync.
>
> I will never apologise enough. I am not new to open source, some time ago
> (15 years!!! OMG!) I worked on pnm2ppa, a ghostscript filter for an hp
> printer family.

Ha! I used that! :-)

> Not that impressive, I know, but I mention that to assure
> you that I really treasure open source and I try to contribute as I can. I
> am not into qt and, in general, gui programming but I checked out
> subsurface and would like to have a look at it.

Qt is actually fairly easy to learn. And BY FAR the best way to make sure
that Subsurface suits your needs is to become part of the developer team
and contribute. Even if you just have clear ideas and can describe the UI
well you might find someone willing to implement things - especially if
you handle the necessary backend changes.

Linus will do tiny things in Qt (like adding a new context menu entry and
things of that nature) and punt on the bigger stuff and then usually Tomaz
steps in and saves the day :-)

> I think that the changes we are discussing may really improve the
> experience for freedivers using subsurface. I know there are only a few,
> but it's a discipline which is gaining momentum, and there is still not a
> good divelog SW, free or commercial. Subsurface is available in multiple
> platforms, is free, has a mobile assistant. It could easily become "The
> freedivelog".

:-)

/D

Dirk Hohndel

unread,
Oct 1, 2015, 4:41:09 PM10/1/15
to subsurfac...@googlegroups.com, marzano...@gmail.com
On Thu, Oct 01, 2015 at 04:52:12PM -0300, Tomaz Canabrava wrote:
> Hey...
>
> I will never apologise enough. I am not new to open source, some time ago
> > (15 years!!! OMG!) I worked on pnm2ppa, a ghostscript filter for an hp
> > printer family. Not that impressive, I know, but I mention that to assure
> > you that I really treasure open source and I try to contribute as I can. I
> > am not into qt and, in general, gui programming but I checked out
> > subsurface and would like to have a look at it.
> >
>
> You know who else wasn't into Qt? Dirk, Linus and the whole Subsurface
> team. :)
> I was the guinea pig that ported almost 100% of the interface from C/GTK to
> C++/Qt in the first Subsurface in Qt version ( others started to really
> help in that regard later ), and nowdays you will see some code from linus,
> tons of code from lubomir, miika, gehard, dirk...
> Qt is easy and if you wanna help I can spare a bit of time to get you
> started and answer all your questions.

I highly recommend taking Tomaz up on this offer. He's really good with Qt
and good at getting people started. I have learned most of what I know
about Qt programming from him.

/D

Giorgio Marzano

unread,
Oct 2, 2015, 5:54:27 AM10/2/15
to Subsurface Divelog, marzano...@gmail.com
 @ Tomaz: I will for sure ask for your help, thanks

@ Dirk:  "split dive at surface intervals" will be a great short term solution. Since you wrote  Certainly not for the next release - and I'm not sure what the right logic here might be. I think I'd much rather make this a manual process. I tought it was not feasable.

G

Dirk Hohndel

unread,
Oct 2, 2015, 6:14:11 AM10/2/15
to subsurfac...@googlegroups.com, marzano...@gmail.com
On Fri, Oct 02, 2015 at 02:54:27AM -0700, Giorgio Marzano wrote:
>
> @ Dirk: "split dive at surface intervals" will be a great short term
> solution.

It's in the latest daily build (but I haven't updated libdivecomputer,
yet, to include the latest updates - that's high on my todo list for
today).

> Since you wrote Certainly not for the next release - and I'm not
> sure what the right logic here might be. I think I'd much rather make this
> a manual process. I tought it was not feasable.

Sorry, you lost me here. Can you try to phrase this differently?
The next release (4.5) should be out within a week or two. It will have
the option to automatically and completely split a dive with surface
intervals. So every time you spend at least one minute at the service it
will start a new dive - which means the single dive you download from your
dive computer that has 30 or 40 actual dives in it will turn into 30 or 40
actual dives. You will need to select that option from the context menu of
the dive list.

Does that make sense? Does that answer your question?

/D

Giorgio Marzano

unread,
Oct 2, 2015, 8:54:19 AM10/2/15
to Subsurface Divelog, marzano...@gmail.com


> Since you wrote  Certainly not for the next release - and I'm not
> sure what the right logic here might be. I think I'd much rather make this
> a manual process. I tought it was not feasable.

Sorry, you lost me here. Can you try to phrase this differently?
The next release (4.5) should be out within a week or two. It will have
the option to automatically and completely split a dive with surface
intervals. So every time you spend at least one minute at the service it
will start a new dive - which means the single dive you download from your
dive computer that has 30 or 40 actual dives in it will turn into 30 or 40
actual dives. You will need to select that option from the context menu of
the dive list.

Does that make sense? Does that answer your question?


Yes it is fine. Maybe you could make the "minute at the service" a configurable parameter?

I previously understood that your statement 

>> Certainly not for the next release - and I'm not sure what the right 
>> logic here might be. I think I'd much rather make this a manual process.

meant that you couldn't find a way to do it automagically. 

G


Giorgio Marzano

unread,
Oct 3, 2015, 3:20:36 AM10/3/15
to Subsurface Divelog, marzano...@gmail.com
Hi, 

I managed to build from git with my version of libdivecomputer and tried the split dive function. It is great!

Then i noticed the "trip" capability and I believe that it could be an easy way to mimic freediving "session" concept. 

Sadly, if I create a trip and then try to split a dive inside it I get a corde dump

subsurface: /home/gmarzano/src/subsurface/divelist.c:665: remove_dive_from_trip: Assertion `trip->nrdives > 0' failed.
Aborted (core dumped)

So you have to split a dive and then add each single dive in the new trip 

Moreover, trying to look at the core dump I noticed that the dive_cb function handles a parameter called "devdata->create_new_trip"

if (devdata->create_new_trip) {
if (!devdata->trip)
devdata->trip = create_and_hookup_trip_from_dive(dive);
else
add_dive_to_trip(dive, devdata->trip);
}


but i couldn't find it anywhere else in the code. 

It could be another (and IMO better) way to handle freedive sessions. Libdivecomputer could  return a list of single dives instead of merging them and they will be automagically added in a single trip. Which part of the SW is in charge to set the "create_new_trip" member of the devdata structure?

Dirk Hohndel

unread,
Oct 3, 2015, 7:14:22 AM10/3/15
to subsurfac...@googlegroups.com, marzano...@gmail.com
On Sat, Oct 03, 2015 at 12:20:35AM -0700, Giorgio Marzano wrote:
>
> I managed to build from git with my version of libdivecomputer and tried
> the split dive function. It is great!

I'm glad it works for you.

> Then i noticed the "trip" capability and I believe that it could be an easy
> way to mimic freediving "session" concept.
>
> Sadly, if I create a trip and then try to split a dive inside it I get a
> corde dump
>
> subsurface: /home/gmarzano/src/subsurface/divelist.c:665:
> remove_dive_from_trip: Assertion `trip->nrdives > 0' failed.
> Aborted (core dumped)

Oops. Apparently neither Linus nor I tested that.
I just reproduced it and am now testing a fix.

> So you have to split a dive and then add each single dive in the new trip
>
> Moreover, trying to look at the core dump I noticed that the dive_cb
> function handles a parameter called "devdata->create_new_trip"
>
> if (devdata->create_new_trip) {
> if (!devdata->trip)
> devdata->trip = create_and_hookup_trip_from_dive(dive);
> else
> add_dive_to_trip(dive, devdata->trip);
> }
>
> but i couldn't find it anywhere else in the code.

This is called if in the Download from divecomputer dialog you ask
Subsurface to put the downloaded dives in a separate trip - but that's not
one trip per dive, it's all the dives that you download into their own
trip.

> It could be another (and IMO better) way to handle freedive sessions.
> Libdivecomputer could return a list of single dives instead of merging
> them and they will be automagically added in a single trip. Which part of
> the SW is in charge to set the "create_new_trip" member of the devdata
> structure?

Again, libdivecomputer questions are best answered by Jef. I don't know
how he wants to handle this in the end.

/D

Giorgio Marzano

unread,
Oct 4, 2015, 5:54:51 AM10/4/15
to Subsurface Divelog, marzano...@gmail.com
Hi, again

checked out latest git 

It seems that now split is only working with dives (even inside a trip, btw) with only one surface interval, thus only 2 "sub-dives"

If there is more it throws a segfault


Program received signal SIGSEGV, Segmentation fault.
0x00000000005cd23d in DiveListView::splitDives (this=0x160a180) at /home/gmarzano/src/subsurface/qt-ui/divelistview.cpp:625
625                     if (dive->selected)
(gdb) list
620     {
621             int i;
622             struct dive *dive;
623
624             for_each_dive (i, dive) {
625                     if (dive->selected)
626                             split_dive(dive);
627             }
628             MainWindow::instance()->refreshProfile();
629             MainWindow::instance()->refreshDisplay();
(gdb) print i
$3 = 12
(gdb) print dive
$4 = (dive *) 0x73006e00000000
(gdb) print *dive
Cannot access memory at address 0x73006e00000000
(gdb) 



I attach an xml file so you can try yourself. The second dive (Aug 27 2015) only has 2 subdives. Any other dive has many subdives.

G
out.dive.fullprofile.xml

Dirk Hohndel

unread,
Oct 4, 2015, 7:22:05 AM10/4/15
to subsurfac...@googlegroups.com, Subsurface Mailing List, marzano...@gmail.com
Hi Giorgio,

thanks for the excellent bug report including a sample file.

I found and fixed the bug and also added another feature that you asked
for: when the dive computer reports your dive as "freedive" we now split
the dives with only 10 seconds at the surface (otherwise the threshold
stays 60 seconds). For the example file you provided we now get 69(!)
dives when splitting the first dive.

I pushed the changes to master. My plan is to cut Beta 3 later today which
will also contain this change.

BTW: have you considered joining our developer mailing list? We have gone
way past "user questions for the forum" here and are into software
development which might be better discussed there...

Thanks again for helping us figure this out - it looks like this one got
in just in time for Subsurface 4.5.

Let me know if this is now sufficient for what you had in mind (and what
can reasonably be added to 4.5). Post 4.5 I'd be willing to consider a
preferences setting that says "in freedive mode, automatically split dives
when importing from the dive computer". Given the UI change this would
require I really want to defer this... if there are enough people
interested we COULD do this for 4.5.1 - but more likely this is 4.6
material

/D
> --
> You received this message because you are subscribed to the Google Groups "Subsurface Divelog" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to subsurface-dive...@googlegroups.com.
> To post to this group, send email to subsurfac...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/subsurface-divelog/46ddc49f-657b-433a-aa41-ca5a9fe89586%40googlegroups.com.

Giorgio Marzano

unread,
Oct 4, 2015, 8:00:02 AM10/4/15
to Subsurface Divelog, marzano...@gmail.com
Hi, all

could someone please explain me the workflow to propose, discuss and implement a change?

Let's say I have a change to propose: to improve readability I would like the trips with duration < 1 day to be displayed in the form "Month Day Year (dives)" instead of  "Month Year (dives)" 

Since this is simple, I also developed a signed off patch to do that (according to http://subsurface-divelog.org/documentation/contributing/ ). 

What should I do in order to get the proposal discussed and the patch reviewed and (eventually) merged? Should we discuss the proposal here before I submit the patch? Should I send the patch here? Should I do a "pull request"? How?

Thanks in advance

G


0001-make-trips-shorter-than-1-day-displayed-as-Month-Day.patch

Miika Turkia

unread,
Oct 4, 2015, 8:06:30 AM10/4/15
to subsurfac...@googlegroups.com, marzano...@gmail.com
Have you taken a look at
http://subsurface-divelog.org/documentation/contributing/

In short, we generally discuss everything on the developer
mailinglist. You can e.g. send mail with subject:

[RFC] whatever you like

But then a gain most of our discussion is with generic subject. But
e.g. patch that really needs discussion is better to be sent with
[RFC] on the subject.

You can also directly send a patch, and if you need to explain more
than a normal commit message would require, you can add a cover letter
or add a line with three dashes (---) after that you can comment
freely so that it is not included in git if the patch is accepted as
is.
> --
> You received this message because you are subscribed to the Google Groups
> "Subsurface Divelog" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to subsurface-dive...@googlegroups.com.
> To post to this group, send email to subsurfac...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/subsurface-divelog/feddc99e-758c-46ad-8497-2be061921a7c%40googlegroups.com.

Giorgio Marzano

unread,
Oct 4, 2015, 8:14:53 AM10/4/15
to subsurfac...@googlegroups.com, subsu...@subsurface-divelog.org
Ok. Understand (kind of...). See you on the  mailing list.

Dirk, about 4.5 I am fine. Split dive and collect them in a trip fit my actual needs. 

In the near future I would like to tweak how some data is represented. E.g. in freedive mode seconds are relevant, while I understand that for scuba minutes are more than enough. 

Another example is the "day in the trip header" topic I presented before. 

I will also keep bothering Jef with some patch to the smart-apnea parser.


Reply all
Reply to author
Forward
0 new messages