ublox-cellular-driver-gen Fork
Fork of ublox-cellular-driver-gen by
Diff: UbloxCellularDriverGen.cpp
- Revision:
- 2:08302b9cd519
- Parent:
- 0:bb5fabac67ab
- Child:
- 3:027c9eaec52c
--- a/UbloxCellularDriverGen.cpp Mon Jun 05 14:11:38 2017 +0000 +++ b/UbloxCellularDriverGen.cpp Thu Jun 08 14:40:16 2017 +0100 @@ -669,11 +669,15 @@ // Would use _at->read() here, but if it runs ahead of the // serial stream it returns -1 instead of the number of characters // read so far, which is not very helpful so instead use _at->getc() and - // a time limit. The time limit is twice the amount of time it should take to - // read the block at the working baud rate + // a time limit. The time limit is three times the amount of time it + // should take to read the block at the working baud rate with a minimum + // of 10 ms (for short files) timer.reset(); timer.start(); - timeLimit = blockSize * 2 / ((MBED_CONF_UBLOX_CELL_BAUD_RATE / 8) / 1000); + timeLimit = blockSize * 3 / ((MBED_CONF_UBLOX_CELL_BAUD_RATE / 8) / 1000); + if (timeLimit < 10) { + timeLimit = 10; + } sz_read = 0; while ((sz_read < blockSize) && (timer.read_ms() < timeLimit)) { ch = _at->getc(); @@ -690,7 +694,8 @@ offset += sz_read; _at->recv("OK"); } else { - debug_if(_debug_trace_on, "blockSize %d but only received %d bytes\n", blockSize, sz_read); + debug_if(true, "blockSize %d but only received %d bytes within time limit of %d ms\n", + blockSize, sz_read, timeLimit); success = false; } } else {