disable magnetometer because it isn't initializing properly
This commit is contained in:
@ -79,7 +79,7 @@ LOG_MODULE_REGISTER(main, CONFIG_APP_LOG_LEVEL);
|
||||
int main(void)
|
||||
{
|
||||
const struct device *display, *ina, *baro, *accel, *gyro, *mag, *lis, *hdc;
|
||||
int err;
|
||||
// int err;
|
||||
uint16_t x_res;
|
||||
uint16_t y_res;
|
||||
uint16_t rows;
|
||||
@ -168,12 +168,20 @@ int main(void)
|
||||
|
||||
cfb_set_kerning(display, 3);
|
||||
|
||||
cfb_framebuffer_clear(display, false);
|
||||
if (cfb_print(display, "DISPLAY INITIALIZED", 0, 0))
|
||||
{
|
||||
LOG_ERR("Failed to print a string");
|
||||
}
|
||||
cfb_framebuffer_finalize(display);
|
||||
|
||||
ina = DEVICE_DT_GET(DT_NODELABEL(ina231));
|
||||
if (!device_is_ready(ina))
|
||||
{
|
||||
LOG_ERR("Device %s not ready", ina->name);
|
||||
return 0;
|
||||
}
|
||||
LOG_INF("Initialized %s", ina->name);
|
||||
|
||||
baro = DEVICE_DT_GET(DT_NODELABEL(bmp388));
|
||||
if (!device_is_ready(baro))
|
||||
@ -181,6 +189,7 @@ int main(void)
|
||||
LOG_ERR("Device %s not ready", baro->name);
|
||||
return 0;
|
||||
}
|
||||
LOG_INF("Initialized %s", baro->name);
|
||||
|
||||
accel = DEVICE_DT_GET(DT_NODELABEL(bmx055_accel));
|
||||
if (!device_is_ready(accel))
|
||||
@ -198,13 +207,13 @@ int main(void)
|
||||
}
|
||||
LOG_INF("Initialized %s", gyro->name);
|
||||
|
||||
mag = DEVICE_DT_GET(DT_NODELABEL(bmx055_mag));
|
||||
if (!device_is_ready(mag))
|
||||
{
|
||||
LOG_ERR("Device %s not ready", mag->name);
|
||||
return 0;
|
||||
}
|
||||
LOG_INF("Initialized %s", mag->name);
|
||||
// mag = DEVICE_DT_GET(DT_NODELABEL(bmx055_mag));
|
||||
// if (!device_is_ready(mag))
|
||||
// {
|
||||
// LOG_ERR("Device %s not ready", mag->name);
|
||||
// return 0;
|
||||
// }
|
||||
// LOG_INF("Initialized %s", mag->name);
|
||||
|
||||
lis = DEVICE_DT_GET(DT_NODELABEL(lis2dh));
|
||||
if (!device_is_ready(lis))
|
||||
@ -220,6 +229,7 @@ int main(void)
|
||||
LOG_ERR("Device %s not ready", hdc->name);
|
||||
return 0;
|
||||
}
|
||||
LOG_INF("Initialized %s", hdc->name);
|
||||
|
||||
while (1)
|
||||
{
|
||||
@ -283,22 +293,22 @@ int main(void)
|
||||
LOG_ERR("Could not get gyro");
|
||||
}
|
||||
|
||||
if (sensor_sample_fetch(mag) < 0)
|
||||
{
|
||||
LOG_ERR("Could not fetch sample from mag");
|
||||
}
|
||||
if (sensor_channel_get(mag, SENSOR_CHAN_MAGN_X, &mag_x) < 0)
|
||||
{
|
||||
LOG_ERR("Could not get mag");
|
||||
}
|
||||
if (sensor_channel_get(mag, SENSOR_CHAN_MAGN_Y, &mag_y) < 0)
|
||||
{
|
||||
LOG_ERR("Could not get mag");
|
||||
}
|
||||
if (sensor_channel_get(mag, SENSOR_CHAN_MAGN_Z, &mag_z) < 0)
|
||||
{
|
||||
LOG_ERR("Could not get mag");
|
||||
}
|
||||
// if (sensor_sample_fetch(mag) < 0)
|
||||
// {
|
||||
// LOG_ERR("Could not fetch sample from mag");
|
||||
// }
|
||||
// if (sensor_channel_get(mag, SENSOR_CHAN_MAGN_X, &mag_x) < 0)
|
||||
// {
|
||||
// LOG_ERR("Could not get mag");
|
||||
// }
|
||||
// if (sensor_channel_get(mag, SENSOR_CHAN_MAGN_Y, &mag_y) < 0)
|
||||
// {
|
||||
// LOG_ERR("Could not get mag");
|
||||
// }
|
||||
// if (sensor_channel_get(mag, SENSOR_CHAN_MAGN_Z, &mag_z) < 0)
|
||||
// {
|
||||
// LOG_ERR("Could not get mag");
|
||||
// }
|
||||
|
||||
if (sensor_sample_fetch(lis) < 0)
|
||||
{
|
||||
@ -332,16 +342,16 @@ int main(void)
|
||||
sprintf(str_gx, "GX:%+7.3f", gyro_x.val1 + gyro_x.val2 * 1e-6);
|
||||
sprintf(str_gy, "GY:%+7.3f", gyro_y.val1 + gyro_y.val2 * 1e-6);
|
||||
sprintf(str_gz, "GZ:%+7.3f", gyro_z.val1 + gyro_z.val2 * 1e-6);
|
||||
sprintf(str_mx, "MX:%+7.3f", mag_x.val1 + mag_x.val2 * 1e-6);
|
||||
sprintf(str_my, "MY:%+7.3f", mag_y.val1 + mag_y.val2 * 1e-6);
|
||||
sprintf(str_mz, "MZ:%+7.3f", mag_z.val1 + mag_z.val2 * 1e-6);
|
||||
// sprintf(str_mx, "MX:%+7.3f", mag_x.val1 + mag_x.val2 * 1e-6);
|
||||
// sprintf(str_my, "MY:%+7.3f", mag_y.val1 + mag_y.val2 * 1e-6);
|
||||
// sprintf(str_mz, "MZ:%+7.3f", mag_z.val1 + mag_z.val2 * 1e-6);
|
||||
sprintf(str_az_ref, "Zr:%+7.3f", accel_z_ref.val1 + accel_z_ref.val2 * 1e-6);
|
||||
sprintf(str_h, "H :%7.3f", humidity.val1 + humidity.val2 * 1e-6);
|
||||
|
||||
// LOG_INF("%s\t%s\t%s\t%s", str_v, str_i, str_p, str_t);
|
||||
|
||||
cfb_framebuffer_clear(display, false);
|
||||
if (cfb_print(display, str_mx, 0, 0))
|
||||
if (cfb_print(display, str_ay, 0, 0))
|
||||
{
|
||||
LOG_ERR("Failed to print a string");
|
||||
}
|
||||
|
Reference in New Issue
Block a user