/branches/dongfang_FC_rewrite/analog.c |
---|
476,8 → 476,6 |
// Even if the sample is off-range, use it. |
simpleAirPressure = getSimplePressure(rawAirPressure); |
// debugOut.analog[6] = rawAirPressure; |
// debugOut.analog[7] = simpleAirPressure; |
if (simpleAirPressure < MIN_RANGES_EXTRAPOLATION * rangewidth) { |
// Danger: pressure near lower end of range. If the measurement saturates, the |
/branches/dongfang_FC_rewrite/attitude.c |
---|
293,7 → 293,7 |
driftComp[axis] += deltaCorrection / IMUConfig.driftCompDivider; |
CHECK_MIN_MAX(driftComp[axis], -IMUConfig.driftCompLimit, IMUConfig.driftCompLimit); |
// DebugOut.Analog[11 + axis] = correctionSum[axis]; |
debugOut.analog[6 + axis] = correctionSum[axis]; |
debugOut.analog[18 + axis] = correctionSum[axis]; |
debugOut.analog[13 + axis] = driftComp[axis]; |
correctionSum[axis] = 0; |
} |
/branches/dongfang_FC_rewrite/configuration.c |
---|
298,7 → 298,7 |
/* Default Values for R/C Channels */ |
/***************************************************/ |
void channelMap_default(void) { |
channelMap.RCPolarity = 1; |
channelMap.RCPolarity = 0; |
channelMap.channels[CH_PITCH] = 1; |
channelMap.channels[CH_ROLL] = 0; |
channelMap.channels[CH_THROTTLE] = 2; |
/branches/dongfang_FC_rewrite/eeprom.c |
---|
8,6 → 8,7 |
#include "configuration.h" |
#include <avr/wdt.h> |
#include <avr/eeprom.h> |
#include <avr/interrupt.h> |
// byte array in eeprom |
uint8_t EEPromArray[E2END + 1] EEMEM; |
61,10 → 62,13 |
// length is the length of the pure data not including checksum and revision number. |
void writeChecksummedBlock(uint8_t revisionNumber, uint8_t* data, uint16_t offset, uint16_t length) { |
uint16_t CRC = CRC16(data, length); |
uint8_t sreg = SREG; |
cli(); |
eeprom_write_byte(&EEPromArray[offset], CRC&0xff); |
eeprom_write_byte(&EEPromArray[offset+1], CRC>>8); |
eeprom_write_byte(&EEPromArray[offset+2], revisionNumber); |
eeprom_write_block(data, &EEPromArray[offset+3], length); |
SREG = sreg; |
} |
// offset is where the checksum is stored, offset+1 is the revision number, and offset+2... are the data. |
101,7 → 105,6 |
void paramSet_writeToEEProm(uint8_t setnumber) { |
uint16_t offset = EEPROM_ADR_PARAMSET_BEGIN + (setnumber-1)*(sizeof(ParamSet_t)+EEPROM_CHECKSUMMED_BLOCK_OVERHEAD); |
writeChecksummedBlock(EEPARAM_REVISION, (uint8_t*)&staticParams, offset, sizeof(ParamSet_t)); |
// set this parameter set to active set |
} |
void paramSet_readOrDefault() { |
/branches/dongfang_FC_rewrite/flight.c |
---|
256,6 → 256,13 |
debugOut.analog[3] = rate_ATT[PITCH]; |
debugOut.analog[4] = rate_ATT[ROLL]; |
debugOut.analog[5] = yawRate; |
debugOut.analog[6] = getAngleEstimateFromAcc(PITCH) / (int32_t)GYRO_DEG_FACTOR_PITCHROLL; |
debugOut.analog[7] = getAngleEstimateFromAcc(ROLL) / (int32_t)GYRO_DEG_FACTOR_PITCHROLL; |
debugOut.analog[8] = acc[Z]; |
debugOut.analog[9] = controls[CONTROL_PITCH]; |
debugOut.analog[10] = controls[CONTROL_ROLL]; |
} |
/* |
/branches/dongfang_FC_rewrite/makefile |
---|
1,6 → 1,6 |
#-------------------------------------------------------------------- |
# MCU name |
MCU = atmega644 |
MCU = atmega644p |
F_CPU = 20000000 |
#------------------------------------------------------------------- |
VERSION_MAJOR = 0 |
20,18 → 20,18 |
#EXT = MK3MAG |
EXT = |
GYRO=ENC-03_FC1.3 |
GYRO_HW_NAME=ENC |
GYRO_HW_FACTOR=1.304f |
#GYRO=ENC-03_FC1.3 |
#GYRO_HW_NAME=ENC |
#GYRO_HW_FACTOR=1.304f |
#GYRO_PITCHROLL_CORRECTION=1.0f |
#GYRO_YAW_CORRECTION=1.0f |
GYRO=ADXRS610_FC2.0 |
GYRO_HW_NAME=ADXR |
GYRO_HW_FACTOR=1.2288f |
GYRO_PITCHROLL_CORRECTION=1.0f |
GYRO_YAW_CORRECTION=1.0f |
#GYRO=ADXRS610_FC2.0 |
#GYRO_HW_NAME=ADXR |
#GYRO_HW_FACTOR=1.2288f |
#GYRO_PITCHROLL_CORRECTION=1.0f |
#GYRO_YAW_CORRECTION=1.0f |
#GYRO=invenSense |
#GYRO_HW_NAME=Isense |
#GYRO_HW_FACTOR=0.6827f |
/branches/dongfang_FC_rewrite/timer2.c |
---|
151,6 → 151,8 |
recalculateServoTimes = 0; |
} |
uint8_t servoMap[] = {2,3,0,1,4,5,6,7}; |
ISR(TIMER2_COMPA_vect) { |
static uint16_t remainingPulseTime; |
static uint8_t servoIndex = 0; |
160,7 → 162,7 |
// Pulse is over, and the next pulse has already just started. Calculate length of next pulse. |
if (servoIndex < staticParams.servoCount) { |
// There are more signals to output. |
sumOfPulseTimes += (remainingPulseTime = servoValues[servoIndex]); |
sumOfPulseTimes += (remainingPulseTime = servoValues[servoMap[servoIndex]]); |
servoIndex++; |
} else { |
// There are no more signals. Reset the counter and make this pulse cover the missing frame time. |
/branches/dongfang_FC_rewrite/uart0.c |
---|
94,12 → 94,12 |
"GyroPitch ", |
"GyroRoll ", |
"GyroYaw ", //5 |
"correctionSum pi", |
"correctionSum ro", |
"ThrottleTerm ", |
"YawTerm ", |
"gyroDPitch ", //10 |
"gyroDRoll ", |
"AccPitch(0.1deg)", |
"AccRoll(0.1deg) ", |
"AccZ ", |
"RC pitch ", |
"RC roll ", //10 |
" ", |
"zerothOrderCorr ", |
"DriftCompPitch ", |
"DriftCompRoll ", |
106,8 → 106,8 |
"GActivityDivider", //15 |
"AccPitch ", |
"AccRoll ", |
" ", |
" ", |
"CorrectionSum pi", |
"CorrectionSum ro", |
"control act wghd", //20 |
"acc vector wghd ", |
"Height[dm] ", |