Issue i cant fix. Maybe a WiFi library issue
svdrummer opened this issue · 0 comments
Hello all.
I have spent ages on this including google, with no success.
I have client software on other ESP devices that log onto this server ESP32..so far so good.
Serial data is fed into the serial port and sent out to any connected ESP, which in turn is send via that ESP's serial port. A serial bridge if you will. Any data fed into the sever serial port, is streamed out to the other client serial ports.
My Issue
My repeatable issue is, if I have a few ESP's connected to the server and one is unplugged or resets, all serial data just stops. I am guessing the server is waiting for that client to connect.
THE QUESTION
Does anyone know a good way to have a client ignored vie the telnetstream? ie just keep sending to the other ports.
The code below is stripped down just to show the function
//###################################
#include <WiFi.h>
#include <TelnetStream.h>
#include <SoftwareSerial.h>
#define serial_2_rx 23 //ESP32
TelnetStreamClass telnet1(10112);
/////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////
void readSerial2() {
while (Serial2.available()) {
char c2 = Serial2.read();
telnet1.print(c2);
Serial.print(c2);
}
}
////////// SETUP ////////////////
void setup() {
Serial.begin(115200);
Serial2.begin(9600, SERIAL_8N1, serial_2_rx, -1);
// WiFi.softAP("test", "");
// put your setup code here, to run once:
WiFi.softAP("test", "");
telnet1.begin();
Serial.println("Connected to the WiFi network");
}
////////////////// LOOP /////////////////////////
void loop() {
readSerial2();
}