mirror of
				https://github.com/KevinMidboe/TinyGSM.git
				synced 2025-10-29 18:00:18 +00:00 
			
		
		
		
	Don't need maintain in buffer dump
Signed-off-by: Sara Damiano <sdamiano@stroudcenter.org>
This commit is contained in:
		| @@ -548,8 +548,10 @@ class TinyGsmSim7000 : public TinyGsmModem<TinyGsmSim7000>, | |||||||
|     //  ^^ Requested number of data bytes (1-1460 bytes)to be read |     //  ^^ Requested number of data bytes (1-1460 bytes)to be read | ||||||
|     int16_t len_confirmed = streamGetIntBefore('\n'); |     int16_t len_confirmed = streamGetIntBefore('\n'); | ||||||
|     // ^^ Confirmed number of data bytes to be read, which may be less than |     // ^^ Confirmed number of data bytes to be read, which may be less than | ||||||
|     // requested. 0 indicates that no data can be read. This is actually be the |     // requested. 0 indicates that no data can be read. | ||||||
|     // number of bytes that will be remaining after the read |     // SRGD NOTE:  Contrary to above (which is copied from AT command manual) | ||||||
|  |     // this is actually be the number of bytes that will be remaining in the | ||||||
|  |     // buffer after the read. | ||||||
|     for (int i = 0; i < len_requested; i++) { |     for (int i = 0; i < len_requested; i++) { | ||||||
|       uint32_t startMillis = millis(); |       uint32_t startMillis = millis(); | ||||||
| #ifdef TINY_GSM_USE_HEX | #ifdef TINY_GSM_USE_HEX | ||||||
|   | |||||||
| @@ -457,12 +457,15 @@ class TinyGsmSim800 | |||||||
|   } |   } | ||||||
|  |  | ||||||
|   byte NTPServerSync(String server = "pool.ntp.org", byte TimeZone = 3) { |   byte NTPServerSync(String server = "pool.ntp.org", byte TimeZone = 3) { | ||||||
|  |     // Set GPRS bearer profile to associate with NTP sync | ||||||
|     sendAT(GF("+CNTPCID=1")); |     sendAT(GF("+CNTPCID=1")); | ||||||
|     if (waitResponse(10000L) != 1) { return -1; } |     if (waitResponse(10000L) != 1) { return -1; } | ||||||
|  |  | ||||||
|  |     // Set NTP server and timezone | ||||||
|     sendAT(GF("+CNTP="), server, ',', String(TimeZone)); |     sendAT(GF("+CNTP="), server, ',', String(TimeZone)); | ||||||
|     if (waitResponse(10000L) != 1) { return -1; } |     if (waitResponse(10000L) != 1) { return -1; } | ||||||
|  |  | ||||||
|  |     // Request network synchronization | ||||||
|     sendAT(GF("+CNTP")); |     sendAT(GF("+CNTP")); | ||||||
|     if (waitResponse(10000L, GF(GSM_NL "+CNTP:"))) { |     if (waitResponse(10000L, GF(GSM_NL "+CNTP:"))) { | ||||||
|       String result = stream.readStringUntil('\n'); |       String result = stream.readStringUntil('\n'); | ||||||
| @@ -520,8 +523,10 @@ class TinyGsmSim800 | |||||||
|     //  ^^ Requested number of data bytes (1-1460 bytes)to be read |     //  ^^ Requested number of data bytes (1-1460 bytes)to be read | ||||||
|     int16_t len_confirmed = streamGetIntBefore('\n'); |     int16_t len_confirmed = streamGetIntBefore('\n'); | ||||||
|     // ^^ Confirmed number of data bytes to be read, which may be less than |     // ^^ Confirmed number of data bytes to be read, which may be less than | ||||||
|     // requested. 0 indicates that no data can be read. This is actually be the |     // requested. 0 indicates that no data can be read. | ||||||
|     // number of bytes that will be remaining after the read |     // SRGD NOTE:  Contrary to above (which is copied from AT command manual) | ||||||
|  |     // this is actually be the number of bytes that will be remaining in the | ||||||
|  |     // buffer after the read. | ||||||
|     for (int i = 0; i < len_requested; i++) { |     for (int i = 0; i < len_requested; i++) { | ||||||
|       uint32_t startMillis = millis(); |       uint32_t startMillis = millis(); | ||||||
| #ifdef TINY_GSM_USE_HEX | #ifdef TINY_GSM_USE_HEX | ||||||
|   | |||||||
| @@ -265,14 +265,11 @@ class TinyGsmTCP { | |||||||
|     // data that it wants from the socket even if it was closed externally. |     // data that it wants from the socket even if it was closed externally. | ||||||
|     inline void dumpModemBuffer(uint32_t maxWaitMs) { |     inline void dumpModemBuffer(uint32_t maxWaitMs) { | ||||||
|       TINY_GSM_YIELD(); |       TINY_GSM_YIELD(); | ||||||
|       rx.clear(); |  | ||||||
|       at->maintain(); |  | ||||||
|       uint32_t startMillis = millis(); |       uint32_t startMillis = millis(); | ||||||
|       while (sock_available > 0 && (millis() - startMillis < maxWaitMs)) { |       do { | ||||||
|         at->modemRead(TinyGsmMin((uint16_t)rx.free(), sock_available), mux); |  | ||||||
|         rx.clear(); |         rx.clear(); | ||||||
|         at->maintain(); |         at->modemRead(TinyGsmMin((uint16_t)rx.free(), sock_available), mux); | ||||||
|       } |       } while (sock_available > 0 && (millis() - startMillis < maxWaitMs)); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     modemType* at; |     modemType* at; | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user