B4R Question rHttpUtils2 uses the LOG automatically

Gerardo Tenreiro

Active Member
Licensed User
Hello,
I am using the rHttpUtils2 module and I see that it sends the status via the LOG without having to use any LOG instruction

I use serial port 1 for other communication and I cannot make the port available for the rHttpUtils2 module to use

Any suggestions on how to remove this from the module?


I also see that the internal version is 1.00 and the external version is 1.60. I only have the module in the EXTERNAL folder
1725818110367.png


Thank you very much
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
I also see that the internal version is 1.00 and the external version is 1.60. I only have the module in the EXTERNAL folder
It is a mistake. It was rESP8266WiFi that was updated. I've fixed it.

v1.01 is attached.
You can disable logs by adding HU2_DISABLE_LOGS as a conditional symbol (Ctrl + B).
 

Attachments

  • rHttpUtils2.b4xlib
    2.2 KB · Views: 33
Upvote 0

Gerardo Tenreiro

Active Member
Licensed User
Thanks Erel, now the log stops showing up but I have another very strange problem, I use this test code to send some parameters to a server and on the seventh send the ESP32 panics.
I leave you the code to which it has to put the credentials of the wifi network and the rest would be operational,

You can see what is happening.

The Error Log
s.length;i++){bulletPoints.innerHTML = replacement;}}</script></body>
</html>
ResponseCache is full (84)
Nombre del Paso : Paso_000
*******************************
*******************************
Inicia Envio ... Buffer Utilizado = 0
trying to connect to: ota-puerta.000webhostapp.com port: 443 ssl: 1
Guru Meditation Error: Core 1 panic'ed (LoadProhibited). Exception was unhandled.
Core 1 register dump:
PC : 0x40173cff PS : 0x00060a30 A0 : 0x800d4af8 A1 : 0x3ffb1e30
A2 : 0x3f2f6ddb A3 : 0x3ffb1e18 A4 : 0x0000003c A5 : 0x00000018
A6 : 0x00000006 A7 : 0x3ffb1e50 A8 : 0x00c000e0 A9 : 0x3ffb1db0
A10 : 0x3f2f6ddb A11 : 0x3f404af4 A12 : 0x0000000a A13 : 0x00000000
A14 : 0x00000065 A15 : 0x00000066 SAR : 0x0000001c EXCCAUSE: 0x0000001c
EXCVADDR: 0x00c000f4 LBEG : 0x40089dcd LEND : 0x40089ddd LCOUNT : 0xffffffff
Backtrace: 0x40173cfc:0x3ffb1e30 0x400d4af5:0x3ffb1e50 0x400d39c9:0x3ffb1e70 0x400d4066:0x3ffb1ef0 0x400d421b:0x3ffb1f20 0x400d47cf:0x3ffb1f60 0x400d3659:0x3ffb2230 0x400d4bae:0x3ffb2250 0x400db48c:0x3ffb2270 0x4008e766:0x3ffb2290
ELF file SHA256: e43820ee29b10d5c
Rebooting...
ets Jul 29 2019 12:21:46
rst:0xc (SW_CPU_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:1
load:0x3fff0030,len:4604
ho 0 tail 12 room 4
load:0x40078000,len:15488



Thank you very much and I really appreciate your great work and the great forum created.

Code
#Region Project Attributes
#AutoFlushLogs : True
#CheckArrayBounds : True
#StackBufferSize : 1024
#End Region

Sub Process_Globals
Public Serial1 As Serial
Private wifi As ESP8266WiFi

Public Ts As Timer
Public Segundo As Byte = 0
Public Minuto As Byte = 0
Public Hora As Byte = 0

Public bc As ByteConverter


Public Maniobras As UInt = 0
Public Horas_Uso As UInt = 0

End Sub

Private Sub AppStart
Serial1.Initialize(115200)
Log("****************************")
Log("Inicia Aplicacion")


Ts.Initialize("Ts_Tick",1000)
Ts.Enabled = True

Conecta_Wifi(0)

End Sub


Sub Ts_Tick
Segundo = Segundo + 1
Horas_Uso = Horas_Uso + 1
If Segundo > 59 Then
Segundo = 0
Minuto = Minuto + 1
If Minuto > 59 Then
Minuto = 0
Hora = Hora + 1
If Hora > 23 Then
Hora = 0
End If
End If
End If
End Sub



Sub Conecta_Wifi(Nada As Byte)
Log("Intentando conectar a la red WIFI")
wifi.Disconnect
wifi.ConnectAsync("xxx", "xxx", 0, Null, "wifi_Connected")
End Sub

Sub WiFi_Connected (Success As Boolean)
If Success = True Then
Log("WIFI Conectada !!!")
Log("La IP es: ",wifi.LocalIp)
Else
Log("No conectado la WIFI, se reintenta")
CallSubPlus("Conecta_Wifi",5000,0)
End If

If Success = True Then
HttpJob.Initialize("Paso_000")
Envia_Estado(0)

End If
End Sub
'
' Envia Estados de la Tarjeta de Control.
' Envia Datos al servidor
' Numero de Serie -> 5 Digitos -> 00000
' Fecha en el ESP32 -> 8 Caracteres -> dd/mm/aa
' Hora en el Servidor -> 8 Caracteres -> hh:mm:ss
' Version Hardware -> -> 4.12.00
' Version Software -> -> 4.12.26a
' Año de Fabricacion -> 4 Digitos -> 2024
' Mes de Fabricacion -> 2 Digitos -> 01
' Numero de Maniobras -> 10 Digitos -> 0000000000
Sub Envia_Estado(Nada As Byte)
Dim Ti As ULong = 0
Dim Amo As Int = 2024
Dim Mes As Int = 1
Dim Numero_Serie As Int = 20

Log("*******************************")
Log("Inicia Envio ... Buffer Utilizado = ",StackBufferUsage )

Dim P0() As Byte = "&".GetBytes
Dim P1() As Byte = JoinBytes(Array ("Amo=".GetBytes,NumberFormat(Amo,4,0).GetBytes))
Dim P2() As Byte = JoinBytes(Array ("Mes=".GetBytes,NumberFormat(Mes,2,0).GetBytes))
Dim P3() As Byte = JoinBytes(Array ("Numero_de_Serie=".GetBytes,NumberFormat(Numero_Serie,5,0).GetBytes))
Dim P4() As Byte = "Fecha=01/01/2024".GetBytes
Dim P5() As Byte = JoinBytes(Array ("Hora=".GetBytes,NumberFormat(Hora,2,0).GetBytes,":".GetBytes,NumberFormat(Minuto,2,0).GetBytes,":".GetBytes,NumberFormat(Segundo,2,0).GetBytes))
Dim P6() As Byte = "Version_H=4.12.00".GetBytes
Dim P7() As Byte = "Version_S=4.12.26a".GetBytes

Maniobras = Maniobras + 1
Dim P8() As Byte = JoinBytes(Array ("Maniobras=".GetBytes,NumberFormat(Maniobras,8,0).GetBytes))
Dim P9() As Byte = JoinBytes(Array ("Horas_Uso=".GetBytes,NumberFormat(Horas_Uso,8,0).GetBytes))

Dim P10() As Byte = JoinBytes(Array (P1,P0,P2,P0,P3,P0,P4,P0,P5,P0,P6,P0,P7,P0,P8,P0,P9))

'Log("Envia ->",bc.StringFromBytes(P9))

Ti = Micros

Envia_Post(P10)

Ti = Micros - Ti
Log("Tiempo Invertido = ",Ti / 1000, " Maniobra = ",Maniobras)

End Sub
'
'
Sub Envia_Post(E() As Byte)
HttpJob.AddHeader("Content-Type", "application/x-www-form-urlencoded")
HttpJob.Post("https://ota-puerta.000webhostapp.com/?key1=value1",E)
End Sub

Sub JobDone (Job As JobResult)

Log("Nombre del Paso : ", Job.JobName)
Log("*******************************")

If Job.Success Then

'Log("Response: ", bc.SubString2(Job.Response, 0, Min(20, Job.Response.Length))) ' Limita a 20 Caracteres

If Job.JobName = "Paso_000" Then
CallSubPlus("Envia_Estado",10000,0)
'HttpJob.Initialize("Paso_001") '
'Log("Cambio a Paso_001")
End If
Else
CallSubPlus("Envia_Estado",5000,0)
Log("++++++ ERROR +++++")
Log("ErrorMessage: ", Job.ErrorMessage)
Log("Status: ", Job.Status)
'Log(Job.Response)
End If
End Sub
 
Upvote 0
Top