File manager
Diff: FileManager.cpp
- Revision:
- 23:7ffd9724e105
- Parent:
- 22:2fc64ad66e35
- Child:
- 24:5ee719582d1e
diff -r 2fc64ad66e35 -r 7ffd9724e105 FileManager.cpp --- a/FileManager.cpp Wed May 25 11:43:45 2016 +0000 +++ b/FileManager.cpp Wed May 25 12:00:59 2016 +0000 @@ -219,6 +219,16 @@ */ void FILEMANAGER_LogGPSData(time_t timestamp ,char lat[], char longti[]) { + if (!m_sdCardIsPresent) + { + /** Turn off LED */ + FILEMANAGER_SetLedStatus(false); + + printf("Error! SD Card is not connected \n"); + + /** Return as nothing to be done */ + return; + } /* Get File name */ char file_name[] = GPS_LOG_FILE_NAME; @@ -262,6 +272,16 @@ */ void FILEMANAGER_LogRMSData(time_t timestamp ,float * var, int size, bool * p_headerRequired) { + if (!m_sdCardIsPresent) + { + /** Turn off LED */ + FILEMANAGER_SetLedStatus(false); + + printf("Error! SD Card is not connected \n"); + + /** Return as nothing to be done */ + return; + } /* Get File name */ char file_name[] = RTL_LOG_FILE_NAME; @@ -317,7 +337,8 @@ * @retval None */ void FILEMANAGER_LogRMSHeader(time_t timestamp) -{ +{ + /* Get File name */ char file_name[] = RTL_LOG_FILE_NAME; @@ -590,52 +611,4 @@ } #endif } -#if 0 -/** - * @brief Function to init File Manager - * @note - * @param - * @retval None - */ -void FILEMANAGER_Init() -{ - if (sdSwitch) - { - m_sdCardIsPresent = true; - } - FILEMANAGER_SetLedStatus(true); - - printf("\r\n ===== SDCard Init !!"); - sdSwitch.rise(&FILEMANAGER_SDConnect); -} -/** - * @brief Interrupt function for sd card disconnect - * @note - * @param - * @retval None - */ -void FILEMANAGER_SDDisconnect() -{ - printf("\r\n ===== SDCard Disconnect !!"); - wait_ms(20); - m_sdCardIsPresent = false; - FILEMANAGER_SetLedStatus(false); - //sdSwitch.rise(&FILEMANAGER_SDConnect); - -} -/** - * @brief Interrupt function for sd card connect - * @note - * @param - * @retval None - */ -void FILEMANAGER_SDConnect() -{ - printf("\r\n ===== SDCard Connect !!"); - m_sdCardIsPresent = true; - FILEMANAGER_SetLedStatus(true); - //sdSwitch.fall(&FILEMANAGER_SDDisconnect); - NVIC_SystemReset(); -} -#endif