Add optional BMA456 accelerometer init on shared I2C bus.

Probe and configure the sensor when present; log and continue boot if
init fails so boards without BMA456 still run normally.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-05-18 22:51:32 +02:00
co-authored by Cursor
parent 755bdd92d7
commit e5db0b21c7
168 changed files with 42062 additions and 2 deletions
+10 -1
View File
@@ -13,6 +13,7 @@
#include "esp_ota_ops.h"
#include "freertos/FreeRTOS.h"
#include "freertos/idf_additions.h"
#include "bosch456.h"
#include "led_ring.h"
#include "uart.h"
#include <stdint.h>
@@ -76,7 +77,8 @@ void app_main(void) {
err = i2c_new_master_bus(&i2c_mst_config, &bus_handle);
if (err != ESP_OK) {
ESP_LOGI(TAG, "I2C Master Could not Init Bus");
ESP_LOGI(TAG, "I2C master bus init failed: %s", esp_err_to_name(err));
bus_handle = NULL;
}
i2c_device_config_t dev_cfg = {
@@ -110,6 +112,13 @@ void app_main(void) {
1; // map network to 0-8, 0 is not a valid network
}
if (bus_handle != NULL) {
esp_err_t bma_err = init_bma456(bus_handle);
if (bma_err != ESP_OK) {
ESP_LOGI(TAG, "BMA456 init skipped: %s", esp_err_to_name(bma_err));
}
}
const esp_partition_t *running = esp_ota_get_running_partition();
app_config.master = (master != 0);