diff --git a/src/boards/Parafoil/Configs/SensorsConfig.h b/src/boards/Parafoil/Configs/SensorsConfig.h index fbc26d23680f7eb51f2a2f27d5bdde7ab2e98d65..105e3aef60851ac52820dab025302ecd6a3a20df 100644 --- a/src/boards/Parafoil/Configs/SensorsConfig.h +++ b/src/boards/Parafoil/Configs/SensorsConfig.h @@ -45,10 +45,10 @@ constexpr Boardcore::BMX160Config::GyroscopeRange BMX160_GYRO_FSR_ENUM = Boardcore::BMX160Config::GyroscopeRange::DEG_1000; constexpr unsigned int BMX160_ACC_GYRO_ODR = 400; constexpr Boardcore::BMX160Config::OutputDataRate BMX160_ACC_GYRO_ODR_ENUM = - Boardcore::BMX160Config::OutputDataRate::HZ_400; + Boardcore::BMX160Config::OutputDataRate::HZ_200; constexpr unsigned int BMX160_MAG_ODR = 100; constexpr Boardcore::BMX160Config::OutputDataRate BMX160_MAG_ODR_ENUM = - Boardcore::BMX160Config::OutputDataRate::HZ_100; + Boardcore::BMX160Config::OutputDataRate::HZ_200; constexpr unsigned int BMX160_TEMP_DIVIDER = 1000; @@ -117,8 +117,8 @@ constexpr float BATTERY_VOLTAGE_COEFF = (150 + 40.2) / 40.2; // BMX160_SAMPLE_PERIOD: Sample before the fifo is full, but slightly after the // watermark level (watermark + 30) ---> high slack due to scheduler // imprecision, avoid clearing the fifo before the interrupt -constexpr unsigned int BMX160_SAMPLE_PERIOD = - BMX160_FIFO_FILL_TIME * (BMX160_FIFO_WATERMARK + 30) * 4 / 1024; // [ms] +constexpr unsigned int BMX160_SAMPLE_PERIOD = 10; +// BMX160_FIFO_FILL_TIME * (BMX160_FIFO_WATERMARK + 30) * 4 / 1024; // [ms] // BMX160_WITH_CORRECTION_SAMPLE_PERIOD should be lower than the // BMX160_SAMPLE_PERIOD and faster then the NAS update period. constexpr unsigned int BMX160_WITH_CORRECTION_SAMPLE_PERIOD = 10; // [ms] 100Hz diff --git a/src/boards/Parafoil/Sensors/Sensors.cpp b/src/boards/Parafoil/Sensors/Sensors.cpp index a6a3b393bcb263ffb89925c40d220b9d56ac748b..a9d3e9b7cbd3b9e44e13bc6a30dce952a4136161 100644 --- a/src/boards/Parafoil/Sensors/Sensors.cpp +++ b/src/boards/Parafoil/Sensors/Sensors.cpp @@ -1,5 +1,5 @@ /* Copyright (c) 2024 Skyward Experimental Rocketry - * Author: Matteo Pignataro, Angelo Prete + * Authors: Matteo Pignataro, Angelo Prete * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -166,10 +166,10 @@ bool Sensors::start() MAG_CALIBRATION_PERIOD); // Create sensor manager with populated map and configured scheduler - manager = new SensorManager(sensorMap, scheduler); - miosix::GpioPin interruptPin = miosix::sensors::bmx160::intr::getPin(); - enableExternalInterrupt(interruptPin.getPort(), interruptPin.getNumber(), - InterruptTrigger::FALLING_EDGE, 0); + manager = new SensorManager(sensorMap, scheduler); + // miosix::GpioPin interruptPin = miosix::sensors::bmx160::intr::getPin(); + // enableExternalInterrupt(interruptPin.getPort(), interruptPin.getNumber(), + // InterruptTrigger::FALLING_EDGE, 0); return manager->start() && result != 0; } @@ -207,10 +207,10 @@ void Sensors::bmx160Init() ModuleManager& modules = ModuleManager::getInstance(); SPIBusConfig spiConfig; - spiConfig.clockDivider = SPI::ClockDivider::DIV_8; + spiConfig.clockDivider = SPI::ClockDivider::DIV_4; BMX160Config config; - config.fifoMode = BMX160Config::FifoMode::HEADER; + config.fifoMode = BMX160Config::FifoMode::DISABLED; config.fifoWatermark = BMX160_FIFO_WATERMARK; config.fifoInterrupt = BMX160Config::FifoInterruptPin::PIN_INT1;