Skip to content

Commit 82b1cde

Browse files
committed
more debugging
1 parent 7d48d3c commit 82b1cde

File tree

2 files changed

+15
-11
lines changed

2 files changed

+15
-11
lines changed

main/imu/imu_icm20948_driver.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,7 @@ biodyn_imu_err_t biodyn_imu_icm20948_init()
302302
if (err != ESP_OK)
303303
{
304304
biodyn_imu_icm20948_add_error_to_subsystem(err, "ICM_20948_INIT: error in completing self-test. Further investigation into self-test part functions likely required.");
305-
ESP_LOGE(TAG, "Failed to initialize and start AK09916 (magnetometer) device, error %d", err);
305+
ESP_LOGE(TAG, "Failed self_test for icm20948, investiage into composite function parts of self_test, error: %d", err);
306306
return BIODYN_IMU_ERR_COULDNT_INIT_SPI_DEV;
307307
}
308308
// TODO: write self_tests for magnetometer
@@ -831,6 +831,8 @@ biodyn_imu_err_t biodyn_imu_icm20948_self_test()
831831
ESP_LOGE(TAG, "Self test failed - whoami (%x)", err);
832832
return err;
833833
}
834+
ESP_LOGI(TAG, "Correct WHOAMI");
835+
834836
// Check that user bank selection works
835837
if ((err = self_test_user_banks()))
836838
{

main/main.c

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
// void test_all_registers_imu_icm20948();
2525
// void test_accel_gyro_imu_icm20948();
2626
void test_imu_icm20948();
27+
void test_accel_gyro_mag_imu_icm20948();
2728

2829
// APP ENTRY POINT
2930
void app_main(void)
@@ -70,7 +71,8 @@ void app_main(void)
7071
// test_accel_imu_icm20948();
7172
// test_accel_gyro_imu_icm20948();
7273

73-
test_imu_icm20948();
74+
// test_imu_icm20948();
75+
test_accel_gyro_mag_imu_icm20948();
7476
}
7577

7678
void test_imu_icm20948()
@@ -142,15 +144,15 @@ void test_accel_gyro_mag_imu_icm20948()
142144
for (int i = 0; i < 2000; ++i)
143145
{
144146
biodyn_imu_icm20948_read_accel_gyro_mag(&data);
145-
ESP_LOGI(MAIN_TAG, "ACCEL X: %.3f %s", data.accel_x, IMU_ACCEL_UNIT);
146-
ESP_LOGI(MAIN_TAG, "ACCEL Y: %.3f %s", data.accel_y, IMU_ACCEL_UNIT);
147-
ESP_LOGI(MAIN_TAG, "ACCEL Z: %.3f %s", data.accel_z, IMU_ACCEL_UNIT);
148-
ESP_LOGI(MAIN_TAG, "GYRO X: %.3f %s", data.gyro_x, IMU_GYRO_UNIT);
149-
ESP_LOGI(MAIN_TAG, "GYRO Y: %.3f %s", data.gyro_y, IMU_GYRO_UNIT);
150-
ESP_LOGI(MAIN_TAG, "GYRO Z: %.3f %s", data.gyro_z, IMU_GYRO_UNIT);
151-
ESP_LOGI(MAIN_TAG, "MAG X: %.3f %s", data.mag_x, IMU_MAG_UNIT);
152-
ESP_LOGI(MAIN_TAG, "MAG Y: %.3f %s", data.mag_y, IMU_MAG_UNIT);
153-
ESP_LOGI(MAIN_TAG, "MAG Z: %.3f %s", data.mag_z, IMU_MAG_UNIT);
147+
ESP_LOGI(MAIN_TAG, "ACCEL X: %.6f %s", data.accel_x, IMU_ACCEL_UNIT);
148+
ESP_LOGI(MAIN_TAG, "ACCEL Y: %.6f %s", data.accel_y, IMU_ACCEL_UNIT);
149+
ESP_LOGI(MAIN_TAG, "ACCEL Z: %.6f %s", data.accel_z, IMU_ACCEL_UNIT);
150+
ESP_LOGI(MAIN_TAG, "GYRO X: %.6f %s", data.gyro_x, IMU_GYRO_UNIT);
151+
ESP_LOGI(MAIN_TAG, "GYRO Y: %.6f %s", data.gyro_y, IMU_GYRO_UNIT);
152+
ESP_LOGI(MAIN_TAG, "GYRO Z: %.6f %s", data.gyro_z, IMU_GYRO_UNIT);
153+
ESP_LOGI(MAIN_TAG, "MAG X: %.6f %s", data.mag_x, IMU_MAG_UNIT);
154+
ESP_LOGI(MAIN_TAG, "MAG Y: %.6f %s", data.mag_y, IMU_MAG_UNIT);
155+
ESP_LOGI(MAIN_TAG, "MAG Z: %.6f %s", data.mag_z, IMU_MAG_UNIT);
154156
vTaskDelay(pdMS_TO_TICKS(100)); // Sleep for 100 ms (0.1 second)
155157
}
156158
}

0 commit comments

Comments
 (0)