Subversion Repositories FlightCtrl

Rev

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

Rev 2103 Rev 2104
Line 2... Line 2...
2
#include <avr/interrupt.h>
2
#include <avr/interrupt.h>
3
#include "eeprom.h"
3
#include "eeprom.h"
4
#include "output.h"
4
#include "output.h"
5
#include "flight.h"
5
#include "flight.h"
6
#include "attitude.h"
6
#include "attitude.h"
-
 
7
#include "timer2.h"
Line 7... Line 8...
7
 
8
 
Line 8... Line 9...
8
// #define COARSERESOLUTION 1
9
// #define COARSERESOLUTION 1
9
 
10
 
Line 20... Line 21...
20
#define SERVOLIMIT 2000
21
#define SERVOLIMIT 2000
21
#define SCALE_FACTOR 16
22
#define SCALE_FACTOR 16
22
#define CS2 (1<<CS21)
23
#define CS2 (1<<CS21)
23
#endif
24
#endif
Line 24... Line -...
24
 
-
 
25
#define MAX_SERVOS 8
25
 
26
#define FRAMELEN ((NEUTRAL_PULSELENGTH + SERVOLIMIT) * staticParams.servoCount + 128)
26
#define FRAMELEN ((NEUTRAL_PULSELENGTH + SERVOLIMIT) * staticParams.servoCount + 128)
27
#define MIN_PULSELENGTH (NEUTRAL_PULSELENGTH - SERVOLIMIT)
27
#define MIN_PULSELENGTH (NEUTRAL_PULSELENGTH - SERVOLIMIT)
Line 28... Line 28...
28
#define MAX_PULSELENGTH (NEUTRAL_PULSELENGTH + SERVOLIMIT)
28
#define MAX_PULSELENGTH (NEUTRAL_PULSELENGTH + SERVOLIMIT)
Line 142... Line 142...
142
  uint8_t axis;
142
  uint8_t axis;
Line 143... Line 143...
143
 
143
 
144
  // Save the computation cost of computing a new value before the old one is used.
144
  // Save the computation cost of computing a new value before the old one is used.
Line 145... Line 145...
145
  if (!recalculateServoTimes) return;
145
  if (!recalculateServoTimes) return;
146
 
146
 
147
  for (axis=0; axis<2; axis++) {
147
  for (axis= MAX_CONTROL_SERVOS; axis<MAX_CONTROL_SERVOS+2; axis++) {
148
        value = featuredServoValue(axis);
148
        value = featuredServoValue(axis-MAX_CONTROL_SERVOS);
149
        servoValues[axis + 4] = value;
149
        servoValues[axis] = value;
150
  }
150
  }
151
  for (axis=2; axis<MAX_SERVOS; axis++) {
151
  for (axis=MAX_CONTROL_SERVOS+2; axis<MAX_SERVOS; axis++) {
152
        value = 128 * SCALE_FACTOR;
152
        value = 128 * SCALE_FACTOR;
Line 153... Line 153...
153
        servoValues[axis + 4] = value;
153
        servoValues[axis] = value;
154
  }
154
  }