Add a bunch of APNs
Fork of C027_Support by
Diff: GPS.cpp
- Revision:
- 46:8ce9169e0747
- Parent:
- 45:ebc2fd8dcf21
- Child:
- 74:208e3e32d263
diff -r ebc2fd8dcf21 -r 8ce9169e0747 GPS.cpp --- a/GPS.cpp Mon May 05 15:42:49 2014 +0000 +++ b/GPS.cpp Tue May 06 06:54:12 2014 +0000 @@ -323,20 +323,25 @@ int GPSI2C::_get(char* buf, int len) { int read = 0; - unsigned char sz[2]; + unsigned char sz[2] = {0,0}; if (!I2C::write(_i2cAdr,®LEN,sizeof(REGLEN),true) && - !I2C::read(_i2cAdr,(char*)sz,sizeof(sz),true)) + !I2C::read(_i2cAdr,(char*)sz,sizeof(sz))) { int size = 256 * (int)sz[0] + sz[1]; if (size > len) size = len; - if (size > 0) - read = !I2C::read(_i2cAdr,buf,size, true) ? size : 0; - found = (read == size); + if (size > 0) + { + if (!I2C::write(_i2cAdr,®STREAM,sizeof(REGSTREAM),true) && + !I2C::read(_i2cAdr,buf,size)) { + read = size; + } + else + found = false; + } } else found = false; - I2C::stop(); return read; }