1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2024-11-29 07:24:13 +01:00

Merge branch 'bugfix-flight' into OP-378_James_INS

This commit is contained in:
James Cotton 2011-05-26 12:19:35 -05:00
commit 6e186bab35
3 changed files with 26 additions and 2 deletions

View File

@ -268,8 +268,8 @@ static void manualControlTask(void *parameters)
// Set accessory channels // Set accessory channels
cmd.Accessory1 = (settings.Accessory1 != MANUALCONTROLSETTINGS_ACCESSORY1_NONE) ? scaledChannel[settings.Accessory1] : 0; cmd.Accessory1 = (settings.Accessory1 != MANUALCONTROLSETTINGS_ACCESSORY1_NONE) ? scaledChannel[settings.Accessory1] : 0;
cmd.Accessory2 = (settings.Accessory1 != MANUALCONTROLSETTINGS_ACCESSORY2_NONE) ? scaledChannel[settings.Accessory2] : 0; cmd.Accessory2 = (settings.Accessory2 != MANUALCONTROLSETTINGS_ACCESSORY2_NONE) ? scaledChannel[settings.Accessory2] : 0;
cmd.Accessory3 = (settings.Accessory1 != MANUALCONTROLSETTINGS_ACCESSORY3_NONE) ? scaledChannel[settings.Accessory3] : 0; cmd.Accessory3 = (settings.Accessory3 != MANUALCONTROLSETTINGS_ACCESSORY3_NONE) ? scaledChannel[settings.Accessory3] : 0;
processFlightMode(&settings, flightMode); processFlightMode(&settings, flightMode);
processArm(&cmd, &settings); processArm(&cmd, &settings);

View File

@ -104,6 +104,28 @@ int32_t PIOS_DELAY_WaitmS(uint16_t mS)
return 0; return 0;
} }
/**
* @brief Query the Delay timer for the current uS
* @return A microsecond value
*/
uint16_t PIOS_DELAY_GetuS()
{
return PIOS_DELAY_TIMER->CNT;
}
/**
* @brief Compute the difference between now and a reference time
* @param[in] the reference time to compare now to
* @return The number of uS since the delay
*
* @note the user is responsible for worrying about rollover on the 16 bit uS counter
*/
int32_t PIOS_DELAY_DiffuS(uint16_t ref)
{
int32_t ret_t = ref;
return (int16_t) (PIOS_DELAY_GetuS() - ret_t);
}
#endif #endif
/** /**

View File

@ -36,6 +36,8 @@
extern int32_t PIOS_DELAY_Init(void); extern int32_t PIOS_DELAY_Init(void);
extern int32_t PIOS_DELAY_WaituS(uint16_t uS); extern int32_t PIOS_DELAY_WaituS(uint16_t uS);
extern int32_t PIOS_DELAY_WaitmS(uint16_t mS); extern int32_t PIOS_DELAY_WaitmS(uint16_t mS);
extern uint16_t PIOS_DELAY_GetuS();
extern int32_t PIOS_DELAY_DiffuS(uint16_t ref);
#endif /* PIOS_DELAY_H */ #endif /* PIOS_DELAY_H */