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.

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")
    ........
 

Attachments

  • Log.txt
    207.5 KB · Views: 283

sasetcolombia

Member
Licensed User
Longtime User
(for TTGO TCALL SIM800L....)

1.USB communication
I have changed from:


Config USB Port:
Serial0.Initialize(115200)
astreamcom.Initialize(Serial0.Stream, "AstreamCom_NewData", "AstreamCom_Error")
to this code:
Nueva Configuración Puerto USB:
Serial1.Initialize(115200)
astream.Initialize(Serial1.Stream, "astream_NewData", "astream_Error")
USB communication works correctly

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

Configuración Anterior Puerto Serial (2,4):
 RunNative("SerialNative1", Null)
 astream1.Initialize(SerialNative1,"AStream1_NewData", "Astream1_Error")
To this code:
Nueva Configuración Puerto Serial (2,4)-Sensores:
RunNative("SerialNative2", Null)

    astream1.Initialize(SerialNative2,"AStream1_NewData", "Astream1_Error")
Code IN C
Códe In C:
#if C
void SerialNative2(B4R::Object* unused)
{
::Serial2.begin(9600,SERIAL_8N1,2,4);
b4r_main::_serialnative2->wrappedStream = &::Serial2;
}
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


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 IN C
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

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

  • AgriculticTest.zip
    6.8 KB · Views: 279
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…