u-blox / ublox-cellular-driver-gen

Dependents:   example-ublox-at-cellular-interface-ext example-ublox-cellular-driver-gen HelloMQTT ublox_new_driver_test ... more

Revision:
3:027c9eaec52c
Parent:
2:08302b9cd519
Child:
4:4f2c12992e17
diff -r 08302b9cd519 -r 027c9eaec52c UbloxCellularDriverGen.cpp
--- a/UbloxCellularDriverGen.cpp	Thu Jun 08 14:40:16 2017 +0100
+++ b/UbloxCellularDriverGen.cpp	Tue Jun 13 00:29:44 2017 +0100
@@ -669,15 +669,11 @@
                     // 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 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)
+                    // a time limit. The time limit is twice the amount of time it should take to
+                    // read the block at the working baud rate
                     timer.reset();
                     timer.start();
-                    timeLimit = blockSize * 3 / ((MBED_CONF_UBLOX_CELL_BAUD_RATE / 8) / 1000);
-                    if (timeLimit < 10) {
-                        timeLimit = 10;
-                    }
+                    timeLimit = blockSize * 2 / ((MBED_CONF_UBLOX_CELL_BAUD_RATE / 8) / 1000);
                     sz_read = 0;
                     while ((sz_read < blockSize) && (timer.read_ms() < timeLimit)) {
                         ch = _at->getc();
@@ -694,8 +690,7 @@
                         offset += sz_read;
                         _at->recv("OK");
                     } else {
-                        debug_if(true, "blockSize %d but only received %d bytes within time limit of %d ms\n",
-                        blockSize, sz_read, timeLimit);
+                        debug_if(_debug_trace_on, "blockSize %d but only received %d bytes\n", blockSize, sz_read);
                         success = false;
                     }
                } else {