Skip to content
This repository was archived by the owner on Aug 29, 2025. It is now read-only.
This repository was archived by the owner on Aug 29, 2025. It is now read-only.

Improve error reporting and handling #22

Description

@matthijskooijman

Currently, this library returns very limited error status, only STATUS_OK or STATUS_FAIL. It would be convenient if some additional codes would be returned (i.e. STATUS_NO_ACK, or STATUS_CRC_FAIL or STATUS_SHORT_READ etc.).

I considered having a go at implementing this, but since this touches on code that comes from the non-arduino-specific embedded-sps repo, which again has code from the embedded-common repo, I'm not going to figure out how all this plays together and where to contribute each part for now.

A related suggestion, is that the I2c implementation should probably check the return value of Wire.requestFrom, which returns the number of bytes actually read. I was using this library on an STM32 platform, which also has a 32-byte buffer. Currently, this makes sensirion_i2c_read silently only return 32 meaningful bytes, with the rest filled with garbage, which will then (usually) be detected by the CRC-checks, but it would be nicer if the short read was detected by itself (and with the above suggestion of different status codes, actually returned as such).

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions