Receive messages via wifi with interrupt while executing main loop
Posted: Mon Jun 29, 2020 1:19 pm
Good day!
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)
This above code has to be changed as follows. So that the messages are received while running the main loop. If I hard code msg_list, then the code works as expected.
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
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)
- //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
- }
- }
- }
- }
- //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