Better error handling for SHTC3 reading
This commit is contained in:
parent
c70eb600a3
commit
9fdd15626a
2 changed files with 5 additions and 7 deletions
|
|
@ -32,11 +32,10 @@ int prst_shtc3_read(prst_shtc3_read_t *out) {
|
|||
|
||||
// Reading in normal (not low power) mode can take up to 12.1 ms, according to
|
||||
// the datasheet.
|
||||
k_msleep(15);
|
||||
k_msleep(20);
|
||||
|
||||
while (i2c_read_dt(&shtc3, buff, 6) != 0) {
|
||||
k_msleep(10);
|
||||
}
|
||||
// Read response.
|
||||
RET_IF_ERR(i2c_read_dt(&shtc3, buff, 6));
|
||||
|
||||
// Put the sensor in sleep mode.
|
||||
RET_IF_ERR(write_cmd(PRST_SHTC3_CMD_SLEEP));
|
||||
|
|
|
|||
|
|
@ -134,7 +134,7 @@ void update_sensors_cb(zb_uint8_t arg) {
|
|||
ZB_MILLISECONDS_TO_BEACON_INTERVAL(1000 * CONFIG_PRST_ZB_SLEEP_DURATION_SEC));
|
||||
if (ret != RET_OK) {
|
||||
prst_debug_counters_increment("sens_cb_schedule_err");
|
||||
zb_reset(0);
|
||||
__ASSERT(false, "Unable to schedule sensor update callback");
|
||||
}
|
||||
|
||||
__ASSERT(!prst_watchdog_feed(), "Failed to feed watchdog");
|
||||
|
|
@ -142,8 +142,7 @@ void update_sensors_cb(zb_uint8_t arg) {
|
|||
prst_debug_counters_increment("sensors_read_before");
|
||||
if (prst_sensors_read_all(&sensors)) {
|
||||
prst_debug_counters_increment("sensors_read_error");
|
||||
LOG_ERR("Unable to read sensors");
|
||||
return;
|
||||
__ASSERT(false, "Unable to read sensors");
|
||||
}
|
||||
prst_debug_counters_increment("sensors_read_after");
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue