hdc1008_demo: set intial measurement mode
No mode was set before the first read by the app. The first time the app was run, it worked properly, reading temperature and humidity on the first read(). But subsequent reads returned humidity only since that was last mode set up. Also, the ioctl read was returning invalid results.
This commit is contained in:
parent
ccc8ddaf5d
commit
d74ac654a9
@ -69,6 +69,14 @@ int main(int argc, FAR char *argv[])
|
||||
|
||||
/* Read both t and rh */
|
||||
|
||||
ret = ioctl(fd, SNIOC_SET_OPERATIONAL_MODE, HDC1008_MEAS_T_AND_RH);
|
||||
if (ret < 0)
|
||||
{
|
||||
printf("Failed to set temperature and humidity measurement mode: %d\n",
|
||||
errno);
|
||||
goto out;
|
||||
}
|
||||
|
||||
ret = read(fd, buf, sizeof(buf));
|
||||
if (ret < 0)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user