Subversion Repositories FlightCtrl

Compare Revisions

Ignore whitespace Rev 2121 → Rev 2122

/branches/dongfang_FC_fixedwing/main.c
34,7 → 34,7
 
// This is strange: It should NOT be necessarty to do. But the call of the same,
// in channelMap_readOrDefault (if eeprom read fails) just sets all to 0,0,0,....
channelMap_default();
// channelMap_default();
 
// initalize modules
output_init();
48,6 → 48,7
// Parameter Set handling
IMUConfig_readOrDefault();
channelMap_readOrDefault();
rcTrim_readOrDefault();
paramSet_readOrDefault();
 
// enable interrupts global
138,32 → 139,21
 
usart0_processRxData();
 
static uint8_t aboveWarningLimitVoltageSeen = 0;
 
if (checkDelay(timer)) {
if (UBat <= UBAT_AT_5V) {
// Do nothing. The voltage on the input side of the regulator is <5V;
// we must be running off USB power. Keep it quiet.
} else if (UBat < staticParams.batteryWarningVoltage) {
beepBatteryAlarm();
if (UBat >= staticParams.batteryWarningVoltage) {
aboveWarningLimitVoltageSeen = 1;
} else { // If we are above USB voltage, or if we have once been above warning voltage
if (aboveWarningLimitVoltageSeen || UBat > UBAT_AT_5V) {
beepBatteryAlarm();
}
}
 
#ifdef USE_NAVICTRL
SPI_StartTransmitPacket();
SendSPI = 4;
#endif
timer = setDelay(20); // every 20 ms
}
output_update();
}
 
#ifdef USE_NAVICTRL
if(!SendSPI) {
// SendSPI is decremented in timer0.c with a rate of 9.765 kHz.
// within the SPI_TransmitByte() routine the value is set to 4.
// I.e. the SPI_TransmitByte() is called at a rate of 9.765 kHz/4= 2441.25 Hz,
// and therefore the time of transmission of a complete spi-packet (32 bytes) is 32*4/9.765 kHz = 13.1 ms.
SPI_TransmitByte();
}
#endif
calculateFeaturedServoValues();
 
if (runFlightControl) { // Time for the next iteration was up before the current finished. Signal error.