Bmag incl gps rettelse
Dependencies: mbed WDT MODSERIAL BME280
Diff: SPS/SPS.cpp
- Revision:
- 6:6d1683c8b26b
- Parent:
- 5:11782a2008c2
- Child:
- 7:872984a67d5b
--- a/SPS/SPS.cpp Thu Mar 09 12:03:55 2017 +0000 +++ b/SPS/SPS.cpp Thu Mar 09 15:26:22 2017 +0000 @@ -2,8 +2,10 @@ SPS::SPS(){ + fileNameString = ""; currentString = ""; currentErrString = ""; + lastString = ""; headerString = "/tag identifier_id group_id date time zzz | s1 source_id interpreter_id data_line_version encoding source_firmware_version interpreter_firmware_version | latitude longitude gpsFixFlag mag_time mag_nt mag_sq checksum"; crc_tab16_init = 0; errStatus = true; @@ -18,7 +20,7 @@ memset(checkSum,'\0',5); unsigned short chkSum = 0; - dbg->printf("Commencing sps line generation\r\n"); + //dbg->printf("Commencing sps line generation\r\n"); //create current string addToCurrentString(LINESTART); addToCurrentString(tag); @@ -68,9 +70,9 @@ addToCurrentString(SPACE); addToCurrentString(mag_sq); - dbg->printf("CurrentStringBeforeChecksumCalc: "); - dbg->printf(currentString.c_str()); - dbg->printf("\r\n"); + //dbg->printf("CurrentStringBeforeChecksumCalc: "); + //dbg->printf(currentString.c_str()); + //dbg->printf("\r\n"); //calculate checksum for(int i = 0; i < strlen(currentString.c_str()); i++){ @@ -81,7 +83,7 @@ } } - sprintf(checkSum, "%4x", chkSum); + sprintf(checkSum, "%04X", chkSum); //append rest of string addToCurrentString(SPACE); @@ -169,4 +171,24 @@ void SPS::addToCurrentString(char data){ int currentStartIndex = strlen(currentString.c_str()); currentString[currentStartIndex] = data; +}; + + +void SPS::generateSpsFilename(string formattedDate){ + + fileNameString = ""; + + fileNameString.append("/usb/BMAG_"); + + fileNameString.append(formattedDate); + + fileNameString.append(".sps"); + +}; + + +string SPS::getSpsFileName(void){ + + return this->fileNameString; + }; \ No newline at end of file