B4R Question b4r_main.cpp:242:104: error: invalid conversion from 'void (*)(B4R::Array*)' to 'B4R::SubVoidVoid {aka void (*)()}' [-fpermissive]

sasetcolombia

Member
Licensed User
Longtime User
I need to establish a serial communication through the main port of ESP32 (I am using the TTGO TCALL SIM800L module).

SerialNative2 is used to communicate with the SIM800L and it works properly.

SerialNative1 is used to receive serial data sent from a sensor module and works correctly

If I add the following line (to configure serial1)
astreamcom.Initialize (Serial0.Stream, "AstreamCom_NewData", "AstreamCom_Error")
I get this error:
b4r_main.cpp:242:104: error: invalid conversion from 'void (*)(B4R::Array*)' to 'B4R::SubVoidVoid {aka void (*)()}' [-fpermissive]

If I comment out that line, the code compiles correctly.
(astreamcom is of type AsyncStreams)


What is wrong with the configuration?
Thank you for your answers.

[CODE lang="b4x" title="Serial COnfig"]'PUERTO SERIAL SIM800L
#if C
//Puerto Serial SIM800L
void SerialNative2(B4R::Object* unused)
{
::Serial2.begin(4800,SERIAL_8N1,26,27);
b4r_main::_serialnative2->wrappedStream = &::Serial2;
}
#End If

'PUERTO SERIAL MÓDULO SENSORES
'RX=2, TX=4
#if C
void SerialNative1(B4R::Object* unused){
::Serial1.begin(9600, SERIAL_8N1, 2, 4);
b4r_main::_serialnative1->wrappedStream = &::Serial1;
}
#End If
'**************************************************************************
Private Sub AppStart
'**********************************
'GESTIÓN PUERTO USB
Serial0.Initialize(115200)
astreamcom.Initialize(Serial0.Stream, "AstreamCom_NewData", "AstreamCom_Error")
'GESTION MODEM SIM800L
RunNative("SerialNative2", Null)
astream.Initialize(SerialNative2,"Astream_NewData", "Astream_Error")

'PUERTO SERIAL MÓDULO SENSORES
RunNative("SerialNative1", Null)
astream1.Initialize(SerialNative1,"AStream1_NewData", "Astream1_Error")
........[/CODE]
 

Attachments

(for TTGO TCALL SIM800L....)

1.USB communication
I have changed from:


[CODE lang="b4x" title="Config USB Port"]Serial0.Initialize(115200)
astreamcom.Initialize(Serial0.Stream, "AstreamCom_NewData", "AstreamCom_Error")[/CODE]
to this code:
[CODE lang="b4x" title="Nueva Configuración Puerto USB"]Serial1.Initialize(115200)
astream.Initialize(Serial1.Stream, "astream_NewData", "astream_Error")[/CODE]
USB communication works correctly

2.
SERIAL PORT- MÓDULO SENSORES
I have changed from:

[CODE lang="b4x" title="Configuración Anterior Puerto Serial (2,4)"] RunNative("SerialNative1", Null)
astream1.Initialize(SerialNative1,"AStream1_NewData", "Astream1_Error")[/CODE]
To this code:
[CODE lang="b4x" title="Nueva Configuración Puerto Serial (2,4)-Sensores"]RunNative("SerialNative2", Null)

astream1.Initialize(SerialNative2,"AStream1_NewData", "Astream1_Error")[/CODE]
Code IN C
[CODE lang="b4x" title="Códe In C"]#if C
void SerialNative2(B4R::Object* unused)
{
::Serial2.begin(9600,SERIAL_8N1,2,4);
b4r_main::_serialnative2->wrappedStream = &::Serial2;
}[/CODE]
Serial Communication work correctly

3.SERIAL PORT TO SIM800L (pins 26 and 27 of TTGO TCALL)
Not work!
same error is displayed!

This is the configuration


[CODE lang="b4x" title="Configuración actual Puerto Serial SIM800L(26,27)"]''GESTION MODEM SIM800L
'RX=26,TX=27
RunNative("SerialNative0", Null)
astream0.Initialize(SerialNative0,"Astream0_NewData", "Astream0_Error")[/CODE]
Code IN C
[CODE lang="b4x" title="Code In C-Serial Port-Sim800L"]'PUERTO SERIAL SIM800L
'#IF C
'void SerialNative0(B4R::Object* unused)
'{
'::Serial1.begin(4800,SERIAL_8N1,26,27); //<--You can change the baud rate
'b4r_main::_serialnative0->wrappedStream = &::Serial1;
'}
'#END IF
#IF C
void SerialNative0(B4R::Object* unused) {
::Serial.begin(4800,SERIAL_8N1,26,27); //<--You can change the baud rate
b4r_main::_SerialNative0->wrappedStream = &::Serial;
}
#END IF[/CODE]

I need to configure the serial port on pins 26 and 27,to have communication with the SIM800L modem.

Attached Test Project


thanks for your reply!
 

Attachments

Upvote 0
Back
Top