From 01679d6da73e1778161c07abde6e713ea4eb8c9b Mon Sep 17 00:00:00 2001 From: sfja Date: Wed, 1 Apr 2026 09:15:05 +0200 Subject: [PATCH] remove esp-idf-lib/mpu6050 --- skateboard/dependencies.lock | 69 +---------------------------- skateboard/main/CMakeLists.txt | 2 +- skateboard/main/app_mpu.c | 72 ------------------------------- skateboard/main/app_mpu.h | 18 -------- skateboard/main/idf_component.yml | 14 ------ 5 files changed, 2 insertions(+), 173 deletions(-) delete mode 100644 skateboard/main/app_mpu.c delete mode 100644 skateboard/main/app_mpu.h diff --git a/skateboard/dependencies.lock b/skateboard/dependencies.lock index 469c011..5e92dec 100644 --- a/skateboard/dependencies.lock +++ b/skateboard/dependencies.lock @@ -1,77 +1,10 @@ dependencies: - esp-idf-lib/esp_idf_lib_helpers: - component_hash: 689853bb8993434f9556af0f2816e808bf77b5d22100144b21f3519993daf237 - dependencies: [] - source: - registry_url: https://components.espressif.com - type: service - targets: - - esp32 - - esp32c2 - - esp32c3 - - esp32c5 - - esp32c6 - - esp32c61 - - esp32h2 - - esp32p4 - - esp32s2 - - esp32s3 - version: 1.4.0 - esp-idf-lib/i2cdev: - component_hash: 9e22a91420695242ceac2c00788820ae45826224d38ef003a1a894367c55ede4 - dependencies: - - name: esp-idf-lib/esp_idf_lib_helpers - registry_url: https://components.espressif.com - require: private - version: '*' - source: - registry_url: https://components.espressif.com - type: service - targets: - - esp32 - - esp32c2 - - esp32c3 - - esp32c5 - - esp32c6 - - esp32c61 - - esp32h2 - - esp32p4 - - esp32s2 - - esp32s3 - version: 2.1.1 - esp-idf-lib/mpu6050: - component_hash: 2d4c6db42322162aeadded002cb811028f05115d969e143bad6470822cc75a8a - dependencies: - - name: esp-idf-lib/esp_idf_lib_helpers - registry_url: https://components.espressif.com - require: private - version: '*' - - name: esp-idf-lib/i2cdev - registry_url: https://components.espressif.com - require: private - version: '*' - source: - registry_url: https://components.espressif.com/ - type: service - targets: - - esp32 - - esp32c2 - - esp32c3 - - esp32c5 - - esp32c6 - - esp32c61 - - esp32h2 - - esp32p4 - - esp32s2 - - esp32s3 - version: 2.1.9 idf: source: type: idf version: 5.5.3 direct_dependencies: -- esp-idf-lib/mpu6050 - idf -manifest_hash: 555befbc35f7160bcfad0b8961e2bbca4bfb6b90242eecc7749fe036d221aa41 +manifest_hash: e44bf68eca6b7b264ddae08cd014cd3294c0473230381b6d6f88ed18ec879038 target: esp32s3 version: 2.0.0 diff --git a/skateboard/main/CMakeLists.txt b/skateboard/main/CMakeLists.txt index 98dc0de..0d857d1 100644 --- a/skateboard/main/CMakeLists.txt +++ b/skateboard/main/CMakeLists.txt @@ -1,5 +1,5 @@ idf_component_register( - SRCS skateboard.c app_wifi.c app_mpu.c app_mqtt.c new_mpu6050.c + SRCS skateboard.c app_wifi.c app_mqtt.c new_mpu6050.c PRIV_REQUIRES nvs_flash esp_netif esp_wifi mqtt esp_driver_i2c esp_timer INCLUDE_DIRS ".") diff --git a/skateboard/main/app_mpu.c b/skateboard/main/app_mpu.c deleted file mode 100644 index 5797026..0000000 --- a/skateboard/main/app_mpu.c +++ /dev/null @@ -1,72 +0,0 @@ -#include "app_mpu.h" -#include "esp_log.h" -#include "mpu6050.h" - -extern const char* TAG; - -#ifdef CONFIG_MPU6050_I2C_ADDRESS_LOW -#define MPU6050_I2C_ADDRESS MPU6050_I2C_ADDRESS_LOW -#else -#define MPU6050_I2C_ADDRESS MPU6050_I2C_ADDRESS_HIGH -#endif - -#define MPU6050_SDA_GPIO CONFIG_MPU6050_SDA_GPIO -#define MPU6050_SCL_GPIO CONFIG_MPU6050_SCL_GPIO - -void app_mpu_init(AppMpu* mpu) -{ - ESP_ERROR_CHECK(i2cdev_init()); - - ESP_ERROR_CHECK(mpu6050_init_desc( - &mpu->dev, MPU6050_I2C_ADDRESS, 0, MPU6050_SDA_GPIO, MPU6050_SCL_GPIO)); - ESP_LOGI(TAG, - "Initializing MPU6050 device. Address: 0x%02x, SDA %d, SCL: %d", - MPU6050_I2C_ADDRESS, - MPU6050_SDA_GPIO, - MPU6050_SCL_GPIO); - - int retries = 0; - while (true) { - esp_err_t res = i2c_dev_probe(&mpu->dev.i2c_dev, I2C_DEV_WRITE); - if (res == ESP_OK) { - ESP_LOGI(TAG, "Found MPU6050 device"); - break; - } - if (retries >= 5) { - ESP_ERROR_CHECK(res); - } - ESP_LOGE(TAG, "MPU6050 not found. Retrying (%d/%d)", retries + 1, 5); - retries += 1; - vTaskDelay(pdMS_TO_TICKS(1000)); - } - - ESP_ERROR_CHECK(mpu6050_init(&mpu->dev)); - ESP_ERROR_CHECK(mpu6050_set_rate(&mpu->dev, 7)); -} - -void app_mpu_read_acceleration(AppMpu* mpu, float3* out_accel) -{ - mpu6050_acceleration_t acceleration = { 0 }; - - ESP_ERROR_CHECK(mpu6050_get_acceleration(&mpu->dev, &acceleration)); - - out_accel->x = acceleration.x; - out_accel->y = acceleration.y; - out_accel->z = acceleration.z; -} - -void app_mpu_read_rotation(AppMpu* mpu, float3* out_rotation) -{ - mpu6050_rotation_t rotation = { 0 }; - - ESP_ERROR_CHECK(mpu6050_get_rotation(&mpu->dev, &rotation)); - - out_rotation->x = rotation.x; - out_rotation->y = rotation.y; - out_rotation->z = rotation.z; -} - -void app_mpu_read_temperature(AppMpu* mpu, float* degree_celsius) -{ - ESP_ERROR_CHECK(mpu6050_get_temperature(&mpu->dev, degree_celsius)); -} diff --git a/skateboard/main/app_mpu.h b/skateboard/main/app_mpu.h deleted file mode 100644 index 751423e..0000000 --- a/skateboard/main/app_mpu.h +++ /dev/null @@ -1,18 +0,0 @@ -#pragma once - -#include "mpu6050.h" - -typedef struct float3 { - float x; - float y; - float z; -} float3; - -typedef struct AppMpu { - mpu6050_dev_t dev; -} AppMpu; - -void app_mpu_init(AppMpu* mpu); -void app_mpu_read_acceleration(AppMpu* mpu, float3* out_accel); -void app_mpu_read_rotation(AppMpu* mpu, float3* out_rotation); -void app_mpu_read_temperature(AppMpu* mpu, float* degree_celsius); diff --git a/skateboard/main/idf_component.yml b/skateboard/main/idf_component.yml index 97b2d96..b83c8a2 100644 --- a/skateboard/main/idf_component.yml +++ b/skateboard/main/idf_component.yml @@ -1,17 +1,3 @@ -## IDF Component Manager Manifest File dependencies: - ## Required IDF version idf: version: '>=4.1.0' - # # Put list of dependencies here - # # For components maintained by Espressif: - # component: "~1.0.0" - # # For 3rd party components: - # username/component: ">=1.0.0,<2.0.0" - # username2/component2: - # version: "~1.0.0" - # # For transient dependencies `public` flag can be set. - # # `public` flag doesn't have an effect dependencies of the `main` component. - # # All dependencies of `main` are public by default. - # public: true - esp-idf-lib/mpu6050: '*'