Subversion Repositories FlightCtrl

Rev

Rev 785 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 785 Rev 790
Line 50... Line 50...
50
        else // PWM is low
50
        else // PWM is low
51
        {
51
        {
52
                if((PWMCount) && (PWMCount < 400))
52
                if((PWMCount) && (PWMCount < 400))
53
                {
53
                {
54
                        if(PWMCount <9) PWMHeading = 0;
54
                        if(PWMCount <9) PWMHeading = 0;
55
                        else PWMHeading = ((uint32_t)(PWMCount - 9) * 1049L) >> 10; // correct timebase and offset
55
                        else PWMHeading = ((uint32_t)(PWMCount - 9) * 1049L)/1024; // correct timebase and offset
56
                        PWMTimeout = 12; // if 12 periodes long no valid PWM was detected the data are invalid
56
                        PWMTimeout = 12; // if 12 periodes long no valid PWM was detected the data are invalid
57
                        // 12 * 400 counts * 102.4 us = 419 ms
57
                        // 12 * 400 counts * 102.4 us = 419 ms
58
                }
58
                }
59
                PWMCount = 0; // reset pwm counter
59
                PWMCount = 0; // reset pwm counter
60
        }
60
        }
Line 66... Line 66...
66
/*********************************************/
66
/*********************************************/
67
int16_t CMPS03_Heading(void)
67
int16_t CMPS03_Heading(void)
68
{
68
{
69
        int16_t heading, w, v;
69
        int16_t heading, w, v;
Line 70... Line -...
70
 
-
 
71
        DebugOut.Analog[11] = PWMTimeout;
-
 
72
 
70
 
73
        if(PWMTimeout)
71
        if(PWMTimeout)
74
        {
72
        {
75
                w = abs(IntegralPitch / 512);
73
                w = abs(IntegralPitch / 512);
76
                v = abs(IntegralRoll  / 512);
74
                v = abs(IntegralRoll  / 512);