Subversion Repositories FlightCtrl

Rev

Rev 2119 | Rev 2124 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 2119 Rev 2122
Line 32... Line 32...
32
  WDTCSR |= (1 << WDCE) | (1 << WDE);
32
  WDTCSR |= (1 << WDCE) | (1 << WDE);
33
  WDTCSR = 0;
33
  WDTCSR = 0;
Line 34... Line 34...
34
 
34
 
35
// This is strange: It should NOT be necessarty to do. But the call of the same,
35
// This is strange: It should NOT be necessarty to do. But the call of the same,
36
// in channelMap_readOrDefault (if eeprom read fails) just sets all to 0,0,0,....
36
// in channelMap_readOrDefault (if eeprom read fails) just sets all to 0,0,0,....
Line 37... Line 37...
37
  channelMap_default();
37
// channelMap_default();
38
 
38
 
39
  // initalize modules
39
  // initalize modules
40
  output_init();
40
  output_init();
Line 46... Line 46...
46
  analog_init();
46
  analog_init();
Line 47... Line 47...
47
 
47
 
48
  // Parameter Set handling
48
  // Parameter Set handling
49
  IMUConfig_readOrDefault();
49
  IMUConfig_readOrDefault();
-
 
50
  channelMap_readOrDefault();
50
  channelMap_readOrDefault();
51
  rcTrim_readOrDefault();
Line 51... Line 52...
51
  paramSet_readOrDefault();
52
  paramSet_readOrDefault();
52
 
53
 
Line 136... Line 137...
136
          usart0_transmitTxData();
137
          usart0_transmitTxData();
137
        }
138
        }
Line 138... Line 139...
138
 
139
 
Line -... Line 140...
-
 
140
        usart0_processRxData();
-
 
141
 
139
        usart0_processRxData();
142
        static uint8_t aboveWarningLimitVoltageSeen = 0;
140
 
143
 
141
        if (checkDelay(timer)) {
144
        if (checkDelay(timer)) {
142
          if (UBat <= UBAT_AT_5V) {
145
          if (UBat >= staticParams.batteryWarningVoltage) {
143
            // Do nothing. The voltage on the input side of the regulator is <5V;
146
            aboveWarningLimitVoltageSeen = 1;
144
            // we must be running off USB power. Keep it quiet.
147
          } else { // If we are above USB voltage, or if we have once been above warning voltage
-
 
148
            if (aboveWarningLimitVoltageSeen || UBat > UBAT_AT_5V) {
145
          } else if (UBat < staticParams.batteryWarningVoltage) {
149
              beepBatteryAlarm();
146
            beepBatteryAlarm();
-
 
147
          }
-
 
148
 
-
 
149
#ifdef USE_NAVICTRL
-
 
150
          SPI_StartTransmitPacket();
-
 
151
          SendSPI = 4;
150
            }
152
#endif
151
          }
153
          timer = setDelay(20); // every 20 ms
152
          timer = setDelay(20); // every 20 ms
154
        }
153
        }
Line 155... Line -...
155
        output_update();
-
 
156
      }
-
 
157
 
-
 
158
#ifdef USE_NAVICTRL
-
 
159
      if(!SendSPI) {
-
 
160
        // SendSPI is decremented in timer0.c with a rate of 9.765 kHz.
-
 
161
        // within the SPI_TransmitByte() routine the value is set to 4.
-
 
162
        // I.e. the SPI_TransmitByte() is called at a rate of 9.765 kHz/4= 2441.25 Hz,
-
 
163
        // and therefore the time of transmission of a complete spi-packet (32 bytes) is 32*4/9.765 kHz = 13.1 ms.
-
 
164
        SPI_TransmitByte();
154
        output_update();
Line 165... Line 155...
165
      }
155
      }
166
#endif
156
 
167
          calculateFeaturedServoValues();
157
          calculateFeaturedServoValues();