From: Adam Rizkalla <ajarizzo@gmail.com>
To: Vasileios Amoiridis <vassilisamir@gmail.com>
Cc: ang.iglesiasg@gmail.com, jic23@kernel.org, lars@metafoo.de,
linux-iio@vger.kernel.org
Subject: Re: Replying to: [PATCH] iio pressure: bmp280: Fix BMP580 temperature reading
Date: Thu, 2 May 2024 13:15:10 -0500 [thread overview]
Message-ID: <ZjPYLtGAFtI5iN8E@adam-asahi.team.saronic.dev> (raw)
In-Reply-To: <20240502171616.154085-1-vassilisamir@gmail.com>
On Thu, May 02, 2024 at 07:16:16PM +0200, Vasileios Amoiridis wrote:
> Hi Angel!
>
> Indeed the datasheet says that the pressure is a signed value. But this comes
> in contrast with 2 things:
>
> 1) The BMP58x sensor does not have a compensation function so the value from the
> sensor is a pressure value just in different unit from the one reported by IIO.
> And the sensor is able to report in between 30-125kPa according to the
> datasheet which are both positive values so it makes more sense to be an
> unsigned value.
>
> 2) According to the BMP5 sensor API [1] provided by Bosch, the pressure is
> declared as an unsigned value.
>
> So, what should we trust?
>
> [1]: https://github.com/boschsensortec/BMP5_SensorAPI/blob/master/bmp5_defs.h#L895
The pressure sensor reading cannot be negative, as the pressure range of the sensor
is 300 - 1250 hPa,so this change does not need to be applied for bmp580_read_press().
Also, the overflow issue does not happen with the pressure reading since the value
read back from the device is scaled up only by 2^6 for pressure vs 2^16 for temperature,
so multiplying by 1000 even for the maximum value would still fit in a 32-bit signed
integer. Temperature ranges above ~32.767C, however, will overflow a 32-bit signed
integer when multiplied by 2^16 * 1000 which is why this change is necessary only for
temperature readings.
Hope this helps clarify.
Best,
Adam
next prev parent reply other threads:[~2024-05-02 18:15 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-25 6:22 [PATCH] iio: pressure: bmp280: Fix BMP580 temperature reading Adam Rizkalla
2024-04-28 13:40 ` Jonathan Cameron
2024-05-02 13:05 ` Replying to: " Vasileios Amoiridis
2024-05-02 15:44 ` Angel Iglesias
2024-05-02 17:16 ` Replying to: [PATCH] iio " Vasileios Amoiridis
2024-05-02 18:15 ` Adam Rizkalla [this message]
2024-05-03 7:13 ` Angel Iglesias
2024-05-05 18:02 ` Jonathan Cameron
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ZjPYLtGAFtI5iN8E@adam-asahi.team.saronic.dev \
--to=ajarizzo@gmail.com \
--cc=ang.iglesiasg@gmail.com \
--cc=jic23@kernel.org \
--cc=lars@metafoo.de \
--cc=linux-iio@vger.kernel.org \
--cc=vassilisamir@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox