[Subsurface-divelog/libdc] Sync with Jef's upstream (#6)

Linus Torvalds torvalds at linux-foundation.org
Thu May 25 10:21:18 PDT 2017


On Wed, May 24, 2017 at 10:13 AM, janmulder <notifications at github.com> wrote:
>
> In addition some merge conflicts are resolved.

So since I want to know what's going on, I ended up doing my own
merging and re-resolving things, and while I did that I became
convinced that there is a bug in the PPO2 reporting for the predator.

The code does this:

#ifdef SENSOR_AVERAGE
                        sample.ppo2 = data[offset + 6] / 100.0;
                        if (callback) callback (DC_SAMPLE_PPO2,
sample, userdata);
#else
                        if ((status & PPO2_EXTERNAL) == 0) {
                                sample.ppo2 = data[offset + 12] *
parser->calibration[0];
                                if (callback && (data[86] & 0x01))
callback (DC_SAMPLE_PPO2, sample, userdata);

                                sample.ppo2 = data[offset + 14] *
parser->calibration[1];
                                if (callback && (data[86] & 0x02))
callback (DC_SAMPLE_PPO2, sample, userdata);

                                sample.ppo2 = data[offset + 15] *
parser->calibration[2];
                                if (callback && (data[86] & 0x04))
callback (DC_SAMPLE_PPO2, sample, userdata);
                        }
#endif

which means that if you don't have SENSOR_AVERAGE defined, and if it's
an external sensor, now there's no sensor reporting AT ALL.

Which seems bogus.

So either that average PPO2 should be sent if there's an external
sensor, or that SENSOR_AVERAGE case should also be inside that "check
for external sensor". The code as it stands now makes no sense.

Anton, I think this is all yours. Comments?

                 Linus

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
libdivecomputer-devel mailing list
libdivecomputer-devel at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libdivecomputer-devel


More information about the devel mailing list