1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2025-01-29 14:52:12 +01:00

CC-9 1. Improve the timings of the attitude estimation

2. Disable FirmareIAP module in CC (somehow causes lockups when also using vTaskDelayUntil in Attitude WTF)
3. Make the SPI bus run a little faster so we can handle the 3200 Hz from accel
while running the filter at 333 Hz

git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@2664 ebee16cc-31ac-478f-84a7-5cbb03baadba
This commit is contained in:
peabody124 2011-02-01 02:18:19 +00:00 committed by peabody124
parent 8b2034ea05
commit 3f088bed8d
3 changed files with 10 additions and 17 deletions

View File

@ -57,14 +57,7 @@ FLASH_TOOL = OPENOCD
USE_THUMB_MODE = YES
# List of modules to include
MODULES = Telemetry ManualControl Actuator Attitude Stabilization FirmwareIAP
#Actuator Telemetry ManualControl Stabilization FirmwareIAP
#MODULES = Telemetry Example
#MODULES = Telemetry MK/MKSerial
#MODULES = Telemetry
#MODULES += Osd/OsdEtStd
MODULES = Telemetry Attitude Stabilization Actuator ManualControl #FirmwareIAP
# MCU name, submodel and board
# - MCU used for compiler-option (-mcpu)

View File

@ -107,7 +107,7 @@ const struct pios_spi_cfg pios_spi_flash_accel_cfg = {
.SPI_CRCPolynomial = 7,
.SPI_CPOL = SPI_CPOL_High,
.SPI_CPHA = SPI_CPHA_2Edge,
.SPI_BaudRatePrescaler = SPI_BaudRatePrescaler_16,
.SPI_BaudRatePrescaler = SPI_BaudRatePrescaler_8,
},
.use_crc = FALSE,
.dma = {

View File

@ -58,10 +58,10 @@
#include "pios_flash_w25x.h"
// Private constants
#define STACK_SIZE_BYTES 740
#define TASK_PRIORITY (tskIDLE_PRIORITY+0)
#define STACK_SIZE_BYTES 440
#define TASK_PRIORITY (tskIDLE_PRIORITY+3)
#define UPDATE_RATE 2 /* ms */
#define UPDATE_RATE 3
#define GYRO_NEUTRAL 1665
#define GYRO_SCALE (0.008f * 180 / M_PI)
@ -92,7 +92,7 @@ int32_t AttitudeInitialize(void)
PIOS_WDG_RegisterFlag(PIOS_WDG_ATTITUDE);
return 0;
}
static portTickType lastSysTime;
/**
* Module thread, should not return.
*/
@ -109,7 +109,7 @@ static void AttitudeTask(void *parameters)
// Main task loop
while (1) {
//portTickType lastSysTime;
//
PIOS_WDG_UpdateFlag(PIOS_WDG_ATTITUDE);
// TODO: register the adc callback, push the data onto a queue (safe for thread)
@ -118,8 +118,8 @@ static void AttitudeTask(void *parameters)
updateAttitude();
/* Wait for the next update interval */
//vTaskDelayUntil(&lastSysTime, UPDATE_RATE / portTICK_RATE_MS);
vTaskDelay(UPDATE_RATE / portTICK_RATE_MS);
vTaskDelayUntil(&lastSysTime, UPDATE_RATE / portTICK_RATE_MS);
//vTaskDelay(UPDATE_RATE / portTICK_RATE_MS);
}
}
@ -172,7 +172,7 @@ void updateSensors()
AttitudeRawSet(&attitudeRaw);
}
#define UPDATE_FRAC 0.99f
#define UPDATE_FRAC 0.999f
void updateAttitude()
{
AttitudeActualData attitudeActual;