B4R Question memory limit b4r/ESP?

MbedAndroid

Well-Known Member
Licensed User
Longtime User
i'm trying to decrypt the p1 output from the electricity meter.
With debugging the program crashes after a few testlines. The amount of lines seems to be the problem.
I thought the ESP has enough memory to run a simple program
example:
B4X:
Private Sub Timer1_Tick
'   Dim s()="1-0:1.8.1(003808.351*kWh)" As Byte
'   Dim buffer As String=JoinStrings(Array As String(wifi.LocalIp ,",","P1",",",bc.HexFromBytes(MacAddress),",",s))
'   usocket.BeginPacket(ip, port)
'   usocket.Write(buffer)
'   usocket.SendPacket
   Dim s()="1-0:1.8.1(003808.351*kWh)" As Byte
   Log(Parsing(s,"1-0:1.8.1"))
   s="1-0:1.8.2(002948.827*kWh)"
   Log(Parsing(s,"1-0:1.8.2"))
   s="1-0:2.8.1(001285.951*kWh)"
   Log(Parsing(s,"1-0:2.8.1"))
   s="1-0:2.8.2(002876.514*kWh)"
   Log(Parsing(s,"1-0:2.8.2"))
   s="0-0:1.0.0(101209113020W)"
   Log(Parsing(s,"0-0:1.0.0"))
   s="1-0:1.7.0(01.193*kW)"
   Log(Parsing(s,"1-0:1.7.0"))
   s="1-0:2.7.0(00.010*kW)"
   Log(Parsing(s,"1-0:2.7.0"))
   Dim s()="0-1:24.2.1(101209112500W)(12785.123*m3)" As Byte
   Log(Parsing(s,"0-1:24.2.1"))
   Dim s()="0:96.14.0(0002)" As Byte
   Log(Parsing(s,"0:96.14.0"))
   Log("packed send")

End Sub
It's independed what line i exclude, simply too much lines will crash the program
with 6 lines it runs fine, more:crash
also i tried to dim each static line, makes no difference

edit increased the stackbuffersize to 400, helps a lot
 
Last edited:

thetahsk

Active Member
Licensed User
Longtime User

I think your declaration of your byte array is wrong, it must be

B4X:
Private Sub Timer1_Tick
 Dim s() As Byte = "1-0:1.8.1(003808.351*kWh)"
 ......
End Sub
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…