Rev 513 | Rev 614 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 513 | Rev 604 | ||
---|---|---|---|
Line 62... | Line 62... | ||
62 | if((signal > 250) && (signal < 687)) |
62 | if((signal > 250) && (signal < 687)) |
63 | { |
63 | { |
64 | signal -= 466; |
64 | signal -= 466; |
65 | // Stabiles Signal |
65 | // Stabiles Signal |
66 | if(abs(signal - PPM_in[index]) < 6) { if(SenderOkay < 200) SenderOkay += 10;} |
66 | if(abs(signal - PPM_in[index]) < 6) { if(SenderOkay < 200) SenderOkay += 10;} |
67 | tmp = (3 * (PPM_in[index]) + signal) / 4; |
67 | tmp = (7 * (PPM_in[index]) + signal) / 8; |
68 | // if(tmp > signal+1) tmp--; else |
68 | if(tmp > signal+1) tmp--; else |
69 | // if(tmp < signal-1) tmp++; |
69 | if(tmp < signal-1) tmp++; |
70 | PPM_diff[index] = tmp - PPM_in[index]; |
70 | if(SenderOkay >= 195) PPM_diff[index] = ((tmp - PPM_in[index]) / 3) * 3; |
- | 71 | else PPM_diff[index] = 0; |
|
71 | PPM_in[index] = tmp; |
72 | PPM_in[index] = tmp; |
72 | } |
73 | } |
73 | index++; |
74 | index++; |
74 | if(index == 5) PORTD |= 0x20; else PORTD &= ~0x20; // Servosignal an J3 anlegen |
75 | if(index == 5) PORTD |= 0x20; else PORTD &= ~0x20; // Servosignal an J3 anlegen |
75 | if(index == 6) PORTD |= 0x10; else PORTD &= ~0x10; // Servosignal an J4 anlegen |
76 | if(index == 6) PORTD |= 0x10; else PORTD &= ~0x10; // Servosignal an J4 anlegen |