Commit Graph

7 Commits

Author SHA1 Message Date
Jeppe Odgaard
96f51bf797 drivers: sensor: explorir_m: fix maybe-uninitialized
Fix maybe-uninitialized warning by initializing `restore-rc`.

Signed-off-by: Jeppe Odgaard <jeppe.odgaard@prevas.dk>
2025-04-30 23:03:26 +02:00
Jeppe Odgaard
6c627df62e drivers: sensor: explorir_m: add calibration
Add calibration via a known gas concentration. This is the recommended way
of calibrating the sensor according to the datasheet.

Signed-off-by: Jeppe Odgaard <jeppe.odgaard@prevas.dk>
2025-03-14 17:54:39 +01:00
Jeppe Odgaard
8b8d56a5ca drivers: sensor: explorir_m: increase max response delay
The sensor does not always finish responding within 200 ms.
This is the sometimes the case when using the sensor calibrate command `X`.
Response delay up to 212 ms has been measured with a logic analyzer.

Increase the max response delay to 300 ms to fix the issue.

Signed-off-by: Jeppe Odgaard <jeppe.odgaard@prevas.dk>
2025-03-11 18:54:34 +01:00
Jeppe Odgaard
e575eea233 drivers: sensor: explorir_m: improve transceive
During calibration feature development the following loop was used for
testing:

```shell
CMD="sensor attr_set explorir_m co2 calibration 1234"
while : ; do echo "$CMD" > /dev/ttyACM0; sleep .8; done
```

At some point calibration would fail and all following calibration commands
would fail.

Reset buffer and semaphore just before terminating the command to better
mitigate disturbance from previous failed command.

Signed-off-by: Jeppe Odgaard <jeppe.odgaard@prevas.dk>
2025-03-11 18:54:34 +01:00
Pieter De Gendt
a553af738d drivers: sensor: Place API into iterable section
Add wrapper DEVICE_API macro to all sensor_driver_api instances.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2024-12-02 22:04:55 +00:00
Jeppe Odgaard
20fb6b6d24 drivers: sensors: explorir_m: fix uart flush early termination
`explorir_m_uart_flush_until_end` terminates immediately if the read
variable is initially equal to `EXPLORIR_M_MAX_RESPONSE_DELAY` and
`uart_poll_in` does not read anything.

Fix this by only checking the read variable if `uart_poll_in` reads a char.

Signed-off-by: Jeppe Odgaard <jeppe.odgaard@prevas.dk>
2024-09-04 21:26:36 +02:00
Jeppe Odgaard
b0fdbce4df drivers: sensors: add explorir_m co2 sensor
Add driver for Gas Sensing Solutions' ExplorIR-M CO2 sensor.

Signed-off-by: Jeppe Odgaard <jeppe.odgaard@prevas.dk>
2023-11-13 12:14:08 -05:00