This commit is contained in:
2024-05-15 22:46:45 -06:00
parent aabd624df9
commit 1c2b904160
2 changed files with 224 additions and 87 deletions

View File

@ -91,7 +91,7 @@ int main(void)
uint8_t ppt;
uint8_t font_width;
uint8_t font_height;
struct sensor_value voltage, current, pressure, temperature, accel_x, accel_y, accel_z, accel_z_ref, humidity;
struct sensor_value voltage, current, pressure, temperature, accel_x, accel_y, accel_z, accel_z_ref, gyro_x, gyro_y, gyro_z, humidity;
char str_v[15] = {0};
char str_i[15] = {0};
@ -101,6 +101,9 @@ int main(void)
char str_ay[16] = {0};
char str_az[16] = {0};
char str_az_ref[16] = {0};
char str_gx[16] = {0};
char str_gy[16] = {0};
char str_gz[16] = {0};
char str_h[16] = {0};
LOG_INF("Starting Mellifera version %s...", APP_VERSION_STRING);
@ -227,10 +230,10 @@ int main(void)
{
LOG_ERR("Could not get pressure");
}
// if (sensor_channel_get(baro, SENSOR_CHAN_AMBIENT_TEMP, &temperature) < 0)
// {
// LOG_ERR("Could not get temperature");
// }
if (sensor_channel_get(baro, SENSOR_CHAN_AMBIENT_TEMP, &temperature) < 0)
{
LOG_ERR("Could not get temperature");
}
if (sensor_sample_fetch(imu) < 0)
{
@ -252,6 +255,18 @@ int main(void)
{
LOG_ERR("Could not get acceleration");
}
if (sensor_channel_get(imu, SENSOR_CHAN_GYRO_X, &gyro_x) < 0)
{
LOG_ERR("Could not get gyro");
}
if (sensor_channel_get(imu, SENSOR_CHAN_GYRO_Y, &gyro_y) < 0)
{
LOG_ERR("Could not get gyro");
}
if (sensor_channel_get(imu, SENSOR_CHAN_GYRO_Z, &gyro_z) < 0)
{
LOG_ERR("Could not get gyro");
}
if (sensor_sample_fetch(lis) < 0)
{
@ -279,31 +294,34 @@ int main(void)
sprintf(str_i, "I :%7.5f", current.val1 + current.val2 * 1e-6);
sprintf(str_p, "P :%7.4f", pressure.val1 + pressure.val2 * 1e-6);
sprintf(str_t, "T :%7.4f", temperature.val1 + temperature.val2 * 1e-6);
sprintf(str_ax, "X :%+7.3f", accel_x.val1 + accel_x.val2 * 1e-6);
sprintf(str_ay, "Y :%+7.3f", accel_y.val1 + accel_y.val2 * 1e-6);
sprintf(str_az, "Z :%+7.3f", accel_z.val1 + accel_z.val2 * 1e-6);
sprintf(str_ax, "AX:%+7.3f", accel_x.val1 + accel_x.val2 * 1e-6);
sprintf(str_ay, "AY:%+7.3f", accel_y.val1 + accel_y.val2 * 1e-6);
sprintf(str_az, "AZ:%+7.3f", accel_z.val1 + accel_z.val2 * 1e-6);
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_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_t, 0, 0))
if (cfb_print(display, str_gx, 0, 0))
{
LOG_ERR("Failed to print a string");
}
if (cfb_print(display, str_h, 0, 16))
if (cfb_print(display, str_gy, 0, 16))
{
LOG_ERR("Failed to print a string");
}
if (cfb_print(display, str_gz, 0, 16 * 2))
{
LOG_ERR("Failed to print a string");
}
if (cfb_print(display, str_ax, 0, 16 * 3))
{
LOG_ERR("Failed to print a string");
}
// if (cfb_print(display, str_az, 0, 16 * 2))
// {
// LOG_ERR("Failed to print a string");
// }
// if (cfb_print(display, str_az_ref, 0, 16 * 3))
// {
// LOG_ERR("Failed to print a string");
// }
cfb_framebuffer_finalize(display);
#if defined(CONFIG_ARCH_POSIX)