Browse Source
Field: the Ethernet2UART gateway connection dropped and reconnected
within a second ("Peer Closes Connection!" -> "Connected to ..."), but the
2D sensor stayed offline until la_mojo was restarted.
The sensor was re-initialised (MODE_DETECTOR + handshake) only if its
thread saw the transport's short CS_DISCONNECTED. On a fast reconnect it
did not, and stayed in idle mode, believing the device to be in detector
mode (m_bActualDeviceWM) and only polling getState2. A device that left
detector mode while the link was down was never set back. A restart
starts from MODE_NONE, which is why it helped.
- basicTransport::getConnectEpoch(): +1 on every change to CS_CONNECTED.
- device2DSensor remembers the epoch when it binds its port
(connectMode). validateCommunicationRessource() (every loop pass
above connection mode) runs the connection sequence again when the
epoch changed: "Transport reconnected - re-initialising the sensor".
- deviceETH2UART: "Peer Closes Connection!" says why: "closed by the
gateway" (FIN) or "error: <errno>" (e.g. Connection timed out = sent
data not acknowledged within E2UART_TCP_USER_TIMEOUT_MS), plus the
TCP_INFO figures.
Tested with the real gateway class: a device that goes silent (reconnect
after 5 unanswered requests) and a gateway that closes the connection.
After each reconnect the epoch changes (1 -> 2), so the sensor would
re-initialise, and requests are answered again. The close is logged as
"closed by the gateway; TCP: ...". ASan clean. The full 2D sensor
can't run here.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0139veDo3XyavMuVhdnHcN16
pull/26/head
5 changed files with 49 additions and 1 deletions
Loading…
Reference in new issue