acceleration isn't quite working yet
Some checks failed
Some checks failed
This commit is contained in:
@ -118,11 +118,12 @@ int main(void)
|
||||
while (1)
|
||||
{
|
||||
int ret;
|
||||
struct sensor_value voltage, current, pressure, temperature, humidity;
|
||||
struct sensor_value voltage, current, pressure, temperature, accel_x, humidity;
|
||||
char str_v[15] = {0};
|
||||
char str_i[15] = {0};
|
||||
char str_p[16] = {0};
|
||||
char str_t[16] = {0};
|
||||
char str_ax[16] = {0};
|
||||
char str_h[16] = {0};
|
||||
|
||||
ret = sensor_sample_fetch(ina);
|
||||
@ -175,6 +176,12 @@ int main(void)
|
||||
LOG_ERR("Could not get temperature (%d)", ret);
|
||||
return 0;
|
||||
}
|
||||
ret = sensor_channel_get(bmx, SENSOR_CHAN_ACCEL_X, &accel_x);
|
||||
if (ret < 0)
|
||||
{
|
||||
LOG_ERR("Could not get acceleration (%d)", ret);
|
||||
return 0;
|
||||
}
|
||||
|
||||
// ret = sensor_sample_fetch(hdc);
|
||||
// if (ret < 0)
|
||||
@ -193,6 +200,7 @@ int main(void)
|
||||
sprintf(str_i, "I:%01d.%06d", current.val1, current.val2);
|
||||
sprintf(str_p, "P:%03d.%04d", pressure.val1, pressure.val2 / 100);
|
||||
sprintf(str_t, "T:%03d.%04d", temperature.val1, temperature.val2 / 100);
|
||||
sprintf(str_ax, "X:%03d.%04d", accel_x.val1, accel_x.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);
|
||||
@ -208,7 +216,7 @@ int main(void)
|
||||
printf("Failed to print a string\n");
|
||||
continue;
|
||||
}
|
||||
if (cfb_print(dev, str_p, 0, 16 * 2))
|
||||
if (cfb_print(dev, str_ax, 0, 16 * 2))
|
||||
{
|
||||
printf("Failed to print a string\n");
|
||||
continue;
|
||||
|
Reference in New Issue
Block a user