0

I am using arduino UNO board, with modem sim800l. I want use it to send data to server, but the problem is that my url gets truncated. I tried to overwrite the default limit of this library before and after I include it but I get the same problem.

#define _SS_MAX_RX_BUFF 256
#include <SoftwareSerial.h>
#define _SS_MAX_RX_BUFF 256

My url looks like this:

 mySerial.println("AT+HTTPPARA=\"URL\",\"http://two-words-domain.ro?data1=1&data2=2&data3=3...\""); 

And in the serial I see that the url get truncated somewhere 60-64 characters. Is there any solution for this?

  • SoftwareSerial is compiled separately from your sketch, it is quite sure that your `#define` do not have any effect. You would have to do that in the library. – Tom May 05 '20 at 13:17
  • Instead of trying to change the hardcoded _SS_MAX_RX_BUFF, try to shorten your params, for example instead of `data1=1` to `d1=1`, that will allow you to pack in a few extra params with your url. If that's still not enough, you may want to consider to send the data as part of HTTP body instead of HTTP params. – hcheung May 07 '20 at 00:30

1 Answers1

0

You can't change the buffer like that: the software serial library is already compiled when the compilator reaches your sketch so it won't be compiled using your #define.

In order to change the buffer size, you have to do it in the library. You can find an example of that here (as an extra they are using the same modem).

Hope it helps,

Tom
  • 303
  • 3
  • 14
  • Preprocessor is run before compilation. – gre_gor May 05 '20 at 18:01
  • Yes, but the way the preproc handles it gives no insurance the define will be taken into account *in* the library. The choice of words may be bad but I'm not sure it deserves a down vote. – Tom May 05 '20 at 18:36
  • And the Arduino is not compiling all the libraries each time. I reuses past `.o` compiled files if compilation parameters and libraries files have not changed. – Tom May 05 '20 at 18:41