1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2025-04-08 00:53:48 +02:00

Changed to sdcard startup procedure. Now puts diagnostic information on the SD card.

This revision is a good fall-back point as a basic test that the hardware and your development environment is working.

git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@133 ebee16cc-31ac-478f-84a7-5cbb03baadba
This commit is contained in:
gussy 2010-01-21 02:04:15 +00:00 committed by gussy
parent 998ab12de4
commit a4853aee53
4 changed files with 24 additions and 15 deletions

View File

@ -30,10 +30,10 @@
#include "pios.h" #include "pios.h"
/* File system object for each logical drive */ /* File system object for each logical drive */
FATFS Fatfs[_DRIVES]; static FATFS Fatfs[_DRIVES];
/* Create struct for logfile */ /* Create struct for logfile */
FIL logfile; static FIL logfile;
/** /**
* Initialises SDCard * Initialises SDCard
@ -61,12 +61,24 @@ void PIOS_SDCARD_Init(void)
PIOS_LED_Toggle(LED2); PIOS_LED_Toggle(LED2);
} }
} else { } else {
result = f_puts("Hello\n", &logfile); result = f_puts("PiOS Startup Log\n\n", &logfile);
if (result != EOF ) { if (result != EOF) {
result = f_puts("pios rocks!\n", &logfile );
/* Print out diagnostic information */
FATFS *fs;
DWORD free;
f_getfree("/", &free, &fs);
f_puts("Log file creation completed.\n\n", &logfile);
f_puts("------------------------------\n", &logfile);
f_puts("SD Card Information\n", &logfile);
f_puts("------------------------------\n", &logfile);
f_printf(&logfile, "Free Space: %lu MB\n", ((free * (Fatfs[0].csize / 2)) / 1024));
f_printf(&logfile, "Total Space: %lu MB\n", (((Fatfs[0].max_clust - 2) * (Fatfs[0].csize / 2)) / 1024));
} }
f_close(&logfile); f_close(&logfile);
} }
} }
} }

View File

@ -50,10 +50,10 @@ void PIOS_Settings_Load(void)
*/ */
/* Section: GPS */ /* Section: GPS */
Settings.GPS.Baudrate = (uint32_t) ini_getl("GPS", "Baudrate", GPS_BAUDRATE, SETTINGS_FILE); Settings.GPS.Baudrate = (uint32_t) ini_getl("GPS", "Baudrate", GPS_BAUDRATE, SETTINGS_FILE);
/* Section: Telemetry */ /* Section: Telemetry */
Settings.Telem.Baudrate = (uint32_t) ini_getl("Telemetry", "Baudrate", TELEM_BAUDRATE, SETTINGS_FILE); Settings.Telem.Baudrate = (uint32_t) ini_getl("Telemetry", "Baudrate", TELEM_BAUDRATE, SETTINGS_FILE);
/* Section: Auxillary_USART */ /* Section: Auxillary_USART */
Settings.AuxUSART.Enabled = (bool) ini_getl("Auxillary_USART", "Enabled", AUXUART_ENABLED, SETTINGS_FILE); Settings.AuxUSART.Enabled = (bool) ini_getl("Auxillary_USART", "Enabled", AUXUART_ENABLED, SETTINGS_FILE);
@ -61,7 +61,6 @@ void PIOS_Settings_Load(void)
/* Section: Servos */ /* Section: Servos */
Settings.Servos.PositionMin = (uint16_t) ini_getl("Servos", "PositionMin", SERVOS_POSITION_MIN, SETTINGS_FILE); Settings.Servos.PositionMin = (uint16_t) ini_getl("Servos", "PositionMin", SERVOS_POSITION_MIN, SETTINGS_FILE);
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); Settings.Servos.PositionMax = (uint16_t) ini_getl("Servos", "PositionMax", SERVOS_POSITION_MAX, SETTINGS_FILE);
} }

View File

@ -42,8 +42,8 @@ typedef struct {
} USARTSettingsTypeDef; } USARTSettingsTypeDef;
typedef struct { typedef struct {
uint16_t PositionMax;
uint16_t PositionMin; uint16_t PositionMin;
uint16_t PositionMax;
} ServosSettingsTypeDef; } ServosSettingsTypeDef;
typedef struct { typedef struct {
@ -61,4 +61,4 @@ extern void PIOS_Settings_Load(void);
extern void PIOS_Settings_Dump(USART_TypeDef* USARTx); extern void PIOS_Settings_Dump(USART_TypeDef* USARTx);
extern int32_t PIOS_Settings_CheckForFiles(void); extern int32_t PIOS_Settings_CheckForFiles(void);
#endif /* PIOS_SETTINGS_H */ #endif /* PIOS_SETTINGS_H */

View File

@ -63,11 +63,9 @@ int main()
/* Call LoadSettings which populates System Vars /* Call LoadSettings which populates System Vars
so the rest of the hardware can be configured. */ so the rest of the hardware can be configured. */
//PIOS_Settings_Load(); PIOS_Settings_Load();
for(;;) { Flashy();
}
/* Com ports init */ /* Com ports init */
// PIOS_COM_Init(); // PIOS_COM_Init();