Rev 910 | Rev 1038 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 910 | Rev 1036 | ||
---|---|---|---|
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 < 20) |
|
- | 162 | { |
|
161 | if(ServoState == 4) |
163 | if(ServoState == 4) |
162 | { |
164 | { |
163 | ServoValue = 0x0030; // Offset Part1 |
165 | ServoValue = 0x0030; // Offset Part1 |
164 | filterServo = (filterServo * 3 + (int) Parameter_ServoNickControl * 2)/4; |
166 | filterServo = (filterServo * 3 + (int) Parameter_ServoNickControl * 2)/4; |
165 | ServoValue += filterServo; |
167 | ServoValue += filterServo; |
Line 192... | Line 194... | ||
192 | ServoState = (int) EE_Parameter.ServoNickRefresh * MULTIPLIER; |
194 | ServoState = (int) EE_Parameter.ServoNickRefresh * MULTIPLIER; |
193 | PORTD&=~0x80; |
195 | PORTD&=~0x80; |
194 | TCCR2A = 3; |
196 | TCCR2A = 3; |
195 | } |
197 | } |
196 | ServoState--; |
198 | ServoState--; |
- | 199 | } |
|
- | 200 | else // 4017 |
|
- | 201 | { |
|
- | 202 | /* switch(ServoState) |
|
- | 203 | { |
|
- | 204 | case 0: |
|
- | 205 | PORTD |= 0x80; |
|
Line -... | Line 206... | ||
- | 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 | } */ |
|
197 | 252 | } |