|
1 | 1 | //============================================================================ |
2 | 2 | //RF Explorer 3G+ IoT for Arduino - A Spectrum Analyzer for everyone! |
3 | | -//Copyright © 2010-17 Ariel Rocholl, www.rf-explorer.com |
| 3 | +//Copyright © 2010-18 Ariel Rocholl, www.rf-explorer.com |
4 | 4 | // |
5 | 5 | //This application is free software; you can redistribute it and/or |
6 | 6 | //modify it under the terms of the GNU Lesser General Public |
@@ -46,12 +46,21 @@ uint8_t RFESweepData::processReceivedString(char* pLine, uint8_t* pLastMessage) |
46 | 46 | uint8_t nReturnCode = _RFE_SUCCESS; |
47 | 47 |
|
48 | 48 | uint16_t nSizeString = strlen(pLine); |
| 49 | + uint8_t nAmplitudePosition = 3; |
| 50 | + |
| 51 | + //Note that pLine[2] may contains 0x00 |
| 52 | + if ('z' == pLine[1]) |
| 53 | + { |
| 54 | + nSizeString = strlen(pLine + 4) + 4; |
| 55 | + nAmplitudePosition = 4; |
| 56 | + } |
49 | 57 |
|
50 | 58 | if (nSizeString >= 2) |
51 | 59 | { |
52 | | - if ((StartWith(pLine,"$s") && (nSizeString - 3 == (pLine[2] * 16))) || (StartWith(pLine,"$S") && (nSizeString - 3 == pLine[2]))) |
| 60 | + if ((StartWith(pLine,"$s") && (nSizeString - 3 == (pLine[2] * 16))) || (StartWith(pLine,"$S") && (nSizeString - 3 == pLine[2])) |
| 61 | + || (StartWith(pLine,"$z") && (nSizeString - 4 == (pLine[3] + pLine[2] * 256)))) |
53 | 62 | { |
54 | | - memcpy(m_arrAmplitude, pLine + 3, m_nTotalSteps); |
| 63 | + memcpy(m_arrAmplitude, pLine + nAmplitudePosition, m_nTotalSteps); |
55 | 64 | m_bValid = true; |
56 | 65 | *pLastMessage = _SWEEP_MESSAGE; |
57 | 66 | } |
|
0 commit comments