Hi, All
My app for ESP8266 has a huge sub preparing JSON to send to a server. It makes the string only if "#StackBufferSize: 700", bigger value does not help.
So JSON string is made OK, but HttpJob cannot be posted - error. It works if to send some short text, the server responds OK.
So, how to optimize memory usage in this situation ?
My app for ESP8266 has a huge sub preparing JSON to send to a server. It makes the string only if "#StackBufferSize: 700", bigger value does not help.
So JSON string is made OK, but HttpJob cannot be posted - error. It works if to send some short text, the server responds OK.
B4X:
Public Sub Send_Save_Log
HttpJob.Initialize("API_SAVE_logs")
Dim text() As Byte = "{""action"":""savearray"",""scanner"":""%SCANNERNAME%"",""key"":""%KEY%"",""timestamp"":%TIMESTAMP%,""dbtable"":""logs"",""data"":{""0"":{""scanner_name"":""%SCANNERNAME%"",""time"":""%TIME%"",""stamp"":""mcu"",""text"":""%TEXT%"",""type"":""%TYPE%""}}}"
Dim text1() As Byte = others.ReplaceString(text, "%SCANNERNAME%", Main.bc.HexFromBytes(others.MacArray))
Dim text2() As Byte = others.ReplaceString(text1, "%KEY%", API_KEY)
Dim tz As String = others.TimeZone
Dim text3() As Byte = others.ReplaceString(text2, "%TIMESTAMP%", tz)
Dim text4() As Byte = others.ReplaceString(text3, "%TIME%", tz)
Dim text5() As Byte = others.ReplaceString(text4, "%TEXT%", others.Collect_Info)
Dim b(1) As Byte
b(0) = 0
Dim text6() As Byte = others.ReplaceString(text5, "%TYPE%", b)
Log("text = ", text6)
HttpJob.Post(URL, text6)
End Sub
B4X:
trying to connect to: server.com port: 80 ssl: 0
--------------- CUT HERE FOR EXCEPTION DECODER ---------------
Exception (9):
epc1=0x402370d3 epc2=0x00000000 epc3=0x00000000 excvaddr=0x0204011b depc=0x00000000
So, how to optimize memory usage in this situation ?
Last edited: