Bmag incl gps rettelse
Dependencies: mbed WDT MODSERIAL BME280
Diff: BMAG/BMAG.cpp
- Branch:
- MbedBMAGThrRev
- Revision:
- 55:06c5f76e1a8c
- Parent:
- 28:ed0d29f63b55
diff -r d4d20a744b87 -r 06c5f76e1a8c BMAG/BMAG.cpp --- a/BMAG/BMAG.cpp Mon Jan 07 14:17:53 2019 +0000 +++ b/BMAG/BMAG.cpp Fri Feb 15 12:53:30 2019 +0000 @@ -19,7 +19,7 @@ \param str The complete rs232 string from GSM-19T. */ -void BMAG::parseBMAGString(string str){ +int BMAG::parseBMAGString(string str){ string tmpmagStr = ""; //get first mag string column @@ -41,6 +41,28 @@ setMagSqStr(tmpmagStr); + if(strlen(lastMagTime.c_str()) != 8){ + lastMagTime.assign("NaN"); + lastMagNT.assign("NaN"); + lastMagSq.assign("NaN"); + return -1; + } + + if(strlen(lastMagNT.c_str()) != 8){ + lastMagTime.assign("NaN"); + lastMagNT.assign("NaN"); + lastMagSq.assign("NaN"); + return -1; + } + + if(strlen(lastMagSq.c_str()) != 2){ + lastMagTime.assign("NaN"); + lastMagNT.assign("NaN"); + lastMagSq.assign("NaN"); + return -1; + } + + return 0; };