Re: Problems with gases on Shearwater

2018-12-06 Thread Linus Torvalds
On Thu, Dec 6, 2018 at 6:51 AM Long, Martin  wrote:
>
> By the way, my BLE and BT (I have to use legacy BT for the Petrel
> controller), have both been working very well for me lately. It used
> to be a struggle every time, but recently it's worked first time every
> time.

Yeah, we've gotten a lot more stable wrt BLE, that's for sure. Don't
know about legacy bluetooth, I don't really have any devices with
that.

I think what's going on with the Shearwaters is that they have this
odd "non-pairing pairing", where they don't really do proper
bluetooth, but instead have a simplified bluetooth stack that "kind of
works".

And that stack gets confused when you switch between two different
devices to download.

In particular, I think my Teric problem was that the last time I
downloaded from it, I used my laptop (because I was traveling for
diving). And then when I wanted to try it yesterday, my laptop was
sitting next to me on my desk, but I was trying to talk to the Teric
using my "real" computer.

So what I think happened is that the Teric saw the laptop, and
continued to want to talk to it, even though I was trying to connect
to it from the desktop.

Turning off my laptop before starting Bluetooth on the Teric seems to
have solved the issue.

So the Shearwater bluetooth stack has some kind of fake pairing which
is just "remember who I talked to last, and prefer that target,
whether it's talking to me or not".

Anyway, I don't think it's related to the subsurface BLE code at all -
we've always had odd behavior when trying to switch between different
downloaders with Shearwater.

> The 13/16 was what I had in when I arrived on site (a rubbish, but
> usable blend). After day 2 needed a fill, asked for 15/55, got 15/57.
> So I simply updated the 13/60 to 15/57. Just checked again, and there
> is only the 15/57 in there now. Same on both computers.

Hmm.

Then it's _really_ odd that all three dives show up as 15/57. I don't
see from the code how that could happen at all. There should have been
absolutely nothing in the first two dives that could have possibly
resulted in that gasmix being downloaded.

Strange. And I'm assuming there's no way you could possibly have had
15/57 on that Perdix AI from before (and just forgotten and dove with
the wrong gas), since it wasn't even some standard target gas for you.

But I have to ask, since you apparently use the Perdix AI as the
second backup. - could it be something like that?

Anyway, I'd love to see downloads from scratch and separately for the
Perdix AI and Petrel (ie don't download into your existing subsurface
database). Both the resulting xml file and the libdivecomputer
logfile.

If you start subsurface from the command line, the easiest way to do
that is to just do something like

subsurface nonexisting.xml

which will start subsurface with an empty slate (and a warning about
how it can't open "nonexisting.xml", of course). And then you do "save
as" at the end to save the result to some temporary XML file (do *not*
save to cloud which might overwrite your existing cloud data!).

> The shearwater doesn't associate gasses with transmitters. They're
> completely separate things. T1 and T2, and Gas1, Gas2, Gas3 etc. Only
> the diver makes the association.

Bah. I like the Shearwater Perdix AI, and the Teric is probably now my
favorite dive computer, but dammit, the *only* dive computer that gets
gas handling right - including pressures - seems to be the Suunto EON
Steel/Core.

But yeah, that means that we'd need to have some way to fix up sensor
to cylinder mapping by hand after the fact. Which is a real pain from
a UI standpoint. Well, it is for me, at least. I'm perfectly comfy
working on libdivecomputer and on low-level subsurface stuff, but the
UI things I just punt on..

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


Re: Problems with gases on Shearwater

2018-12-06 Thread Long, Martin
Ok, I think I can confirm that the first issue is somewhere between a
mistake, and the user interface allowing me to do something dangerous.
(Sorry Linus for the wild goose chase.

I multi-selected all of my dives for the trip, and chanced the "type" of
cylinder 1 to a 3l cylinder, and saved it. This seems to have updated the
o2% and He%, though not the pressures, for cylinder one on all of those
dives. I wouldn't have expected that to happen.

However, I'm still stuck with cylinder 2 now being a hybrid of my oxygen
pressure and first gas switch cylinder.


On Thu, 6 Dec 2018 at 15:51, Long, Martin  wrote:

> Hi Jef
>
> Looking back through my git history it looks like it may have actually
> been imported correctly, so I now suspect that the first issue may not
> actually be download issue.  I'll see if I can reproduce that one. It looks
> like it happened when added the dives to a trip, and renumbered them.
>
> The second problem, however, is not so much a bug as a challenge. How to
> map transmitter data to gasses.
>
> I'll keep you posted
>
> thanks
>
> Martin
>
> On Thu, 6 Dec 2018 at 15:42, Jef Driesen  wrote:
>
>> On 2018-12-05 17:17, Long, Martin wrote:
>> > I've noticed some problems with the import of gases on Shearwater
>> > computers. There are possible 2 issues here, but these seem to be
>> > related.
>> >
>> > 1) I just imported 4 dives from last weekend, all CCR. The first 3
>> > were on 13/60 diluent and the last one on 15/57. However, it put all
>> > of the divers in as 15/57, which seems to just be the last diluent
>> > set. The Shearwater cloud software does identify the correct gas used
>> > at the start of the dive.
>> >
>> > 2) I'm using two transmitters on a Perdix AI. Transmitter 1 is on my
>> > diluent, and transmitter 2 on my oxygen. On import it seems to
>> > correctly associate my transmitter one with the diluent (apart from
>> > the error in 1 above). Now, providing I don't do any gas switches
>> > (e.g. a bailout) then transmitter 2 I can simply set up as 100% O2.
>> > However, if I do a gas switch, the software automatically assigns this
>> > gas switch to cyl 2, and so it becomes associated with the transmitter
>> > data.
>> >
>> > I now have 2 choices... Either I can enter a new gas of 100% and
>> > manually type the start and end pressure - however I cannot remote it
>> > from cyl 2. Or, I can set cyl 2 as 100%, and add a new one for my
>> > baiout gas. However this then means the cylinder swtich then points at
>> > the wrong gas, and will say I switched to 100% on my bailout!
>> >
>> > I don't have a solution to this. As the import process has no manual
>> > intervention, it would be tricky to have a solution which works. My
>> > suggestion would be to treat transmitters and gas swtiches as
>> > completely separate cylinders, and then allow the user to "merge" them
>> > later. The current assumption that transmitter 1 will be the first
>> > gas, and transmitter 2 will be the next one is incorrect.
>> >
>> > By the way, the ability to merge the 2 profiles from my Petrel
>> > controller, and Perdix backup (with AI) is excellent! and works really
>> > well.
>>
>> Can you send us the subsurface and libdivecomputer logfiles of a (full)
>> download? That will allow us to have a look at the raw data, and see
>> where or what is going wrong.
>>
>> PS: The shearwater protocol doesn't support memory dumps, but I can
>> extract the raw dive data from the download log.
>>
>> Jef
>>
>
___
subsurface mailing list
subsurface@subsurface-divelog.org
http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface


Re: Problems with gases on Shearwater

2018-12-06 Thread Long, Martin
Hi Jef

Looking back through my git history it looks like it may have actually been
imported correctly, so I now suspect that the first issue may not actually
be download issue.  I'll see if I can reproduce that one. It looks like it
happened when added the dives to a trip, and renumbered them.

The second problem, however, is not so much a bug as a challenge. How to
map transmitter data to gasses.

I'll keep you posted

thanks

Martin

On Thu, 6 Dec 2018 at 15:42, Jef Driesen  wrote:

> On 2018-12-05 17:17, Long, Martin wrote:
> > I've noticed some problems with the import of gases on Shearwater
> > computers. There are possible 2 issues here, but these seem to be
> > related.
> >
> > 1) I just imported 4 dives from last weekend, all CCR. The first 3
> > were on 13/60 diluent and the last one on 15/57. However, it put all
> > of the divers in as 15/57, which seems to just be the last diluent
> > set. The Shearwater cloud software does identify the correct gas used
> > at the start of the dive.
> >
> > 2) I'm using two transmitters on a Perdix AI. Transmitter 1 is on my
> > diluent, and transmitter 2 on my oxygen. On import it seems to
> > correctly associate my transmitter one with the diluent (apart from
> > the error in 1 above). Now, providing I don't do any gas switches
> > (e.g. a bailout) then transmitter 2 I can simply set up as 100% O2.
> > However, if I do a gas switch, the software automatically assigns this
> > gas switch to cyl 2, and so it becomes associated with the transmitter
> > data.
> >
> > I now have 2 choices... Either I can enter a new gas of 100% and
> > manually type the start and end pressure - however I cannot remote it
> > from cyl 2. Or, I can set cyl 2 as 100%, and add a new one for my
> > baiout gas. However this then means the cylinder swtich then points at
> > the wrong gas, and will say I switched to 100% on my bailout!
> >
> > I don't have a solution to this. As the import process has no manual
> > intervention, it would be tricky to have a solution which works. My
> > suggestion would be to treat transmitters and gas swtiches as
> > completely separate cylinders, and then allow the user to "merge" them
> > later. The current assumption that transmitter 1 will be the first
> > gas, and transmitter 2 will be the next one is incorrect.
> >
> > By the way, the ability to merge the 2 profiles from my Petrel
> > controller, and Perdix backup (with AI) is excellent! and works really
> > well.
>
> Can you send us the subsurface and libdivecomputer logfiles of a (full)
> download? That will allow us to have a look at the raw data, and see
> where or what is going wrong.
>
> PS: The shearwater protocol doesn't support memory dumps, but I can
> extract the raw dive data from the download log.
>
> Jef
>
___
subsurface mailing list
subsurface@subsurface-divelog.org
http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface


Re: Problems with gases on Shearwater

2018-12-06 Thread Jef Driesen

On 2018-12-05 17:17, Long, Martin wrote:

I've noticed some problems with the import of gases on Shearwater
computers. There are possible 2 issues here, but these seem to be
related.

1) I just imported 4 dives from last weekend, all CCR. The first 3
were on 13/60 diluent and the last one on 15/57. However, it put all
of the divers in as 15/57, which seems to just be the last diluent
set. The Shearwater cloud software does identify the correct gas used
at the start of the dive.

2) I'm using two transmitters on a Perdix AI. Transmitter 1 is on my
diluent, and transmitter 2 on my oxygen. On import it seems to
correctly associate my transmitter one with the diluent (apart from
the error in 1 above). Now, providing I don't do any gas switches
(e.g. a bailout) then transmitter 2 I can simply set up as 100% O2.
However, if I do a gas switch, the software automatically assigns this
gas switch to cyl 2, and so it becomes associated with the transmitter
data.

I now have 2 choices... Either I can enter a new gas of 100% and
manually type the start and end pressure - however I cannot remote it
from cyl 2. Or, I can set cyl 2 as 100%, and add a new one for my
baiout gas. However this then means the cylinder swtich then points at
the wrong gas, and will say I switched to 100% on my bailout!

I don't have a solution to this. As the import process has no manual
intervention, it would be tricky to have a solution which works. My
suggestion would be to treat transmitters and gas swtiches as
completely separate cylinders, and then allow the user to "merge" them
later. The current assumption that transmitter 1 will be the first
gas, and transmitter 2 will be the next one is incorrect.

By the way, the ability to merge the 2 profiles from my Petrel
controller, and Perdix backup (with AI) is excellent! and works really
well.


Can you send us the subsurface and libdivecomputer logfiles of a (full) 
download? That will allow us to have a look at the raw data, and see 
where or what is going wrong.


PS: The shearwater protocol doesn't support memory dumps, but I can 
extract the raw dive data from the download log.


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


Re: Problems with gases on Shearwater

2018-12-06 Thread Long, Martin
Thanks for getting back to me Linus.

By the way, my BLE and BT (I have to use legacy BT for the Petrel
controller), have both been working very well for me lately. It used to be
a struggle every time, but recently it's worked first time every time.

On Wed, 5 Dec 2018 at 17:38, Linus Torvalds 
wrote:

> On Wed, Dec 5, 2018 at 8:18 AM Long, Martin  wrote:
> >
> > 1) I just imported 4 dives from last weekend, all CCR. The first 3
> >were on 13/60 diluent and the last one on 15/57. However, it put
> >all of the divers in as 15/57, which seems to just be the last
> >diluent set. The Shearwater cloud software does identify the
> >correct gas used at the start of the dive.
>
> Hmm. We clearly do something wrong, presumably in libdivecomputer
> (although it could be some gas mixup in subsurface too, but unlikely).
>
> Just to clarify: did you have both 13/60 and 15/57 _programmed_ on the
> Shearwater for all four dives, but you then activate one of the two
> before the dive?
>

No. The 13/16 was what I had in when I arrived on site (a rubbish, but
usable blend). After day 2 needed a fill, asked for 15/55, got 15/57. So I
simply updated the 13/60 to 15/57. Just checked again, and there is only
the 15/57 in there now. Same on both computers.


>
> The way this all works in libdivecomputer:
>
>  - the shearwater never really gives us a set of cylinders at all.
>
>  - instead, each sample contains "current gas mix"
>
>  - as the current gas changes, we look it up in the previously seen
> gas mixes, and if not seen we give it a new cylinder number
>
> In other words, the first gas mentioned in the log always ends up
> being gas 0, then the next one is gas 1 etc.
>
> But what we don't have is any knowledge of what gas the *shearwater*
> considers gas 0/1/2.. and in particular we don't know how it
> associates gases with transmitters.
>

The shearwater doesn't associate gasses with transmitters. They're
completely separate things. T1 and T2, and Gas1, Gas2, Gas3 etc. Only the
diver makes the association.


>
> I don't see how/why we'd get the gas mix wrong for your four dives, though.
>
> Anyway, we do have some documentation from Shearwater, and I think it
> should be possible to get the proper "these are the cylinders".
>
> I'll just have to read it and understand it. Dirk, who actually did
> the new Shearwater format (and thus probably knows it better) is off
> gallivanting with real work in Asia right now, so he probably won't be
> able to do much, even though he's probably a better person for it.
>
> > 2) I'm using two transmitters on a Perdix AI. Transmitter 1 is on my
> >diluent, and transmitter 2 on my oxygen. On import it seems to
> >correctly associate my transmitter one with the diluent (apart from
> >the error in 1 above). Now, providing I don't do any gas switches
> >(e.g. a bailout) then transmitter 2 I can simply set up as 100% O2.
> >However, if I do a gas switch, the software automatically assigns
> >this gas switch to cyl 2, and so it becomes associated with the
> >transmitter data.
>
> This is how the libdivecomputer cylinder pressure parsing works, but
> we didn't know any better. The Shearwater gives us two pressures, and
> we assume that the first pressure is for tank 0, and the second
> pressure is for tank 1.
>
> We have no logic to associate pressures with any other cylinders, and
> I don't really know what the logic would be. But see above. Getting
> the cylinder index right would probably fix things properly.
>
> So I will look into it.
>
> > I now have 2 choices... Either I can enter a new gas of 100% and
> > manually type the start and end pressure - however I cannot remote it
> > from cyl 2. Or, I can set cyl 2 as 100%, and add a new one for my
> > baiout gas. However this then means the cylinder swtich then points at
> > the wrong gas, and will say I switched to 100% on my bailout!
>
> Right. These problems are related. You can't remove the second gas,
> because it's mentioned as a gas switch target. And when you add the
> new gas, it doesn't fix the gas switch target.
>
> What you can do - and which will fix both issues - is to simply edit
> the gas switch. You can do it either the hacky way (just edit in the
> xml file or in the git repository by hand), or you can do it in the
> GUI on desktop by adding a new gas switch and then removing the old
> one.
>
> But there's a downside: playing games with gas switches can also
> confuse subsurface in what the pressure data is. So you may lose the
> pressure data unless you are very careful (again, doing this by hand
> if you know exactly what you're doing is possible, but it's all kinds
> of crazy so I can't really recommend it).
>

I suspect I could do this, as log as I don't remove the two cylinders which
show the pressure data. I could add a third with the gas I switched to and
replace the gas switch to point to that.


>
> > I don't have a solution to this. As the import process has no manual
> 

Re: Problems with gases on Shearwater

2018-12-05 Thread Linus Torvalds
On Wed, Dec 5, 2018 at 9:38 AM Linus Torvalds
 wrote:
>
> So I will look into it.

Grr. Right now BLE doesn't seem to work for me at all on my Teric and
my main desktop.

I suspect it's because I upgraded to F29, and that changed something.
But my Aqualung i770R works fine, so it's not that BLE doesn't work in
general, it's something specific to the Shearwater BLE situation.

Shearwater bluetooth has always been odd and somewhat flaky. I thought
we'd gotten over it because it worked fairly well for me lately, but
apparently there's still something wrong with it..

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


Re: Problems with gases on Shearwater

2018-12-05 Thread Linus Torvalds
On Wed, Dec 5, 2018 at 8:18 AM Long, Martin  wrote:
>
> 1) I just imported 4 dives from last weekend, all CCR. The first 3
>were on 13/60 diluent and the last one on 15/57. However, it put
>all of the divers in as 15/57, which seems to just be the last
>diluent set. The Shearwater cloud software does identify the
>correct gas used at the start of the dive.

Hmm. We clearly do something wrong, presumably in libdivecomputer
(although it could be some gas mixup in subsurface too, but unlikely).

Just to clarify: did you have both 13/60 and 15/57 _programmed_ on the
Shearwater for all four dives, but you then activate one of the two
before the dive?

The way this all works in libdivecomputer:

 - the shearwater never really gives us a set of cylinders at all.

 - instead, each sample contains "current gas mix"

 - as the current gas changes, we look it up in the previously seen
gas mixes, and if not seen we give it a new cylinder number

In other words, the first gas mentioned in the log always ends up
being gas 0, then the next one is gas 1 etc.

But what we don't have is any knowledge of what gas the *shearwater*
considers gas 0/1/2.. and in particular we don't know how it
associates gases with transmitters.

I don't see how/why we'd get the gas mix wrong for your four dives, though.

Anyway, we do have some documentation from Shearwater, and I think it
should be possible to get the proper "these are the cylinders".

I'll just have to read it and understand it. Dirk, who actually did
the new Shearwater format (and thus probably knows it better) is off
gallivanting with real work in Asia right now, so he probably won't be
able to do much, even though he's probably a better person for it.

> 2) I'm using two transmitters on a Perdix AI. Transmitter 1 is on my
>diluent, and transmitter 2 on my oxygen. On import it seems to
>correctly associate my transmitter one with the diluent (apart from
>the error in 1 above). Now, providing I don't do any gas switches
>(e.g. a bailout) then transmitter 2 I can simply set up as 100% O2.
>However, if I do a gas switch, the software automatically assigns
>this gas switch to cyl 2, and so it becomes associated with the
>transmitter data.

This is how the libdivecomputer cylinder pressure parsing works, but
we didn't know any better. The Shearwater gives us two pressures, and
we assume that the first pressure is for tank 0, and the second
pressure is for tank 1.

We have no logic to associate pressures with any other cylinders, and
I don't really know what the logic would be. But see above. Getting
the cylinder index right would probably fix things properly.

So I will look into it.

> I now have 2 choices... Either I can enter a new gas of 100% and
> manually type the start and end pressure - however I cannot remote it
> from cyl 2. Or, I can set cyl 2 as 100%, and add a new one for my
> baiout gas. However this then means the cylinder swtich then points at
> the wrong gas, and will say I switched to 100% on my bailout!

Right. These problems are related. You can't remove the second gas,
because it's mentioned as a gas switch target. And when you add the
new gas, it doesn't fix the gas switch target.

What you can do - and which will fix both issues - is to simply edit
the gas switch. You can do it either the hacky way (just edit in the
xml file or in the git repository by hand), or you can do it in the
GUI on desktop by adding a new gas switch and then removing the old
one.

But there's a downside: playing games with gas switches can also
confuse subsurface in what the pressure data is. So you may lose the
pressure data unless you are very careful (again, doing this by hand
if you know exactly what you're doing is possible, but it's all kinds
of crazy so I can't really recommend it).

> I don't have a solution to this. As the import process has no manual
> intervention, it would be tricky to have a solution which works. My
> suggestion would be to treat transmitters and gas swtiches as
> completely separate cylinders, and then allow the user to "merge" them
> later. The current assumption that transmitter 1 will be the first
> gas, and transmitter 2 will be the next one is incorrect.

Well, we should just get the mapping right and not have this problem,
but neither I nor Dirk has ever really used the Perdix AI with
multiple cylinders.

Let's see what I can do.

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