1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2025-01-18 03:52:11 +01:00

Flight/Settings: Remove old settings implementation (replaced with binary settings as UAVObjects)

git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@465 ebee16cc-31ac-478f-84a7-5cbb03baadba
This commit is contained in:
vassilis 2010-04-10 01:35:13 +00:00 committed by vassilis
parent ac88f788be
commit f4c4b1371a
9 changed files with 5 additions and 195 deletions

View File

@ -71,8 +71,6 @@ OPUAVTALK = ./UAVTalk
OPUAVTALKINC = $(OPUAVTALK)/inc
OPUAVOBJ = ./UAVObjects
OPUAVOBJINC = $(OPUAVOBJ)/inc
OPSETTINGS = ./Settings
OPSETTINGSINC = $(OPSETTINGS)/inc
OPTESTS = ./Tests
OPMODULEDIR = ./Modules
MODEXAMPLE = $(OPMODULEDIR)/Example
@ -153,7 +151,6 @@ SRC += $(PIOSSTM32F10X)/pios_exti.c
## PIOS Hardware (Common)
SRC += $(PIOSCOMMON)/pios_sdcard.c
SRC += $(PIOSCOMMON)/pios_settings.c
SRC += $(PIOSCOMMON)/pios_com.c
SRC += $(PIOSCOMMON)/pios_bmp085.c
SRC += $(PIOSCOMMON)/printf-stdarg.c
@ -246,8 +243,6 @@ EXTRAINCDIRS += $(OPUAVTALK)
EXTRAINCDIRS += $(OPUAVTALKINC)
EXTRAINCDIRS += $(OPUAVOBJ)
EXTRAINCDIRS += $(OPUAVOBJINC)
EXTRAINCDIRS += $(OPSETTINGS)
EXTRAINCDIRS += $(OPSETTINGSINC)
EXTRAINCDIRS += $(MODEXAMPLE)
EXTRAINCDIRS += $(MODEXAMPLEINC)
EXTRAINCDIRS += $(MODTELEMETRY)

View File

@ -69,7 +69,7 @@ int main()
for(;;)
{
/* Check if we have an SD Card with the correct settings files on it */
if(!PIOS_SDCARD_MountFS(STARTUP_LOG_ENABLED) && !PIOS_Settings_CheckForFiles()) {
if(!PIOS_SDCARD_MountFS(STARTUP_LOG_ENABLED)) {
/* Found one without errors */
break;
}
@ -88,9 +88,6 @@ int main()
UAVObjInitialize();
UAVObjectsInitializeAll();
/* Call LoadSettings which populates global variables so the rest of the hardware can be configured. */
PIOS_Settings_Load();
/* Com ports init */
PIOS_COM_Init();

View File

@ -1,116 +0,0 @@
/**
******************************************************************************
*
* @file pios_settings.c
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
* @brief Gets and sets PiOS settings, normally from SDCard.
* @see The GNU Public License (GPL) Version 3
* @defgroup PIOS_SETTINGS Settings Functions
* @{
*
*****************************************************************************/
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
/* Project Includes */
#include "pios.h"
#if defined(PIOS_INCLUDE_SETTINGS)
/* Private Function Prototypes */
/* Local Variables */
SettingsTypeDef Settings;
/**
* Populate System global Settings into Structs using MinIni, defaults are also set here via macros from pios_config.h
*/
/* Value Reading: ini_getl("Section", "Key", (DefaultValue), IniFile); */
/* String Reading: ini_gets("Section", "Key", "DefaultValue", StrBuffer, sizearray(StrBuffer), IniFile); */
void PIOS_Settings_Load(void)
{
/* Unused yet, until we load strings
char StrBuffer[100];
long Result;
*/
/* Section: GPS */
Settings.GPS.Baudrate = (uint32_t) ini_getl("GPS", "Baudrate", GPS_BAUDRATE, SETTINGS_FILE);
/* Section: Telemetry */
Settings.Telem.Baudrate = (uint32_t) ini_getl("Telemetry", "Baudrate", TELEM_BAUDRATE, SETTINGS_FILE);
/* Section: Auxillary_USART */
Settings.AuxUSART.Enabled = (bool) ini_getl("Auxillary_USART", "Enabled", AUXUART_ENABLED, SETTINGS_FILE);
Settings.AuxUSART.Baudrate = (uint32_t) ini_getl("Auxillary_USART", "Baudrate", AUXUART_BAUDRATE, SETTINGS_FILE);
/* Section: Servos */
Settings.Servos.PositionMin = (uint16_t) ini_getl("Servos", "PositionMin", SERVOS_POSITION_MIN, SETTINGS_FILE);
Settings.Servos.PositionMax = (uint16_t) ini_getl("Servos", "PositionMax", SERVOS_POSITION_MAX, SETTINGS_FILE);
}
/**
* Dump Settings struct contents to UART
* \param[in] USARTx USART name (GPS, TELEM, AUX)
*/
void PIOS_Settings_Dump(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
*/
int32_t PIOS_Settings_CheckForFiles(void)
{
DIRINFO di;
DIRENT de;
int FoundCount = 0;
di.scratch = PIOS_SDCARD_Sector;
/* Open the root directory */
DFS_OpenDir(&PIOS_SDCARD_VolInfo, (uint8_t *)"", &di);
/* Scan the directory for all files */
while(!DFS_GetNext(&PIOS_SDCARD_VolInfo, &di, &de)) {
if(de.name[0]) {
uint8_t file_name[13];
DFS_DirToCanonical((char *)file_name, (char *)de.name);
if(strcmp((char *)file_name, SETTINGS_FILE) == 0) {
FoundCount++;
}
}
}
/* If one or more files are missing, return the number of missing files */
if(FoundCount != 1)
{
return FoundCount;
}
/* All files found */
return 0;
}
#endif

View File

@ -160,11 +160,11 @@ void PIOS_Servo_Set(uint8_t Servo, uint16_t Position)
if (Servo < PIOS_SERVO_NUM_OUTPUTS && Servo >= 0)
{
/* Clip servo position */
if(Position < Settings.Servos.PositionMin) {
Position = Settings.Servos.PositionMin;
if(Position < SERVOS_POSITION_MIN) {
Position = SERVOS_POSITION_MIN;
}
if(Position > Settings.Servos.PositionMax) {
Position = Settings.Servos.PositionMax;
if(Position > SERVOS_POSITION_MAX) {
Position = SERVOS_POSITION_MAX;
}
/* Update the position */

View File

@ -34,7 +34,6 @@
/* Global Variables */
extern SettingsTypeDef Settings;
xSemaphoreHandle PIOS_USART1_Buffer;
xSemaphoreHandle PIOS_USART2_Buffer;
xSemaphoreHandle PIOS_USART3_Buffer;

View File

@ -1,64 +0,0 @@
/**
******************************************************************************
*
* @file pios_settings.h
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
* @brief Settings functions header
* @see The GNU Public License (GPL) Version 3
*
*****************************************************************************/
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef PIOS_SETTINGS_H
#define PIOS_SETTINGS_H
/* Global types */
typedef struct {
uint32_t Baudrate;
} GPSSettingsTypeDef;
typedef struct {
uint32_t Baudrate;
} TelemSettingsTypeDef;
typedef struct {
bool Enabled;
uint32_t Baudrate;
} USARTSettingsTypeDef;
typedef struct {
uint16_t PositionMin;
uint16_t PositionMax;
} ServosSettingsTypeDef;
typedef struct {
GPSSettingsTypeDef GPS;
TelemSettingsTypeDef Telem;
USARTSettingsTypeDef AuxUSART;
ServosSettingsTypeDef Servos;
} SettingsTypeDef;
/*Global Variables */
extern SettingsTypeDef Settings;
/* Public Functions */
extern void PIOS_Settings_Load(void);
extern void PIOS_Settings_Dump(USART_TypeDef* USARTx);
extern int32_t PIOS_Settings_CheckForFiles(void);
#endif /* PIOS_SETTINGS_H */

View File

@ -84,7 +84,6 @@
#endif
/* PIOS Hardware Includes (Common) */
#include <pios_settings.h>
#include <pios_sdcard.h>
#include <pios_com.h>
#if defined(PIOS_INCLUDE_BMP085)