Re: [PATCH v1 09/13] iio: chemical: bme680: Move ambient temperature to attributes

Vasileios Amoiridis
2024-10-19T17:51:39Z

On Sat, Oct 19, 2024 at 02:59:25PM +0100, Jonathan Cameron wrote:
> On Mon, 14 Oct 2024 22:14:23 +0200
> Vasileios Amoiridis <vassilisamir@gmail.com> wrote:
>
> > On Sat, Oct 12, 2024 at 01:01:24PM +0100, Jonathan Cameron wrote:
> > > On Thu, 10 Oct 2024 23:00:26 +0200
> > > vamoirid <vassilisamir@gmail.com> wrote:
> > >
> > > > From: Vasileios Amoiridis <vassilisamir@gmail.com>
> > > >
> > > > Remove the ambient temperature from being a macro and implement it as
> > > > an attribute. This way, it is possible to dynamically configure the
> > > > ambient temperature of the environment to improve the accuracy of the
> > > > measurements.
> > > >
> > > > Signed-off-by: Vasileios Amoiridis <vassilisamir@gmail.com>
> > > New ABI? Would need docs.
> > >
> > > However, I 'think' we have a few cases where we handle this via the slightly
> > > odd interface of out_temp_processed / _raw with a label saying it's
> > > ambient temperature.
> > >
> > > The tenuous argument is that we have heaters that actually control the
> > > temperature and the affect of either heating the thing or just happening
> > > to know the external temperature ends up being the same. Hence use
> > > an output channel for this control.
> > >
> > > Jonathan
> >
> > Hi Jonathan,
> >
> > Thanks for taking the time to review this. I saw your previous messages,
> > and I am not responding to all of them so as to not flood you with ACK
> > messages.
> >
> > For this one though I have to ask. The last commit of this series is
> > adding support for an output current channel that controls the current
> > that is being inserted into an internal plate that is heated up in order
> > to have more precise acquisition of humidity and gas measurement. Does
> > it makes sense to add an ambient temp output channel as well?
>
> If we need to know that temperature to calculate the meaning of the pressure
> channels then I think it does.
>
> I am a little confused though as this device measures the temperature.
> Why isn't that the right value to use? Is that because the heater
> is confusing things?
>
>

Hi Jonathan,

Thank you very much for your message! So, I digged a bit more into the
device datasheet and I found out that the ambient temperature can
actually be taken directly from the measured temperature (p.22 of [1]),
I can use this one. This means, that the ambient temp can be fully
dropped since the temperature of the sensor is the information we need.
Is it ok to drop it fully since it is an ABI change? If not how should I
approach this?

Another thing that I had missed because of the way the code was written
is that actually we can (and should) use output channel for setting the
temperature of the internal heater plate. This sensor essentially has an
internal heater plate that allows it to measure the VOC. Currently if
you check the driver [2], the value of the requested temperature of the
heater is set only once in the probe function and stays all the time
like this. This doesn't allow for much flexibility. But it is something
that I will do in another series and not this one, since this one is
already quite heavy.

Cheers,
Vasilis

PS: I don't understand why Bosch designed the sensor in this way. Since
the value of the ambient temp can be either hardcoded or the actual
value of the temperature sensor, they could have had all this logic in
hardware. They could actually even implement the compensation functions
in hardware and just return RAW values to us. It's kind of the same
situation with the BME280 and BMP{1,2,3,5}80 drivers that we have.

[1]: https://www.bosch-sensortec.com/media/boschsensortec/downloads/datasheets/bst-bme680-ds001.pdf
[2]: https://elixir.bootlin.com/linux/v6.11.4/source/drivers/iio/chemical/bme680_core.c#L989
> >
> > Cheers,
> > Vasilis
> >
>