2026-03-18 21:43:28 +00:00
|
|
|
#include "esp_log.h"
|
2026-03-16 14:25:49 +00:00
|
|
|
#include "esp_timer.h"
|
2026-03-18 15:49:09 +00:00
|
|
|
#include <cmath>
|
2026-03-16 14:25:49 +00:00
|
|
|
#include <cstdint>
|
|
|
|
|
#include <stdio.h>
|
2026-03-16 00:49:02 +00:00
|
|
|
|
2026-03-18 21:43:28 +00:00
|
|
|
#include "env_sens.h"
|
|
|
|
|
#include "freertos/idf_additions.h"
|
|
|
|
|
#include "imu.h"
|
2026-03-16 00:49:02 +00:00
|
|
|
|
2026-03-18 21:43:28 +00:00
|
|
|
static const constexpr char *TAG = "Main";
|
2026-03-18 15:49:09 +00:00
|
|
|
|
2026-03-16 14:25:49 +00:00
|
|
|
extern "C" void app_main(void) {
|
2026-03-18 21:43:28 +00:00
|
|
|
env_sens::setup();
|
2026-03-16 00:49:02 +00:00
|
|
|
|
2026-03-18 21:43:28 +00:00
|
|
|
imu_state imu_state;
|
|
|
|
|
BNO08x *imu = setup_imu(&imu_state);
|
|
|
|
|
if (imu == nullptr) {
|
|
|
|
|
ESP_LOGE(TAG, "IMU setup failed.");
|
2026-03-16 14:25:49 +00:00
|
|
|
return;
|
|
|
|
|
}
|
2026-03-16 00:49:02 +00:00
|
|
|
|
2026-03-18 21:43:28 +00:00
|
|
|
ESP_LOGE(TAG, "IMU setup sucess.");
|
2026-03-16 14:25:49 +00:00
|
|
|
|
|
|
|
|
while (1) {
|
2026-03-18 21:43:28 +00:00
|
|
|
vTaskDelay(pdMS_TO_TICKS(300));
|
|
|
|
|
if (xSemaphoreTake(imuStateMutex, pdMS_TO_TICKS(5)) == pdTRUE) {
|
|
|
|
|
ESP_LOGI(TAG, "accel - %f, %f, %f", imu_state.accel.x, imu_state.accel.y,
|
|
|
|
|
imu_state.accel.z);
|
|
|
|
|
ESP_LOGI(TAG, "; euler - %f, %f, %f\n", imu_state.euler_ang.x,
|
|
|
|
|
imu_state.euler_ang.y, imu_state.euler_ang.z);
|
|
|
|
|
xSemaphoreGive(imuStateMutex);
|
|
|
|
|
}
|
|
|
|
|
env_sens::dbg_sens();
|
2026-03-16 00:49:02 +00:00
|
|
|
}
|
|
|
|
|
}
|