Rev 838 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 838 | Rev 966 | ||
---|---|---|---|
Line 9... | Line 9... | ||
9 | // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
9 | // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
Line 10... | Line 10... | ||
10 | 10 | ||
11 | #include "rc.h" |
11 | #include "rc.h" |
Line 12... | Line 12... | ||
12 | #include "main.h" |
12 | #include "main.h" |
13 | 13 | ||
14 | volatile int PPM_in[11]; |
14 | int PPM_in[11] = {0,0,0,0,0,0,0,0,0,0,0}; |
Line 15... | Line 15... | ||
15 | int RCQuality = 0; |
15 | int RCQuality = 0; |
16 | volatile unsigned char NewPpmData = 1; |
16 | unsigned char NewPpmData = 1; |
17 | 17 | ||
18 | //############################################################################ |
18 | //############################################################################ |
Line 59... | Line 59... | ||
59 | if(SenderOkay < 200) |
59 | if(SenderOkay < 200) |
60 | { |
60 | { |
61 | SenderOkay += 10; |
61 | SenderOkay += 10; |
62 | } |
62 | } |
63 | } |
63 | } |
64 | /* Give an estimate for the Signal Level based on the RC-Jitter */ |
64 | /* Give an estimate for the Signal Level based on the RC-Jitter see |
- | 65 | http://forum.mikrokopter.de/topic-post44807.html#post44807*/ |
|
65 | if (abs(2 * (signal - PPM_org[index]) > (int) RC_Quality)) |
66 | if (abs(2 * (signal - PPM_org[index]) > (int) RC_Quality)) |
66 | { |
67 | { |
67 | RC_Quality = 0.99F * RC_Quality + 0.01F * (float) abs(2 * (signal - PPM_org[index])) ; |
68 | RC_Quality = 0.99F * RC_Quality + 0.01F * (float) abs(2 * (signal - PPM_org[index])) ; |
68 | } |
69 | } |
69 | else |
70 | else |
Line 78... | Line 79... | ||
78 | { |
79 | { |
79 | RC_Quality = 0.95F * RC_Quality + 0.05F * 100; |
80 | RC_Quality = 0.95F * RC_Quality + 0.05F * 100; |
80 | } |
81 | } |
81 | RC_Quality = MIN(100.F, RC_Quality); |
82 | RC_Quality = MIN(100.F, RC_Quality); |
82 | RCQuality = 100 - (int) RC_Quality; |
83 | RCQuality = 100 - (int) RC_Quality; |
- | 84 | DebugOut.Analog[12] = RCQuality; |
|
83 | index++; |
85 | index++; |
84 | if(index == 5) PORTD |= 0x20; else PORTD &= ~0x20; // Servosignal an J3 anlegen |
86 | if(index == 5) PORTD |= 0x20; else PORTD &= ~0x20; // Servosignal an J3 anlegen |
85 | if(index == 6) PORTD |= 0x10; else PORTD &= ~0x10; // Servosignal an J4 anlegen |
87 | if(index == 6) PORTD |= 0x10; else PORTD &= ~0x10; // Servosignal an J4 anlegen |
86 | if(index == 7) PORTD |= 0x08; else PORTD &= ~0x08; // Servosignal an J5 anlegen |
88 | if(index == 7) PORTD |= 0x08; else PORTD &= ~0x08; // Servosignal an J5 anlegen |
87 | } |
89 | } |