Closed rhr407 closed 2 years ago
@juliandoerner Could you take a look at this?
Any update on this issue?
I will try to reproduce on at the weekend.
Any progress on this issue?
Working for me after adding the following lines in the init function.
tsl2591_set_power_status(dev, TSL2591_POWER_ON);
tsl2591_set_als_status(dev, TSL2591_ALS_ON);
tsl2591_set_gain(dev, TSL2591_GAIN_MEDIUM);
tsl2591_set_integration_time(dev, TSL2591_INTEGRATION_300MS);
esp_err_t tsl2591_init(tsl2591_t *dev)
{
CHECK_ARG(dev);
ESP_LOGD(TAG, "Initialize sensor.");
I2C_DEV_TAKE_MUTEX(&dev->i2c_dev);
tsl2591_set_power_status(dev, TSL2591_POWER_ON);
tsl2591_set_als_status(dev, TSL2591_ALS_ON);
tsl2591_set_gain(dev, TSL2591_GAIN_MEDIUM);
tsl2591_set_integration_time(dev, TSL2591_INTEGRATION_300MS);
uint8_t tmp_reg = 0;
I2C_DEV_CHECK(&dev->i2c_dev, read_enable_register(dev, &tmp_reg));
dev->settings.enable_reg = tmp_reg;
ESP_LOGD(TAG, "Initial enable register: %x.", tmp_reg);
I2C_DEV_CHECK(&dev->i2c_dev, read_control_register(dev, &tmp_reg));
dev->settings.control_reg = tmp_reg;
ESP_LOGD(TAG, "Initial control register: %x.", tmp_reg);
I2C_DEV_CHECK(&dev->i2c_dev, read_register(dev, TSL2591_REG_PERSIST, &tmp_reg));
dev->settings.persistence_reg = tmp_reg;
ESP_LOGD(TAG, "Initial persistence filter: %x.", tmp_reg);
I2C_DEV_GIVE_MUTEX(&dev->i2c_dev);
// Wait until the first integration cycle is completed.
tsl2591_integration_time_t integration_time;
ESP_ERROR_CHECK(tsl2591_get_integration_time(dev, &integration_time));
switch (integration_time)
{
case TSL2591_INTEGRATION_100MS:
SLEEP_MS(110);
break;
case TSL2591_INTEGRATION_200MS:
SLEEP_MS(210);
break;
case TSL2591_INTEGRATION_300MS:
SLEEP_MS(310);
break;
case TSL2591_INTEGRATION_400MS:
SLEEP_MS(410);
break;
case TSL2591_INTEGRATION_500MS:
SLEEP_MS(510);
break;
case TSL2591_INTEGRATION_600MS:
SLEEP_MS(610);
break;
}
return ESP_OK;
}
The issue
When running the example code, the following text keeps printing on the terminal.
Which SDK are you using?
esp-idf
Which version of SDK are you using?
4.4.2
Which build target have you used?
Component causing the issue
tsl2591
Anything in the logs that might be useful for us?
No response
Additional information or context
No response
Confirmation