Rev 2050 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 2050 | Rev 2309 | ||
---|---|---|---|
1 | /*####################################################################################### |
1 | /*####################################################################################### |
2 | Decodes the sbus protocol |
2 | Decodes the sbus protocol |
3 | #######################################################################################*/ |
3 | #######################################################################################*/ |
4 | // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
4 | // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
5 | // + www.MikroKopter.com |
5 | // + www.MikroKopter.com |
6 | // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
6 | // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
7 | // + Software Nutzungsbedingungen (english version: see below) |
7 | // + Software Nutzungsbedingungen (english version: see below) |
8 | // + der Fa. HiSystems GmbH, Flachsmeerstrasse 2, 26802 Moormerland - nachfolgend Lizenzgeber genannt - |
8 | // + der Fa. HiSystems GmbH, Flachsmeerstrasse 2, 26802 Moormerland - nachfolgend Lizenzgeber genannt - |
9 | // + Der Lizenzgeber räumt dem Kunden ein nicht-ausschließliches, zeitlich und räumlich* unbeschränktes Recht ein, die im den |
9 | // + Der Lizenzgeber räumt dem Kunden ein nicht-ausschließliches, zeitlich und räumlich* unbeschränktes Recht ein, die im den |
10 | // + Mikrocontroller verwendete Firmware für die Hardware Flight-Ctrl, Navi-Ctrl, BL-Ctrl, MK3Mag & PC-Programm MikroKopter-Tool |
10 | // + Mikrocontroller verwendete Firmware für die Hardware Flight-Ctrl, Navi-Ctrl, BL-Ctrl, MK3Mag & PC-Programm MikroKopter-Tool |
11 | // + - nachfolgend Software genannt - nur für private Zwecke zu nutzen. |
11 | // + - nachfolgend Software genannt - nur für private Zwecke zu nutzen. |
12 | // + Der Einsatz dieser Software ist nur auf oder mit Produkten des Lizenzgebers zulässig. |
12 | // + Der Einsatz dieser Software ist nur auf oder mit Produkten des Lizenzgebers zulässig. |
13 | // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
13 | // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
14 | // + Die vom Lizenzgeber gelieferte Software ist urheberrechtlich geschützt. Alle Rechte an der Software sowie an sonstigen im |
14 | // + Die vom Lizenzgeber gelieferte Software ist urheberrechtlich geschützt. Alle Rechte an der Software sowie an sonstigen im |
15 | // + Rahmen der Vertragsanbahnung und Vertragsdurchführung überlassenen Unterlagen stehen im Verhältnis der Vertragspartner ausschließlich dem Lizenzgeber zu. |
15 | // + Rahmen der Vertragsanbahnung und Vertragsdurchführung überlassenen Unterlagen stehen im Verhältnis der Vertragspartner ausschließlich dem Lizenzgeber zu. |
16 | // + Die in der Software enthaltenen Copyright-Vermerke, Markenzeichen, andere Rechtsvorbehalte, Seriennummern sowie |
16 | // + Die in der Software enthaltenen Copyright-Vermerke, Markenzeichen, andere Rechtsvorbehalte, Seriennummern sowie |
17 | // + sonstige der Programmidentifikation dienenden Merkmale dürfen vom Kunden nicht verändert oder unkenntlich gemacht werden. |
17 | // + sonstige der Programmidentifikation dienenden Merkmale dürfen vom Kunden nicht verändert oder unkenntlich gemacht werden. |
18 | // + Der Kunde trifft angemessene Vorkehrungen für den sicheren Einsatz der Software. Er wird die Software gründlich auf deren |
18 | // + Der Kunde trifft angemessene Vorkehrungen für den sicheren Einsatz der Software. Er wird die Software gründlich auf deren |
19 | // + Verwendbarkeit zu dem von ihm beabsichtigten Zweck testen, bevor er diese operativ einsetzt. |
19 | // + Verwendbarkeit zu dem von ihm beabsichtigten Zweck testen, bevor er diese operativ einsetzt. |
20 | // + Die Haftung des Lizenzgebers wird - soweit gesetzlich zulässig - begrenzt in Höhe des typischen und vorhersehbaren |
20 | // + Die Haftung des Lizenzgebers wird - soweit gesetzlich zulässig - begrenzt in Höhe des typischen und vorhersehbaren |
21 | // + Schadens. Die gesetzliche Haftung bei Personenschäden und nach dem Produkthaftungsgesetz bleibt unberührt. Dem Lizenzgeber steht jedoch der Einwand |
21 | // + Schadens. Die gesetzliche Haftung bei Personenschäden und nach dem Produkthaftungsgesetz bleibt unberührt. Dem Lizenzgeber steht jedoch der Einwand |
22 | // + des Mitverschuldens offen. |
22 | // + des Mitverschuldens offen. |
23 | // + Der Kunde trifft angemessene Vorkehrungen für den Fall, dass die Software ganz oder teilweise nicht ordnungsgemäß arbeitet. |
23 | // + Der Kunde trifft angemessene Vorkehrungen für den Fall, dass die Software ganz oder teilweise nicht ordnungsgemäß arbeitet. |
24 | // + Er wird die Software gründlich auf deren Verwendbarkeit zu dem von ihm beabsichtigten Zweck testen, bevor er diese operativ einsetzt. |
24 | // + Er wird die Software gründlich auf deren Verwendbarkeit zu dem von ihm beabsichtigten Zweck testen, bevor er diese operativ einsetzt. |
25 | // + Der Kunde wird er seine Daten vor Einsatz der Software nach dem Stand der Technik sichern. |
25 | // + Der Kunde wird er seine Daten vor Einsatz der Software nach dem Stand der Technik sichern. |
26 | // + Der Kunde ist darüber unterrichtet, dass der Lizenzgeber seine Daten im zur Vertragsdurchführung erforderlichen Umfang |
26 | // + Der Kunde ist darüber unterrichtet, dass der Lizenzgeber seine Daten im zur Vertragsdurchführung erforderlichen Umfang |
27 | // + und auf Grundlage der Datenschutzvorschriften erhebt, speichert, verarbeitet und, sofern notwendig, an Dritte übermittelt. |
27 | // + und auf Grundlage der Datenschutzvorschriften erhebt, speichert, verarbeitet und, sofern notwendig, an Dritte übermittelt. |
28 | // + *) Die räumliche Nutzung bezieht sich nur auf den Einsatzort, nicht auf die Reichweite der programmierten Software. |
28 | // + *) Die räumliche Nutzung bezieht sich nur auf den Einsatzort, nicht auf die Reichweite der programmierten Software. |
29 | // + #### ENDE DER NUTZUNGSBEDINGUNGEN ####' |
29 | // + #### ENDE DER NUTZUNGSBEDINGUNGEN ####' |
30 | // + Hinweis: Informationen über erweiterte Nutzungsrechte (wie z.B. Nutzung für nicht-private Zwecke) sind auf Anfrage per Email an info(@)hisystems.de verfügbar. |
30 | // + Hinweis: Informationen über erweiterte Nutzungsrechte (wie z.B. Nutzung für nicht-private Zwecke) sind auf Anfrage per Email an info(@)hisystems.de verfügbar. |
31 | // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
31 | // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
32 | // + Software LICENSING TERMS |
32 | // + Software LICENSING TERMS |
33 | // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
33 | // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
34 | // + of HiSystems GmbH, Flachsmeerstrasse 2, 26802 Moormerland, Germany - the Licensor - |
34 | // + of HiSystems GmbH, Flachsmeerstrasse 2, 26802 Moormerland, Germany - the Licensor - |
35 | // + The Licensor grants the customer a non-exclusive license to use the microcontroller firmware of the Flight-Ctrl, Navi-Ctrl, BL-Ctrl, and MK3Mag hardware |
35 | // + The Licensor grants the customer a non-exclusive license to use the microcontroller firmware of the Flight-Ctrl, Navi-Ctrl, BL-Ctrl, and MK3Mag hardware |
36 | // + (the Software) exclusively for private purposes. The License is unrestricted with respect to time and territory*. |
36 | // + (the Software) exclusively for private purposes. The License is unrestricted with respect to time and territory*. |
37 | // + The Software may only be used with the Licensor's products. |
37 | // + The Software may only be used with the Licensor's products. |
38 | // + The Software provided by the Licensor is protected by copyright. With respect to the relationship between the parties to this |
38 | // + The Software provided by the Licensor is protected by copyright. With respect to the relationship between the parties to this |
39 | // + agreement, all rights pertaining to the Software and other documents provided during the preparation and execution of this |
39 | // + agreement, all rights pertaining to the Software and other documents provided during the preparation and execution of this |
40 | // + agreement shall be the property of the Licensor. |
40 | // + agreement shall be the property of the Licensor. |
41 | // + The information contained in the Software copyright notices, trademarks, other legal reservations, serial numbers and other |
41 | // + The information contained in the Software copyright notices, trademarks, other legal reservations, serial numbers and other |
42 | // + features that can be used to identify the program may not be altered or defaced by the customer. |
42 | // + features that can be used to identify the program may not be altered or defaced by the customer. |
43 | // + The customer shall be responsible for taking reasonable precautions |
43 | // + The customer shall be responsible for taking reasonable precautions |
44 | // + for the safe use of the Software. The customer shall test the Software thoroughly regarding its suitability for the |
44 | // + for the safe use of the Software. The customer shall test the Software thoroughly regarding its suitability for the |
45 | // + intended purpose before implementing it for actual operation. The Licensor's liability shall be limited to the extent of typical and |
45 | // + intended purpose before implementing it for actual operation. The Licensor's liability shall be limited to the extent of typical and |
46 | // + foreseeable damage to the extent permitted by law, notwithstanding statutory liability for bodily injury and product |
46 | // + foreseeable damage to the extent permitted by law, notwithstanding statutory liability for bodily injury and product |
47 | // + liability. However, the Licensor shall be entitled to the defense of contributory negligence. |
47 | // + liability. However, the Licensor shall be entitled to the defense of contributory negligence. |
48 | // + The customer will take adequate precautions in the case, that the software is not working properly. The customer will test |
48 | // + The customer will take adequate precautions in the case, that the software is not working properly. The customer will test |
49 | // + the software for his purpose before any operational usage. The customer will backup his data before using the software. |
49 | // + the software for his purpose before any operational usage. The customer will backup his data before using the software. |
50 | // + The customer understands that the Licensor collects, stores and processes, and, where required, forwards, customer data |
50 | // + The customer understands that the Licensor collects, stores and processes, and, where required, forwards, customer data |
51 | // + to third parties to the extent necessary for executing the agreement, subject to applicable data protection and privacy regulations. |
51 | // + to third parties to the extent necessary for executing the agreement, subject to applicable data protection and privacy regulations. |
52 | // + *) The territory aspect only refers to the place where the Software is used, not its programmed range. |
52 | // + *) The territory aspect only refers to the place where the Software is used, not its programmed range. |
53 | // + #### END OF LICENSING TERMS #### |
53 | // + #### END OF LICENSING TERMS #### |
54 | // + Note: For information on license extensions (e.g. commercial use), please contact us at info(@)hisystems.de. |
54 | // + Note: For information on license extensions (e.g. commercial use), please contact us at info(@)hisystems.de. |
55 | // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
55 | // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
56 | 56 | ||
57 | #include "sbus.h" |
57 | #include "sbus.h" |
58 | #include "main.h" |
58 | #include "main.h" |
59 | 59 | ||
60 | #if (defined(__AVR_ATmega1284__) || defined(__AVR_ATmega1284P__)) |
60 | #if (defined(__AVR_ATmega1284__) || defined(__AVR_ATmega1284P__)) |
61 | unsigned char NewSBusData = 0, sBusBuffer[25]; |
61 | unsigned char NewSBusData = 0, sBusBuffer[25]; |
62 | 62 | ||
63 | //############################################################################ |
63 | //############################################################################ |
64 | // USART1 initialisation from killagreg |
64 | // USART1 initialisation from killagreg |
65 | void SbusUartInit(void) |
65 | void SbusUartInit(void) |
66 | //############################################################################ |
66 | //############################################################################ |
67 | { |
67 | { |
68 | // -- Start of USART1 initialisation for Spekturm seriell-mode |
68 | // -- Start of USART1 initialisation for Spekturm seriell-mode |
69 | // USART1 Control and Status Register A, B, C and baud rate register |
69 | // USART1 Control and Status Register A, B, C and baud rate register |
70 | uint8_t sreg = SREG; |
70 | uint8_t sreg = SREG; |
71 | 71 | ||
72 | uint16_t ubrr = (uint16_t) ((uint32_t) SYSCLK/(8 * 100000) - 1); |
72 | uint16_t ubrr = (uint16_t) ((uint32_t) SYSCLK/(8 * 100000) - 1); |
73 | 73 | ||
74 | // disable all interrupts before reconfiguration |
74 | // disable all interrupts before reconfiguration |
75 | cli(); |
75 | cli(); |
76 | // disable RX-Interrupt |
76 | // disable RX-Interrupt |
77 | UCSR1B &= ~(1 << RXCIE1); |
77 | UCSR1B &= ~(1 << RXCIE1); |
78 | // disable TX-Interrupt |
78 | // disable TX-Interrupt |
79 | UCSR1B &= ~(1 << TXCIE1); |
79 | UCSR1B &= ~(1 << TXCIE1); |
80 | // disable DRE-Interrupt |
80 | // disable DRE-Interrupt |
81 | UCSR1B &= ~(1 << UDRIE1); |
81 | UCSR1B &= ~(1 << UDRIE1); |
- | 82 | /* |
|
82 | // set direction of RXD1 and TXD1 pins |
83 | // set direction of RXD1 and TXD1 pins |
83 | // set RXD1 (PD2) as an input pin |
84 | // set RXD1 (PD2) as an input pin |
84 | PORTD |= (1 << PORTD2); |
85 | PORTD |= (1 << PORTD2); |
85 | DDRD &= ~(1 << DDD2); |
86 | DDRD &= ~(1 << DDD2); |
86 | - | ||
87 | // set TXD1 (PD3) as an output pin |
87 | // set TXD1 (PD3) as an output pin |
88 | PORTD |= (1 << PORTD3); |
88 | PORTD |= (1 << PORTD3); |
89 | DDRD |= (1 << DDD3); |
89 | DDRD |= (1 << DDD3); |
90 | 90 | */ |
|
91 | // USART0 Baud Rate Register |
91 | // USART0 Baud Rate Register |
92 | // set clock divider |
92 | // set clock divider |
93 | UBRR1H = (uint8_t)(ubrr>>8); |
93 | UBRR1H = (uint8_t)(ubrr>>8); |
94 | UBRR1L = (uint8_t)ubrr; |
94 | UBRR1L = (uint8_t)ubrr; |
95 | // enable double speed operation |
95 | // enable double speed operation |
96 | UCSR1A |= (1 << U2X1); |
96 | UCSR1A |= (1 << U2X1); |
97 | // enable receiver and transmitter |
97 | // enable receiver and transmitter |
98 | //UCSR1B = (1<<RXEN1)|(1<<TXEN1); |
98 | //UCSR1B = (1<<RXEN1)|(1<<TXEN1); |
99 | 99 | ||
100 | UCSR1B = (1<<RXEN1); |
100 | UCSR1B = (1<<RXEN1); |
101 | // set asynchronous mode |
101 | // set asynchronous mode |
102 | UCSR1C &= ~(1 << UMSEL11); |
102 | UCSR1C &= ~(1 << UMSEL11); |
103 | UCSR1C &= ~(1 << UMSEL10); |
103 | UCSR1C &= ~(1 << UMSEL10); |
104 | // parity |
104 | // parity |
105 | UCSR1C <= (1 << UPM11); // even |
105 | UCSR1C <= (1 << UPM11); // even |
106 | UCSR1C &= ~(1 << UPM10); |
106 | UCSR1C &= ~(1 << UPM10); |
107 | // stop bit |
107 | // stop bit |
108 | UCSR1C |= (1 << USBS1); // two |
108 | UCSR1C |= (1 << USBS1); // two |
109 | // 8-bit |
109 | // 8-bit |
110 | UCSR1B &= ~(1 << UCSZ12); |
110 | UCSR1B &= ~(1 << UCSZ12); |
111 | UCSR1C |= (1 << UCSZ11); |
111 | UCSR1C |= (1 << UCSZ11); |
112 | UCSR1C |= (1 << UCSZ10); |
112 | UCSR1C |= (1 << UCSZ10); |
113 | // flush receive buffer explicit |
113 | // flush receive buffer explicit |
114 | while(UCSR1A & (1<<RXC1)) UDR1; |
114 | while(UCSR1A & (1<<RXC1)) UDR1; |
115 | // enable RX-interrupts at the end |
115 | // enable RX-interrupts at the end |
116 | UCSR1B |= (1 << RXCIE1); |
116 | UCSR1B |= (1 << RXCIE1); |
117 | // -- End of USART1 initialisation |
117 | // -- End of USART1 initialisation |
118 | // restore global interrupt flags |
118 | // restore global interrupt flags |
119 | sBusBuffer[23] |= 4; // This Bit contains the 'Signal loss' |
119 | sBusBuffer[23] |= 4; // This Bit contains the 'Signal loss' |
120 | SREG = sreg; |
120 | SREG = sreg; |
121 | return; |
121 | return; |
122 | } |
122 | } |
123 | 123 | ||
124 | // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
124 | // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
125 | #define MIN_FRAMEGAP 68 // 7ms |
125 | #define MIN_FRAMEGAP 68 // 7ms |
126 | #define MAX_BYTEGAP 3 // 310us |
126 | #define MAX_BYTEGAP 3 // 310us |
127 | 127 | ||
128 | //############################################################################ |
128 | //############################################################################ |
129 | // Is called by the uart RX interrupt |
129 | // Is called by the uart RX interrupt |
130 | //############################################################################ |
130 | //############################################################################ |
131 | void SbusParser(unsigned char udr) |
131 | void SbusParser(unsigned char udr) |
132 | { |
132 | { |
133 | static unsigned char ptr = 0; |
133 | static unsigned char ptr = 0; |
134 | if(!SpektrumTimer && udr == 0x0f) // wait for the start |
134 | if(!SpektrumTimer && udr == 0x0f) // wait for the start |
135 | { |
135 | { |
136 | ptr = 0; |
136 | ptr = 0; |
137 | SpektrumTimer = 80; // 8ms gap |
137 | SpektrumTimer = 80; // 8ms gap |
138 | } |
138 | } |
139 | else |
139 | else |
140 | { |
140 | { |
141 | if(++ptr == 24) // last byte |
141 | if(++ptr == 24) // last byte |
142 | { |
142 | { |
143 | NewSBusData = 1; |
143 | NewSBusData = 1; |
144 | } |
144 | } |
145 | else |
145 | else |
146 | if(ptr > 24) ptr = 25; |
146 | if(ptr > 24) ptr = 25; |
147 | else |
147 | else |
148 | { |
148 | { |
149 | sBusBuffer[ptr] = udr; // collect all bytes |
149 | sBusBuffer[ptr] = udr; // collect all bytes |
150 | } |
150 | } |
151 | } |
151 | } |
152 | } |
152 | } |
153 | 153 | ||
154 | void ProcessSBus(void) |
154 | void ProcessSBus(void) |
155 | { |
155 | { |
156 | static unsigned char load = 0; |
156 | static unsigned char load = 0; |
157 | unsigned char bitmask8 = 1, sbyte = 2, i, index = 1, process; |
157 | unsigned char bitmask8 = 1, sbyte = 2, i, index = 1, process; |
158 | unsigned int bitmask11 = 256; |
158 | unsigned int bitmask11 = 256; |
159 | signed int signal = 0,tmp; |
159 | signed int signal = 0,tmp; |
160 | 160 | ||
161 | if(!(sBusBuffer[23] & 4)) // This Bit contains the 'Signal loss' |
161 | if(!(sBusBuffer[23] & 4)) // This Bit contains the 'Signal loss' |
162 | { |
162 | { |
163 | TIMSK1 &= ~_BV(ICIE1); // disable PPM-Input |
163 | TIMSK1 &= ~_BV(ICIE1); // disable PPM-Input |
164 | if(EE_Parameter.FailsafeChannel == 0 || PPM_in[EE_Parameter.FailsafeChannel] < 100) // forces Failsafe if the receiver doesn't have 'signal loss' on Failsafe |
164 | if(EE_Parameter.FailsafeChannel == 0 || PPM_in[EE_Parameter.FailsafeChannel] < 100) // forces Failsafe if the receiver doesn't have 'signal loss' on Failsafe |
165 | { |
165 | { |
166 | if(SenderOkay < 200) SenderOkay += 20; else SenderOkay = 200; |
166 | if(SenderOkay < 200) SenderOkay += 20; else SenderOkay = 200; |
167 | } |
167 | } |
168 | signal = sBusBuffer[1]; |
168 | signal = sBusBuffer[1]; |
169 | if(!load--) { process = (12*11 - 8); load = 2;} else process = (4*11 - 8); // lowers the processor load |
169 | if(!load--) { process = (12*11 - 8); load = 2;} else process = (4*11 - 8); // lowers the processor load |
170 | for(i = 0; i < process; i++) // collect the single bits |
170 | for(i = 0; i < process; i++) // collect the single bits |
171 | { |
171 | { |
172 | if(sBusBuffer[sbyte] & bitmask8) signal |= bitmask11; |
172 | if(sBusBuffer[sbyte] & bitmask8) signal |= bitmask11; |
173 | bitmask8 *= 2; |
173 | bitmask8 *= 2; |
174 | if(!bitmask8) |
174 | if(!bitmask8) |
175 | { |
175 | { |
176 | bitmask8 = 1; |
176 | bitmask8 = 1; |
177 | sbyte++; |
177 | sbyte++; |
178 | } |
178 | } |
179 | bitmask11 *= 2; |
179 | bitmask11 *= 2; |
180 | if(bitmask11 == 2048) |
180 | if(bitmask11 == 2048) |
181 | { |
181 | { |
182 | bitmask11 = 1; |
182 | bitmask11 = 1; |
183 | signal = (signal-1024) / 5; // the resolution is higher than required |
183 | signal = (signal-1024) / 5; // the resolution is higher than required |
184 | tmp = (3 * (PPM_in[index]) + signal) / 4; |
184 | tmp = (3 * (PPM_in[index]) + signal) / 4; |
185 | if(tmp > signal+1) tmp--; else |
185 | if(tmp > signal+1) tmp--; else |
186 | if(tmp < signal-1) tmp++; |
186 | if(tmp < signal-1) tmp++; |
187 | if(SenderOkay >= 195) PPM_diff[index] = ((tmp - PPM_in[index]) / 3) * 3; |
187 | if(SenderOkay >= 195) PPM_diff[index] = ((tmp - PPM_in[index]) / 3) * 3; |
188 | else PPM_diff[index] = 0; |
188 | else PPM_diff[index] = 0; |
189 | PPM_in[index] = tmp; |
189 | PPM_in[index] = tmp; |
190 | signal = 0; |
190 | signal = 0; |
191 | index++; // next channel |
191 | index++; // next channel |
192 | } |
192 | } |
193 | } |
193 | } |
194 | NewPpmData = 0; // Null bedeutet: Neue Daten |
194 | NewPpmData = 0; // Null bedeutet: Neue Daten |
195 | } |
195 | } |
196 | NewSBusData = 0; |
196 | NewSBusData = 0; |
197 | } |
197 | } |
198 | 198 | ||
199 | #endif |
199 | #endif |
200 | 200 |