Skip to content

Commit 5e63058

Browse files
fabiobaltieriMaureenHelm
authored andcommitted
sensor: bq274xx: use K_TIMEOUT_ABS_MS for the startup delay
Use K_TIMEOUT_ABS_MS to control the startup delay. Same thing, more compact. Signed-off-by: Fabio Baltieri <[email protected]>
1 parent 15c733a commit 5e63058

File tree

1 file changed

+1
-6
lines changed

1 file changed

+1
-6
lines changed

drivers/sensor/bq274xx/bq274xx.c

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -626,7 +626,6 @@ static int bq274xx_gauge_init(const struct device *dev)
626626
struct bq274xx_data *data = dev->data;
627627
int ret;
628628
uint16_t id;
629-
int32_t delay_remainder_ms;
630629

631630
if (!device_is_ready(config->i2c.bus)) {
632631
LOG_ERR("I2C bus device not ready");
@@ -640,11 +639,7 @@ static int bq274xx_gauge_init(const struct device *dev)
640639
}
641640
#endif
642641

643-
delay_remainder_ms = POWER_UP_DELAY_MS - k_uptime_get_32();
644-
if (delay_remainder_ms > 0) {
645-
LOG_DBG("Power up delay remainder: %dms", delay_remainder_ms);
646-
k_msleep(delay_remainder_ms);
647-
}
642+
k_sleep(K_TIMEOUT_ABS_MS(POWER_UP_DELAY_MS));
648643

649644
ret = bq274xx_get_device_type(dev, &id);
650645
if (ret < 0) {

0 commit comments

Comments
 (0)