mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-02-20 10:54:14 +01:00
Added some more settings functions to make life easier.
git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@26 ebee16cc-31ac-478f-84a7-5cbb03baadba
This commit is contained in:
parent
4d23e4b879
commit
3a1454c0d1
@ -57,3 +57,37 @@ void LoadSettings(void)
|
|||||||
Settings.AuxUART.Enabled = (bool) ini_getl("Auxillary_UART", "Enabled", AUXUART_ENABLED, SETTINGS_FILE);
|
Settings.AuxUART.Enabled = (bool) ini_getl("Auxillary_UART", "Enabled", AUXUART_ENABLED, SETTINGS_FILE);
|
||||||
Settings.AuxUART.Baudrate = (uint32_t) ini_getl("Auxillary_UART", "Baudrate", AUXUART_BAUDRATE, SETTINGS_FILE);
|
Settings.AuxUART.Baudrate = (uint32_t) ini_getl("Auxillary_UART", "Baudrate", AUXUART_BAUDRATE, SETTINGS_FILE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Dump Settings struct contents to UART
|
||||||
|
* \param[in] USARTx UART name (GPS, TELEM, AUX)
|
||||||
|
*/
|
||||||
|
void DumpSettings(USART_TypeDef* USARTx)
|
||||||
|
{
|
||||||
|
/* Implement once UART is fully implemented */
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check if settings files exist on the drive
|
||||||
|
* \return 0 All files found
|
||||||
|
* \return >0 Number of files missing
|
||||||
|
*/
|
||||||
|
int CheckForSettingsFiles(void)
|
||||||
|
{
|
||||||
|
FILINFO DummyVar;
|
||||||
|
int MissingCount = 0;
|
||||||
|
|
||||||
|
/* Check for existence of SETTINGS_FILE */
|
||||||
|
if(f_stat(SETTINGS_FILE, &DummyVar) != FR_OK) {
|
||||||
|
MissingCount++;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* If one or more files are missing, return the number of missing files */
|
||||||
|
if(MissingCount > 0)
|
||||||
|
{
|
||||||
|
return MissingCount;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* All files found */
|
||||||
|
return 0;
|
||||||
|
}
|
@ -60,5 +60,7 @@ extern SettingsTypeDef Settings;
|
|||||||
|
|
||||||
/* Public Functions */
|
/* Public Functions */
|
||||||
extern void LoadSettings(void);
|
extern void LoadSettings(void);
|
||||||
|
extern void DumpSettings(USART_TypeDef* USARTx);
|
||||||
|
extern int CheckForSettingsFiles(void);
|
||||||
|
|
||||||
#endif /* PIOS_SETTINGS_H */
|
#endif /* PIOS_SETTINGS_H */
|
Loading…
x
Reference in New Issue
Block a user