successfully reading temperature from BMX
Some checks failed
Build / build (macos-12) (push) Waiting to run
Build / build (macos-14) (push) Waiting to run
Build / build (windows-2022) (push) Waiting to run
Build / build (ubuntu-22.04) (push) Failing after 17s
Documentation / build (push) Successful in 4s

This commit is contained in:
2024-04-27 23:37:30 -06:00
parent d9acd6b2a8
commit 0aae853cf7
2 changed files with 96 additions and 38 deletions

View File

@ -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))