You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@plc4x.apache.org by sr...@apache.org on 2023/05/05 11:00:33 UTC

[plc4x] 01/03: fix(plc4go/cbus): decrease wait time if it is a confirmed request to server

This is an automated email from the ASF dual-hosted git repository.

sruehl pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/plc4x.git

commit 922c7218ed49183aad83fbf2debdfa6090ae4121
Author: Sebastian Rühl <sr...@apache.org>
AuthorDate: Fri May 5 11:28:48 2023 +0200

    fix(plc4go/cbus): decrease wait time if it is a confirmed request to server
---
 plc4go/internal/cbus/MessageCodec.go | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/plc4go/internal/cbus/MessageCodec.go b/plc4go/internal/cbus/MessageCodec.go
index cf67bc4acc..53535522c6 100644
--- a/plc4go/internal/cbus/MessageCodec.go
+++ b/plc4go/internal/cbus/MessageCodec.go
@@ -184,8 +184,13 @@ lookingForTheEnd:
 		return nil, err
 	}
 	if indexOfCR+1 == indexOfLF {
+		log.Trace().Msg("pci response for sure")
 		// This means a <cr> is directly followed by a <lf> which means that we know for sure this is a response
 		pciResponse = true
+	} else if indexOfCR >= 0 && int(readableBytes) >= indexOfCR+2 && peekedBytes[+indexOfCR+1] != '\n' {
+		log.Trace().Msg("pci request for sure")
+		// We got a request to pci for sure because the cr is followed by something else than \n
+		requestToPci = true
 	}
 	const numberOfCyclesToWait = 15
 	const estimatedElapsedTime = numberOfCyclesToWait * 10