Subversion Repositories FlightCtrl

Rev

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

Rev 2039 Rev 2048
Line 2... Line 2...
2
#include "configuration.h"
2
#include "configuration.h"
3
#include "controlMixer.h"
3
#include "controlMixer.h"
Line 4... Line 4...
4
 
4
 
5
ExternalControl_t externalControl;
5
ExternalControl_t externalControl;
6
uint8_t externalControlActive;
-
 
7
 
6
uint8_t externalControlActive;
8
int16_t EC_PRTY[4];
-
 
9
 
7
// int16_t EC_PRTY[4];
10
// TODO: Who is going to call this
-
 
11
void EC_setNeutral(void) {
-
 
12
        // if necessary. From main.c.
-
 
13
        externalControl.config = 0;
-
 
14
        externalControl.pitch = 0;
-
 
15
        externalControl.roll = 0;
-
 
16
        externalControl.yaw = 0;
-
 
17
        externalControl.throttle = 0;
-
 
18
 
-
 
19
        // From main.c. What does it do??
-
 
20
        externalControl.digital[0] = 0x55;
-
 
Line 21... Line 8...
21
}
8
// TODO: Who is going to call this
-
 
9
 
-
 
10
void EC_setNeutral(void) {
-
 
11
  // if necessary. From main.c.
-
 
12
  externalControl.config = 0;
22
 
13
  externalControl.pitch = 0;
-
 
14
  externalControl.roll = 0;
-
 
15
  externalControl.yaw = 0;
-
 
16
  externalControl.throttle = 0;
-
 
17
 
-
 
18
  // From main.c. What does it do??
-
 
19
  externalControl.digital[0] = 0x55;
-
 
20
}
-
 
21
 
-
 
22
void EC_periodicTaskAndPRTY(int16_t* PRTY) {
-
 
23
  if (externalControlActive) {
-
 
24
    externalControlActive--;
-
 
25
    PRTY[CONTROL_PITCH] += externalControl.pitch * (int16_t) staticParams.stickP;
-
 
26
    PRTY[CONTROL_ROLL] += externalControl.roll * (int16_t) staticParams.stickP;
-
 
27
    PRTY[CONTROL_THROTTLE] += externalControl.throttle;
23
int16_t* EC_getPRTY(void) {
28
    PRTY[CONTROL_YAW] += externalControl.yaw; // No stickP or similar??????
Line 24... Line 29...
24
        return EC_PRTY;
29
  }
25
}
30
}
26
 
31
 
Line 27... Line 32...
27
uint8_t EC_getArgument(void) {
32
uint8_t EC_getArgument(void) {
28
        return externalControl.config;
33
  return externalControl.config;
29
}
34
}
Line 30... Line 35...
30
 
35
 
31
uint8_t EC_getCommand(void) {
36
uint8_t EC_getCommand(void) {
32
        return externalControl.free;
37
  return externalControl.free;
33
}
-
 
34
 
-
 
35
// not implemented.
-
 
36
int16_t EC_getVariable(uint8_t varNum) {
-
 
37
        return 0;
-
 
38
}
-
 
39
 
-
 
40
void EC_periodicTask() {
-
 
41
        if (externalControlActive) {
-
 
42
                externalControlActive--;
-
 
43
                EC_PRTY[CONTROL_PITCH] = externalControl.pitch * (int16_t) staticParams.stickP;
-
 
44
                EC_PRTY[CONTROL_ROLL] = externalControl.roll * (int16_t) staticParams.stickP;
-
 
45
                EC_PRTY[CONTROL_THROTTLE] = externalControl.throttle;
38
}
Line 46... Line 39...
46
                EC_PRTY[CONTROL_YAW] = externalControl.yaw; // No stickP or similar??????
39
 
47
        } else {
40
// not implemented.
48
                EC_PRTY[CONTROL_PITCH] = EC_PRTY[CONTROL_ROLL] = EC_PRTY[CONTROL_THROTTLE] = EC_PRTY[CONTROL_YAW] = 0;
41
int16_t EC_getVariable(uint8_t varNum) {
49
        }
42
  return 0;
50
}
43
}
51
 
44
 
52
uint8_t EC_getSignalQuality(void) {
45
uint8_t EC_getSignalQuality(void) {
53
        if (externalControlActive > 80)
46
  if (externalControlActive > 80)
54
                // Configured and heard from recently
47
    // Configured and heard from recently
55
                return SIGNAL_GOOD;
48
    return SIGNAL_GOOD;
56
 
49
 
57
        if (externalControlActive)
50
  if (externalControlActive)
Line 58... Line 51...
58
                // Configured and heard from
51
    // Configured and heard from
59
                return SIGNAL_OK;
52
    return SIGNAL_OK;
60
 
53