From 3a1454c0d1826d388ce4e9db792940993400e0a2 Mon Sep 17 00:00:00 2001 From: gussy Date: Mon, 30 Nov 2009 10:07:05 +0000 Subject: [PATCH] Added some more settings functions to make life easier. git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@26 ebee16cc-31ac-478f-84a7-5cbb03baadba --- flight/sys/pios_settings.c | 34 ++++++++++++++++++++++++++++++++++ flight/sys/pios_settings.h | 2 ++ 2 files changed, 36 insertions(+) diff --git a/flight/sys/pios_settings.c b/flight/sys/pios_settings.c index d8e648fd2..e3ab7b1aa 100644 --- a/flight/sys/pios_settings.c +++ b/flight/sys/pios_settings.c @@ -57,3 +57,37 @@ void LoadSettings(void) 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); } + +/** +* 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; +} \ No newline at end of file diff --git a/flight/sys/pios_settings.h b/flight/sys/pios_settings.h index 2bd121587..e5112ae3a 100644 --- a/flight/sys/pios_settings.h +++ b/flight/sys/pios_settings.h @@ -60,5 +60,7 @@ extern SettingsTypeDef Settings; /* Public Functions */ extern void LoadSettings(void); +extern void DumpSettings(USART_TypeDef* USARTx); +extern int CheckForSettingsFiles(void); #endif /* PIOS_SETTINGS_H */ \ No newline at end of file