Subversion Repositories FlightCtrl

Compare Revisions

Ignore whitespace Rev 906 → Rev 907

/branches/V0.69k Code Redesign killagreg/mk3mag.c
2,7 → 2,6
#include <stdlib.h>
#include <inttypes.h>
#include "timer0.h"
#include "uart.h"
#include "fc.h"
#include "rc.h"
#include "eeprom.h"
41,6 → 40,7
// so the cycle time is 65mS + the pulse width.
 
// pwm is high
 
if(PINC & (1<<PINC4))
{ // If PWM signal is high increment PWM high counter
// This counter is incremented by a periode of 102.4us,
56,7 → 56,7
 
}
else // pwm is low
{ // ignore pwm values values of 0 and higher than 37 ms
{ // ignore pwm values values of 0 and higher than 37 ms;
if((PWMCount) && (PWMCount < 362)) // 362 * 102.4us = 37.0688 ms
{
if(PWMCount <10) CompassHeading = 0;
65,15 → 65,8
PWMTimeout = 12; // if 12 periodes long no valid PWM was detected the data are invalid
// 12 * 362 counts * 102.4 us
}
else
{ // bad pwm value (out of range or permanent low)
if(PWMTimeout) PWMTimeout--; // decrement timeout
CompassHeading = -1; // unknown heading
CompassOffCourse = 0;
}
PWMCount = 0; // reset pwm counter
}
 
if(!PWMTimeout)
{
if(CheckDelay(BeepDelay))