Im using an ESP32 Wroom32 receiving messages and executing them. The use case needs the messages to be received while the main program is running.
Code as is now: (runs properly)
Code: Untitled.cpp Select all
//initial code
setup()
{
//wifi, server settings
}
main(){
WiFiClient client = server.available();
byte msg_full[40];
if (client)
{
Serial.println("Client connected");
while (client.connected())
{
msg= client.read();
msg_full = process_msg(&msg, client); //Returns a 0 array if msg is incorrect or has error. msg_full is full message
if (msg_full [0] != 0) //Runs only if msg_full is not zero ie, valid
{
msg_run(msg_full);
//msg_full is set to zero again
}
}
}
}
Code: Untitled.cpp Select all
//initialisations
/
setup()
{
//wifi, server settings
}
main()
{
WiFiClient client = server.available();
byte msg_full[40];
byte msg_list[50][40];
int count = 0;
if (count != 0)
{
msg_run(msg_list[0]);
//Decrement count
//Move msgs in msg_list by 1 row above
}
}
def msg_rx_interrupt(int msg, WiFiClient& client_connected)
{
If (client_connected.connected())
{
msg = client_connected.read();
msg_full = process_msg(&msg, client_connected); //Returns a 0 array if msg is incorrect or has error. msg_full is full message
//add new msg_full to msg_list
//count = count + 1
}
}
Which Interrupt do I assign the function msg_rx_interrupt to?
https://docs.espressif.com/projects/esp ... /wifi.html does not list/document any receive/transmit events or interrupts