mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2024-12-01 09:24:10 +01: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:
parent
998ab12de4
commit
a4853aee53
@ -30,10 +30,10 @@
|
||||
#include "pios.h"
|
||||
|
||||
/* File system object for each logical drive */
|
||||
FATFS Fatfs[_DRIVES];
|
||||
static FATFS Fatfs[_DRIVES];
|
||||
|
||||
/* Create struct for logfile */
|
||||
FIL logfile;
|
||||
static FIL logfile;
|
||||
|
||||
/**
|
||||
* Initialises SDCard
|
||||
@ -61,12 +61,24 @@ void PIOS_SDCARD_Init(void)
|
||||
PIOS_LED_Toggle(LED2);
|
||||
}
|
||||
} else {
|
||||
result = f_puts("Hello\n", &logfile);
|
||||
if (result != EOF ) {
|
||||
result = f_puts("pios rocks!\n", &logfile );
|
||||
result = f_puts("PiOS Startup Log\n\n", &logfile);
|
||||
if (result != EOF) {
|
||||
|
||||
|
||||
/* 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -50,10 +50,10 @@ void PIOS_Settings_Load(void)
|
||||
*/
|
||||
|
||||
/* 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 */
|
||||
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 */
|
||||
Settings.AuxUSART.Enabled = (bool) ini_getl("Auxillary_USART", "Enabled", AUXUART_ENABLED, SETTINGS_FILE);
|
||||
@ -61,7 +61,6 @@ void PIOS_Settings_Load(void)
|
||||
|
||||
/* 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.PositionMax = (uint16_t) ini_getl("Servos", "PositionMax", SERVOS_POSITION_MAX, SETTINGS_FILE);
|
||||
}
|
||||
|
||||
|
@ -42,8 +42,8 @@ typedef struct {
|
||||
} USARTSettingsTypeDef;
|
||||
|
||||
typedef struct {
|
||||
uint16_t PositionMax;
|
||||
uint16_t PositionMin;
|
||||
uint16_t PositionMax;
|
||||
} ServosSettingsTypeDef;
|
||||
|
||||
typedef struct {
|
||||
@ -61,4 +61,4 @@ 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 */
|
||||
#endif /* PIOS_SETTINGS_H */
|
||||
|
@ -63,11 +63,9 @@ int main()
|
||||
|
||||
/* Call LoadSettings which populates System Vars
|
||||
so the rest of the hardware can be configured. */
|
||||
//PIOS_Settings_Load();
|
||||
PIOS_Settings_Load();
|
||||
|
||||
for(;;) {
|
||||
|
||||
}
|
||||
Flashy();
|
||||
|
||||
/* Com ports init */
|
||||
// PIOS_COM_Init();
|
||||
|
Loading…
Reference in New Issue
Block a user