successfully reading temperature from BMX
Some checks failed
Some checks failed
This commit is contained in:
@ -46,7 +46,7 @@ int main(void)
|
||||
}
|
||||
}
|
||||
|
||||
printf("Initialized %s\n", dev->name);
|
||||
LOG_INF("Initialized %s\n", dev->name);
|
||||
|
||||
if (cfb_framebuffer_init(dev))
|
||||
{
|
||||
@ -106,7 +106,7 @@ int main(void)
|
||||
LOG_ERR("Device %s not ready\n", bmx->name);
|
||||
return 0;
|
||||
}
|
||||
printf("Initialized %s\n", bmx->name);
|
||||
LOG_INF("Initialized %s\n", bmx->name);
|
||||
|
||||
// hdc = DEVICE_DT_GET(DT_NODELABEL(hdc1080));
|
||||
// if (!device_is_ready(dev))
|
||||
@ -156,7 +156,20 @@ int main(void)
|
||||
LOG_ERR("Could not get pressure (%d)", ret);
|
||||
return 0;
|
||||
}
|
||||
ret = sensor_channel_get(bmp, SENSOR_CHAN_AMBIENT_TEMP, &temperature);
|
||||
// ret = sensor_channel_get(bmp, SENSOR_CHAN_AMBIENT_TEMP, &temperature);
|
||||
// if (ret < 0)
|
||||
// {
|
||||
// LOG_ERR("Could not get temperature (%d)", ret);
|
||||
// return 0;
|
||||
// }
|
||||
|
||||
ret = sensor_sample_fetch(bmx);
|
||||
if (ret < 0)
|
||||
{
|
||||
LOG_ERR("Could not fetch sample (%d)", ret);
|
||||
return 0;
|
||||
}
|
||||
ret = sensor_channel_get(bmx, SENSOR_CHAN_DIE_TEMP, &temperature);
|
||||
if (ret < 0)
|
||||
{
|
||||
LOG_ERR("Could not get temperature (%d)", ret);
|
||||
@ -182,7 +195,7 @@ int main(void)
|
||||
sprintf(str_t, "T:%03d.%04d", temperature.val1, temperature.val2 / 100);
|
||||
sprintf(str_h, "H:%05d.%06d", humidity.val1, humidity.val2);
|
||||
|
||||
printf("%s\t%s\t%s\t%s\n", str_v, str_i, str_p, str_t);
|
||||
// printf("%s\t%s\t%s\t%s\n", str_v, str_i, str_p, str_t);
|
||||
|
||||
cfb_framebuffer_clear(dev, false);
|
||||
if (cfb_print(dev, str_v, 0, 0))
|
||||
|
Reference in New Issue
Block a user