Seeed-Studio / GPRS_SIM900

library for GPRS shield with sim900 module.
MIT License
138 stars 96 forks source link

Sending sms not working properly #7

Closed zella closed 7 years ago

zella commented 7 years ago

Function return wrong value. Because sms sending can take long time. And default timeouts too small for this check https://github.com/Seeed-Studio/GPRS_SIM900/blob/master/GPRS_Shield_Arduino.cpp#L126 . In my expirience it can take 5, 10 etc sec.

ortegafernando commented 7 years ago

Default timeout is 5 seconds, please, check it again.

zella commented 7 years ago

@ortegafernando Hi, I remember, that the problem was with DEFAULT_INTERCHAR_TIMEOUT 1500. I manually change it to bigger value and it becomes worked.

nexus05 commented 7 years ago

Hi.... I found DEFAULT_INTERCHAR_TIMEOUT in these 2 lines in GPRS_Shield_Arduino.cpp Line 757: if(!sim900_wait_for_resp("SEND OK\r\n", DATA, DEFAULT_TIMEOUT 10, DEFAULT_INTERCHAR_TIMEOUT 10)) {
Line 843: sim900_read_buffer(gprsBuffer,sizeof(gprsBuffer),2DEFAULT_TIMEOUT,6DEFAULT_INTERCHAR_TIMEOUT);

I cant find 1500 anywhere....could you please be more specific

Thanx...

zella commented 7 years ago

@ortegafernando It's about https://github.com/Seeed-Studio/GPRS_SIM900/blob/master/GPRS_Shield_Arduino.cpp#L126. It has 1500 default value without params. Sorry, I forgot more details, but remeber, that i debug sim900_wait_for_resp and it randomly fails on chartimeout check. On next 1-2 week, i starts new project and can provide more details.