> On Apr 28, 2022, at 9:32 AM, Linus Torvalds <[email protected]> 
> wrote:
> 
> On Thu, Apr 28, 2022 at 9:25 AM Dirk Hohndel <[email protected]> wrote:
>> 
>> Yes, I get that part. And assuming we are looking at a CCR dive I can
>> assign some resemblance of sense to it. But if this is an OC dive, this
>> is all not at all useful,
> 
> But for an OC dive, all it does is
> 
> - set index 0 to 0 (or NO_SENSOR if we don't have any cylinders)
> 
> - set index 1 to 1 (or NO_SENSOR if we have only one cylinder)
> 

except that's not what it does.
If you have four cylinders, because that's what your dive computer provides
in the download, then it sets index 0 to the cylinder that is in use, and index 
1
stays 1.
Which then the code I mentioned interprets as "oh, cylinder 1 is in use"

> so it just basically sets up the identity mapping for the first sample.
> 
> IOW, on OC, it has absolutely nothing to do with the O2 cylinder.
> 
> Could the math be written differently and more explicitly? Oh yes it
> could. We could just have some "if this is a CCR dive vs OC dive"
> explicit logic. Instead it's doing that thing that should just work
> for both.
> 
>> For the 90+% of all the OC dives that are "single tank, no gas switches,
>> I'm just having fun" this is actively WRONG
> 
> See above. For those dives, all it does is
> 
>        sample->sensor[0] = 0;
>        sample->sensor[1] = NO_SENSOR;
> 
> why do you think that's so wrong?

If it did that, that would be correct.
And it gets worse. Even if I fix the code so that it does what you write here,
if you then delete a different cylinder, the renumbering code quite explicitly
replaces any entry in the mapping table that says "this maps to NO CYLINDER"
with "0" in sample_renumber()
And now cylinder 0 is marked as used. Which in this particular case (see my
first email) is equally wrong.

> Of course, most people won't even have a sensor at all, so even
> initializing that sensor[0] to 0 is likely then pointless, but if you
> have no sensor values, it shouldn't matter.

True.

/D
_______________________________________________
subsurface mailing list
[email protected]
http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface

Reply via email to