<div dir="ltr"><div dir="ltr">Hi David,<div><br></div><div>Thanks for your feedback.</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, 28 Jun 2022 at 09:30, David Plowman <<a href="mailto:david.plowman@raspberrypi.com">david.plowman@raspberrypi.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hi Naush<br>
<br>
Thanks for the patch!<br>
<br>
On Fri, 24 Jun 2022 at 08:35, Naushir Patuck via libcamera-devel<br>
<<a href="mailto:libcamera-devel@lists.libcamera.org" target="_blank">libcamera-devel@lists.libcamera.org</a>> wrote:<br>
><br>
> Fetch the sensor temperature value from the embedded data buffer and add it to<br>
> the DeviceStatus structure in CamHelperImx477::PopulateMetadata().<br>
><br>
> Signed-off-by: Naushir Patuck <<a href="mailto:naush@raspberrypi.com" target="_blank">naush@raspberrypi.com</a>><br>
> Reviewed-by: Kieran Bingham <<a href="mailto:kieran.bingham@ideasonboard.com" target="_blank">kieran.bingham@ideasonboard.com</a>><br>
> ---<br>
>  src/ipa/raspberrypi/cam_helper_imx477.cpp | 5 ++++-<br>
>  1 file changed, 4 insertions(+), 1 deletion(-)<br>
><br>
> diff --git a/src/ipa/raspberrypi/cam_helper_imx477.cpp b/src/ipa/raspberrypi/cam_helper_imx477.cpp<br>
> index 338fdc0c416a..0e1c0dbd142f 100644<br>
> --- a/src/ipa/raspberrypi/cam_helper_imx477.cpp<br>
> +++ b/src/ipa/raspberrypi/cam_helper_imx477.cpp<br>
> @@ -5,6 +5,7 @@<br>
>   * cam_helper_imx477.cpp - camera helper for imx477 sensor<br>
>   */<br>
><br>
> +#include <algorithm><br>
>  #include <assert.h><br>
>  #include <cmath><br>
>  #include <stddef.h><br>
> @@ -34,8 +35,9 @@ constexpr uint32_t gainHiReg = 0x0204;<br>
>  constexpr uint32_t gainLoReg = 0x0205;<br>
>  constexpr uint32_t frameLengthHiReg = 0x0340;<br>
>  constexpr uint32_t frameLengthLoReg = 0x0341;<br>
> +constexpr uint32_t temperatureReg = 0x013a;<br>
>  constexpr std::initializer_list<uint32_t> registerList =<br>
> -       { expHiReg, expLoReg, gainHiReg, gainLoReg, frameLengthHiReg, frameLengthLoReg  };<br>
> +       { expHiReg, expLoReg, gainHiReg, gainLoReg, frameLengthHiReg, frameLengthLoReg, temperatureReg  };<br>
><br>
>  class CamHelperImx477 : public CamHelper<br>
>  {<br>
> @@ -171,6 +173,7 @@ void CamHelperImx477::PopulateMetadata(const MdParser::RegisterMap &registers,<br>
>         deviceStatus.shutter_speed = Exposure(<a href="http://registers.at" rel="noreferrer" target="_blank">registers.at</a>(expHiReg) * 256 + <a href="http://registers.at" rel="noreferrer" target="_blank">registers.at</a>(expLoReg));<br>
>         deviceStatus.analogue_gain = Gain(<a href="http://registers.at" rel="noreferrer" target="_blank">registers.at</a>(gainHiReg) * 256 + <a href="http://registers.at" rel="noreferrer" target="_blank">registers.at</a>(gainLoReg));<br>
>         deviceStatus.frame_length = <a href="http://registers.at" rel="noreferrer" target="_blank">registers.at</a>(frameLengthHiReg) * 256 + <a href="http://registers.at" rel="noreferrer" target="_blank">registers.at</a>(frameLengthLoReg);<br>
> +       deviceStatus.sensor_temperature = std::clamp<int8_t>(<a href="http://registers.at" rel="noreferrer" target="_blank">registers.at</a>(temperatureReg), -20, 80);<br>
<br>
I guess I'm mildly curious if out-of-bounds values from the register<br>
mean anything, but probably not worth worrying ourselves about too<br>
much.</blockquote><div><br></div><div>From the datasheet, the register is treated as a signed 8-bit value, but with the</div><div>-20 C to 80 C limits. I'm not sure if this means that these limits are recommended and</div><div>the register can provide temperature measurements of -128C to 127C. Or perhaps the</div><div>register never goes beyond the -20 C to 80 C limits..? Either way, I am not worrying too</div><div>much about it.</div><div><br></div><div>Naush</div><div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"> So:<br>
<br>
Reviewed-by: David Plowman <<a href="mailto:david.plowman@raspberrypi.com" target="_blank">david.plowman@raspberrypi.com</a>><br>
<br>
Thanks<br>
David<br>
<br>
><br>
>         metadata.Set("device.status", deviceStatus);<br>
>  }<br>
> --<br>
> 2.25.1<br>
><br>
</blockquote></div></div>