Telnet communication problem with ESP chip.
Hi! I am new at this forum. Used search but didn’t find actual information for my question.
I got issue with communuication with ESP6266 over telnet.
Exactly it work but terminal is unreadable. To fix it need parse input buffer.
If string start with ‘<’ dont send it to buffer until got ‘>’ or disconnect by timeout.
Firmware grbl 1.1 detected
h ['$
' for
hel
p]
Idle|MPo
s:44.
000,
40.000,0
.000|FS:0
,0|WCO:0.000,0.000,0.000>
s:44.
000,4
0.000,
0.000
|FS:0,0|O
v:100,1
00,100>
Idle|MPo
s:44.
000,40.000,0.0
00|FS:0,0
>
Idle|MPo
s:44.000,
40.0
00,0.0
00|FS:0,
0>
Idle|MPo
s:44.000,
40.000,0
.000|
FS:0,
0>
Idle|MPo
s:44.
000,4
0.000,0.000|F
S:0,0>
Idle|MPos:44.
000,4
0.000,0.000|FS:0
,0>
Idle|MPo
s:44.000,4
0.000,0.000|FS:0,0>
Idle|MPo
s:44.0
00,40
.000,
0.000|FS:0,0
>
s:44
.000,4
0.000
,0.000|FS:0,0
>
os:44
.000,
40.00
0,0.0
00|FS
:0,0|
WCO:0.
000,0.000,0.000
>
Idle|MPo
s:44
.000,
40.0
00,0.
000|
FS:0,
0|Ov:100
,100,100>
Idle|MPo
s:44.
000,40.0
00,0.000|FS:0
,0>
Idle|MPo
s:44.
000,4
0.000,0.0
00|FS:0,0>
Idle|MPo
s:44.000,4
0.000
,0.0
00|FS
:0,0>
Idle|MPo
s:44.0
00,40.000,0.
000|FS
:0,0>
This is esp telenet firmware project link
https://github.com/nekdfl/UartNetBridge
All data going directly from uart to tcp socket and from tcp socket to uart.
telnetbridge.cpp
from serial to TCP
void TelnetBridge::serialWatcher()
{
if (isHaveClient())
{
size_t rxlen = Serial.available();
if (rxlen > 0)
{
uint8_t sbuf[rxlen];
Serial.readBytes(sbuf, rxlen);
m_telnetclient.write(sbuf, rxlen);
}
}
}
from TCP to serial
void TelnetBridge::manageConnected()
{
size_t rxlen = m_telnetclient.available();
if (rxlen > 0)
{
uint8_t sbuf[rxlen];
m_telnetclient.readBytes(sbuf, rxlen);
Serial.write(sbuf, rxlen);
}
}