Re: Split a dive by time

2018-07-02 Thread Robert Helling
Dirk,

> On 2. Jul 2018, at 17:35, Dirk Hohndel  wrote:
> 
> I assume that this has a helper function split_dive_at_time(struct dive *d, 
> duration_t seconds) 

almost. I called it split_dive_at_time(struct dive *dive, int time). But you 
are right, duration_t is probably better.

And it uses split_dive_at(struct dive *dive, int a, int b).

Unfortunately, it does not yet work. But it should by some time tonight.

Best
Robert

-- 
.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oO
Robert C. Helling Elite Master Course Theoretical and Mathematical Physics
  Scientific Coordinator
  Ludwig Maximilians Universitaet Muenchen, Dept. Physik
  Phone: +49 89 2180-4523  Theresienstr. 39, rm. B339
  http://www.atdotde.de

Enhance your privacy, use cryptography! My PGP keys have fingerprints
A9D1 A01D 13A5 31FA 6515  BB44 0820 367C 36BC 0C1Dand
DCED 37B6 251C 7861 270D  5613 95C7 9D32 9A8D 9B8F





___
subsurface mailing list
subsurface@subsurface-divelog.org
http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface


Re: Split a dive by time

2018-07-02 Thread Dirk Hohndel

> On Jul 2, 2018, at 6:19 AM, Robert C. Helling  
> wrote:
>> Am 02.07.2018 um 13:55 schrieb Berthold Stoeger :
>> 
>> On the one hand, these are "low-hanging fruit".
> 
> I have a „context menu split dive here“ almost ready. 

Nice. I assume that this has a helper function split_dive_at_time(struct dive 
*d, duration_t seconds) 
(I haven't thought through this API through - but I'm thinking this might 
work... the function just allocates
an extra dive and inserts it after the given dive in the dive_table) which 
could then be used from the QML UI :-)

/D
___
subsurface mailing list
subsurface@subsurface-divelog.org
http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface


Re: Split a dive by time

2018-07-02 Thread Robert C. Helling
Hi,

> Am 02.07.2018 um 13:55 schrieb Berthold Stoeger :
> 
> On the one hand, these are "low-hanging fruit".

I have a „context menu split dive here“ almost ready. 

Best 
Robert
___
subsurface mailing list
subsurface@subsurface-divelog.org
http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface


Re: Split a dive by time

2018-07-02 Thread tormento
Thanks, it made its purpose.

I can understand it's not a widely used feature. Anyway sometimes, when
training people, strange and unusual dives occur.

I keep on thinking that a "split by time" would be more than welcome :)

Alberto

Il giorno lun 2 lug 2018 alle ore 13:55 Berthold Stoeger <
bstoe...@mail.tuwien.ac.at> ha scritto:


> On Monday, 2 July 2018 09:36:34 CEST tormento wrote:
> Windows build is available from here:
> https://transfer.sh/sShKE/subsurface-4.8.0-4-gc57709236b91.exe
>
> Please let us know if you would still see value in a more configurable
> splitting. On the one hand, these are "low-hanging fruit". On the other
> hand,
> if it is of no value, there is no point in cluttering the UI. After all,
> the
> fact that nobody noticed the bug in 3 years indicates that it is not a
> widely
> used feature.
>
___
subsurface mailing list
subsurface@subsurface-divelog.org
http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface


Re: Split a dive by time

2018-07-02 Thread Berthold Stoeger
On Monday, 2 July 2018 09:36:34 CEST tormento wrote:
> Linus thanks for your interest in my minor problem.
> 
> Which build is the one with your fix? The one I have tried from nightly
> splits the dive in three parts, the last two of negligible lenght, while
> the first one is much longer than the 29:30 I need.

It's in PR#1451: https://github.com/Subsurface-divelog/subsurface/pull/1451

Windows build is available from here:
https://transfer.sh/sShKE/subsurface-4.8.0-4-gc57709236b91.exe

Please let us know if you would still see value in a more configurable 
splitting. On the one hand, these are "low-hanging fruit". On the other hand, 
if it is of no value, there is no point in cluttering the UI. After all, the 
fact that nobody noticed the bug in 3 years indicates that it is not a widely 
used feature.

Berthold


___
subsurface mailing list
subsurface@subsurface-divelog.org
http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface


Re: Split a dive by time

2018-07-01 Thread Dirk Hohndel

> On Jul 1, 2018, at 2:43 PM, Linus Torvalds  
> wrote:
> 
> Ok, fixed that too, and now I can take Alberto's dive, and do "split
> selected dive" on it to get the four non-surface parts, and then
> stitch the three quick dips that were part of the rescue dive back
> into one dive, ending up with two dives.
> 
> If somebody wants to have a manual "split at this point" UI, that's
> fine too, but these fixes for the automatic case do actually fix real
> issues and make it possible to do this all using the existing UI.

I find it really hard to believe that people would want to split dives in
spots that aren't "basically surface"... but hey, I've been wrong before.
:-)

> Pull request done on github.

Thank you kindly.

/D
___
subsurface mailing list
subsurface@subsurface-divelog.org
http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface


Re: Split a dive by time

2018-07-01 Thread Linus Torvalds
On Sun, Jul 1, 2018 at 1:57 PM Linus Torvalds
 wrote:
>
> Fixing that, I get the right splits, and let me just fix the merging too.

Ok, fixed that too, and now I can take Alberto's dive, and do "split
selected dive" on it to get the four non-surface parts, and then
stitch the three quick dips that were part of the rescue dive back
into one dive, ending up with two dives.

If somebody wants to have a manual "split at this point" UI, that's
fine too, but these fixes for the automatic case do actually fix real
issues and make it possible to do this all using the existing UI.

Pull request done on github.

 Linus

  Linus
___
subsurface mailing list
subsurface@subsurface-divelog.org
http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface


Re: Split a dive by time

2018-07-01 Thread Linus Torvalds
On Sun, Jul 1, 2018 at 1:35 PM Linus Torvalds
 wrote:
>
> Oh, but this *does* split automatically (go to dive list, select that
> dive, right-click to get the action menu, pick "split dive"), and the
> first 29:30 is considered a dive of its own.

Actually, we have a really stupid bug in the splitting logic that
makes it basically act randomly.

So sometimes it splits, sometimes it doesn't, and sometimes it splits
at the wrong point. We do an incorrect pointer arithmetic on the
sample pointer.

Fixing that, I get the right splits, and let me just fix the merging too.

Linus
___
subsurface mailing list
subsurface@subsurface-divelog.org
http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface


Re: Split a dive by time

2018-07-01 Thread Linus Torvalds
On Sun, Jul 1, 2018 at 1:07 PM tormento  wrote:
> I have attached the dive. It's one I did in very shallow water, half as a 
> open diver training assistant, the second during a rescue simulation. The 
> time I'd like it to be splitted is something like 29:30 from the beginning.

Oh, but this *does* split automatically (go to dive list, select that
dive, right-click to get the action menu, pick "split dive"), and the
first 29:30 is considered a dive of its own.

In fact, it splits into five dives because of how many of those
surface intervals you have during that rescue simulation.  And that
may be a mis-feature. Maybe we should always just split once, at the
"biggest" surface interval. People can just ask to split again.

And then when it does split too much, merging the four short remaining
dips doesn't work, because the stupid merge algorithm decides that
"merging" meant not "joining", but "merge two dive computers into one
single dive" because the dips looked so similar to each other. So the
"merge" actually takes two of those quick "dip" dives, and makes a
single dip out of it, rather than make one dive with two dips.

I'll try to take a look, because this *should* just work, and right
now our heuristics simply do the wrong thing.

Linus
___
subsurface mailing list
subsurface@subsurface-divelog.org
http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface


Re: Split a dive by time

2018-07-01 Thread Jan Iversen


Enviado desde mi iPad

> El 1 jul 2018, a las 22:08, tormento  escribió:
> 
> Or simply, where a cursor or a mark is placed...

For the desktop that is a good idea, but remember the mobile version does not 
have a cursor.

I am in favour for a simple “split by x minutes:second” feature. I would not 
change our automatic dive division (but depth) nor would I make a split on 
depth. This is something special that rarely happens, so having the user 
telling at which point in time it happened sounds like a generic way.

Rgds
Jan I
> 
>> Il giorno dom 1 lug 2018 alle ore 22:07 tormento  ha 
>> scritto:
>> I humbly suggest that the split dive option should be by time and by depth 
>> level, with both asked after selecting one of them and not hardcoded as  
>> SURFACE_THRESHOLD.
>> 
>> I have attached the dive. It's one I did in very shallow water, half as a 
>> open diver training assistant, the second during a rescue simulation. The 
>> time I'd like it to be splitted is something like 29:30 from the beginning.
>> 
>>> Il giorno dom 1 lug 2018 alle ore 21:50 Linus Torvalds 
>>>  ha scritto:
>>> On Sun, Jul 1, 2018 at 12:06 AM tormento  wrote:
>>> >
>>> > Sorry but not working for me. Perhaps I put computer not so shallow to 
>>> > recognize as “surface”.
>>> 
>>> As with a lot of subsurface issues, one of the main complications is
>>> having the UI integration.
>>> 
>>> A lot of these things are likely fairly simple to implement, but there
>>> are people like me who really don't do UI, but could do the "split
>>> dive" part fairly easily. And there are probably people who could do
>>> the UI trivially, but then don't feel comfy with the low-level dive
>>> profile data structures.
>>> 
>>> Things like the automatic dive splitting by surface time was "easy" to
>>> do, because it really ended up just needing another menu entry in the
>>> dive menu.
>>> 
>>> I do wonder what your dive computer reports the depth as? We consider
>>> "surface" to be 75 cm (so about 2.5 ft). It's an entirely arbitrary
>>> depth, going back to 2012 and never tweaked.
>>> 
>>> So I wonder what depth your dive computer reported for your surface
>>> time. Maybe we could just tweak that SURFACE_THRESHOLD, and make our
>>> automatic dive splitting JustWork(tm) for you too.
>>> 
>>>Linus
> ___
> subsurface mailing list
> subsurface@subsurface-divelog.org
> http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface
___
subsurface mailing list
subsurface@subsurface-divelog.org
http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface


Re: Split a dive by time

2018-07-01 Thread tormento
Or simply, where a cursor or a mark is placed...

Il giorno dom 1 lug 2018 alle ore 22:07 tormento  ha
scritto:

> I humbly suggest that the split dive option should be by time and by depth
> level, with both asked after selecting one of them and not hardcoded as
> SURFACE_THRESHOLD.
>
> I have attached the dive. It's one I did in very shallow water, half as a
> open diver training assistant, the second during a rescue simulation. The
> time I'd like it to be splitted is something like 29:30 from the beginning.
>
> Il giorno dom 1 lug 2018 alle ore 21:50 Linus Torvalds <
> torva...@linux-foundation.org> ha scritto:
>
>> On Sun, Jul 1, 2018 at 12:06 AM tormento  wrote:
>> >
>> > Sorry but not working for me. Perhaps I put computer not so shallow to
>> recognize as “surface”.
>>
>> As with a lot of subsurface issues, one of the main complications is
>> having the UI integration.
>>
>> A lot of these things are likely fairly simple to implement, but there
>> are people like me who really don't do UI, but could do the "split
>> dive" part fairly easily. And there are probably people who could do
>> the UI trivially, but then don't feel comfy with the low-level dive
>> profile data structures.
>>
>> Things like the automatic dive splitting by surface time was "easy" to
>> do, because it really ended up just needing another menu entry in the
>> dive menu.
>>
>> I do wonder what your dive computer reports the depth as? We consider
>> "surface" to be 75 cm (so about 2.5 ft). It's an entirely arbitrary
>> depth, going back to 2012 and never tweaked.
>>
>> So I wonder what depth your dive computer reported for your surface
>> time. Maybe we could just tweak that SURFACE_THRESHOLD, and make our
>> automatic dive splitting JustWork(tm) for you too.
>>
>>Linus
>>
>
___
subsurface mailing list
subsurface@subsurface-divelog.org
http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface


Re: Split a dive by time

2018-07-01 Thread Berthold Stoeger
Hi,

On Sunday, 1 July 2018 21:50:17 CEST Linus Torvalds wrote:
> A lot of these things are likely fairly simple to implement, but there
> are people like me who really don't do UI, but could do the "split
> dive" part fairly easily. And there are probably people who could do
> the UI trivially, but then don't feel comfy with the low-level dive
> profile data structures.

If there is consensus that this is a nice-to-have feature, I can go for it. 
Since the splitting-part is already there, it doesn't sound too hard.

Berthold


___
subsurface mailing list
subsurface@subsurface-divelog.org
http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface


Re: Split a dive by time

2018-07-01 Thread Linus Torvalds
On Sun, Jul 1, 2018 at 12:06 AM tormento  wrote:
>
> Sorry but not working for me. Perhaps I put computer not so shallow to 
> recognize as “surface”.

As with a lot of subsurface issues, one of the main complications is
having the UI integration.

A lot of these things are likely fairly simple to implement, but there
are people like me who really don't do UI, but could do the "split
dive" part fairly easily. And there are probably people who could do
the UI trivially, but then don't feel comfy with the low-level dive
profile data structures.

Things like the automatic dive splitting by surface time was "easy" to
do, because it really ended up just needing another menu entry in the
dive menu.

I do wonder what your dive computer reports the depth as? We consider
"surface" to be 75 cm (so about 2.5 ft). It's an entirely arbitrary
depth, going back to 2012 and never tweaked.

So I wonder what depth your dive computer reported for your surface
time. Maybe we could just tweak that SURFACE_THRESHOLD, and make our
automatic dive splitting JustWork(tm) for you too.

   Linus
___
subsurface mailing list
subsurface@subsurface-divelog.org
http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface


Re: Split a dive by time

2018-07-01 Thread tormento
Sorry but not working for me. Perhaps I put computer not so shallow to
recognize as “surface”.

Il giorno ven 29 giu 2018 alle 20:01 Salvador Cuñat <
salvador.cu...@gmail.com> ha scritto:

> Good evening.
>
> On Fri, Jun 29, 2018 at 06:56:03PM +0200, tormento wrote:
> > There are no 0 segments, unfortunately. And by a defined time would be
> much
> > more useful.
> >
> > Il giorno ven 29 giu 2018 alle 14:04 Jan Mulder  ha
> > scritto:
> >
> > > Not really what you ask for, but there is a split dive option in the
> > > context menu (right-click on a dive in the dive list). This splits
> dives
> > > that have segments of 0m depth in the profile.
> > >
> > > On 29-06-18 13:57, tormento wrote:
> > > > I have a request to do: I need to split a dive in two separate ones
> by
> > > > giving time after which to split. Reason is: I kept too much high
> > > > repetitive timespan on diving computer and we stayed floating before
> > > > doing the second dive. Diving computer recorded it as a single one.
> >
> Jan's option worked pretty well for me in the past. And I've tested it
> with  gd853c477b and still does.  It even trims the surface time
> giving you two "clean" dives.
>
> It works automatically after downloading the dive in most cases, but
> can be manually called, if needed, from the dive list context menu.
>
> Best regards
>
> Salva.
>
___
subsurface mailing list
subsurface@subsurface-divelog.org
http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface


Re: Split a dive by time

2018-06-29 Thread Salvador Cuñat
Good evening.

On Fri, Jun 29, 2018 at 06:56:03PM +0200, tormento wrote:
> There are no 0 segments, unfortunately. And by a defined time would be much
> more useful.
> 
> Il giorno ven 29 giu 2018 alle 14:04 Jan Mulder  ha
> scritto:
> 
> > Not really what you ask for, but there is a split dive option in the
> > context menu (right-click on a dive in the dive list). This splits dives
> > that have segments of 0m depth in the profile.
> >
> > On 29-06-18 13:57, tormento wrote:
> > > I have a request to do: I need to split a dive in two separate ones by
> > > giving time after which to split. Reason is: I kept too much high
> > > repetitive timespan on diving computer and we stayed floating before
> > > doing the second dive. Diving computer recorded it as a single one.
> 
Jan's option worked pretty well for me in the past. And I've tested it
with  gd853c477b and still does.  It even trims the surface time
giving you two "clean" dives.

It works automatically after downloading the dive in most cases, but
can be manually called, if needed, from the dive list context menu.

Best regards

Salva.
___
subsurface mailing list
subsurface@subsurface-divelog.org
http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface


Re: Split a dive by time

2018-06-29 Thread Jan Mulder
Not really what you ask for, but there is a split dive option in the 
context menu (right-click on a dive in the dive list). This splits dives 
that have segments of 0m depth in the profile.


On 29-06-18 13:57, tormento wrote:
I have a request to do: I need to split a dive in two separate ones by 
giving time after which to split. Reason is: I kept too much high 
repetitive timespan on diving computer and we stayed floating before 
doing the second dive. Diving computer recorded it as a single one.


Is it difficult to implement?


--jan
___
subsurface mailing list
subsurface@subsurface-divelog.org
http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface