Rev 1038 | Rev 1105 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1038 | Rev 1071 | ||
---|---|---|---|
Line 156... | Line 156... | ||
156 | SIGNAL(SIG_OUTPUT_COMPARE2A) |
156 | SIGNAL(SIG_OUTPUT_COMPARE2A) |
157 | { |
157 | { |
158 | static unsigned char postPulse = 0x80; |
158 | static unsigned char postPulse = 0x80; |
159 | static int filterServo = 100; |
159 | static int filterServo = 100; |
160 | #define MULTIPLIER 4 |
160 | #define MULTIPLIER 4 |
161 | if(PlatinenVersion < 99) |
- | |
162 | { |
- | |
163 | if(ServoState == 4) |
161 | if(ServoState == 4) |
164 | { |
162 | { |
165 | ServoValue = 0x0030; // Offset Part1 |
163 | ServoValue = 0x0030; // Offset Part1 |
166 | filterServo = (filterServo * 3 + (int) Parameter_ServoNickControl * 2)/4; |
164 | filterServo = (filterServo * 3 + (int) Parameter_ServoNickControl * 2)/4; |
167 | ServoValue += filterServo; |
165 | ServoValue += filterServo; |
Line 194... | Line 192... | ||
194 | ServoState = (int) EE_Parameter.ServoNickRefresh * MULTIPLIER; |
192 | ServoState = (int) EE_Parameter.ServoNickRefresh * MULTIPLIER; |
195 | PORTD&=~0x80; |
193 | PORTD&=~0x80; |
196 | TCCR2A = 3; |
194 | TCCR2A = 3; |
197 | } |
195 | } |
198 | ServoState--; |
196 | ServoState--; |
199 | } |
- | |
200 | else // 4017 |
- | |
201 | { |
- | |
202 | /* switch(ServoState) |
- | |
203 | { |
- | |
204 | case 0: |
- | |
205 | PORTD |= 0x80; |
- | |
Line 206... | Line -... | ||
206 | - | ||
207 | ServoValue = 0x0030; // Offset Part1 |
- | |
208 | filterServo = (filterServo * 3 + (int) Parameter_ServoNickControl * 2)/4; |
- | |
209 | ServoValue += filterServo; |
- | |
210 | if(EE_Parameter.ServoNickCompInvert & 0x01) ServoValue += ((long) ((long)EE_Parameter.ServoNickComp * IntegralNick) / 128L )/ (512L/MULTIPLIER); |
- | |
211 | else ServoValue -= ((long) ((long)EE_Parameter.ServoNickComp * IntegralNick) / 128L) / (512L/MULTIPLIER); |
- | |
212 | if((ServoValue) < ((int)EE_Parameter.ServoNickMin*3)) ServoValue = (int)EE_Parameter.ServoNickMin*3; |
- | |
213 | else if((ServoValue) > ((int)EE_Parameter.ServoNickMax*3)) ServoValue = (int)EE_Parameter.ServoNickMax*3; |
- | |
214 | DebugOut.Analog[20] = ServoValue; |
- | |
215 | if ((ServoValue % 255) < 45) { ServoValue+= 77; postPulse = 0x60 - 77; } else postPulse = 0x60; |
- | |
216 | OCR2A = 255-(ServoValue % 256); |
- | |
217 | PORTD &= ~0x80; |
- | |
218 | TCCR2A = 3; // Portfunktion aus |
- | |
219 | ServoState++; |
- | |
220 | break; |
- | |
221 | case 1: |
- | |
222 | if(ServoValue > 255) |
- | |
223 | { |
- | |
224 | ServoValue -= 255; |
- | |
225 | } |
- | |
226 | else |
- | |
227 | { |
- | |
228 | TCCR2A=(1<<COM2A1)|(1<<COM2A0)|3; // Set on match |
- | |
229 | OCR2A = postPulse; // Offset Part2 |
- | |
230 | ServoState++; |
- | |
231 | } |
- | |
232 | break; |
- | |
233 | case 2: |
- | |
234 | TCCR2A = 3; // Portfunktion aus |
- | |
235 | OCR2A = 100; |
- | |
236 | ServoState++; |
- | |
237 | PORTD &= ~0x80; |
- | |
238 | break; |
- | |
239 | case 3: |
- | |
240 | PORTD &= ~0x80; |
- | |
241 | HEF4017R_ON; |
- | |
242 | // TCCR2A=(1<<COM2A1)|(1<<COM2A0)|3; // Set on match |
- | |
243 | OCR2A = 100; |
- | |
244 | PORTD &= ~0x80; |
- | |
245 | ServoState = 0; |
- | |
246 | HEF4017R_OFF; |
- | |
247 | break; |
- | |
248 | default: |
- | |
249 | ServoState = 0; |
- | |
250 | break; |
- | |
251 | } */ |
- | |
252 | } |
197 |