diff options
author | Karsten Heimrich <karsten.heimrich@qt.io> | 2021-01-12 11:48:44 +0100 |
---|---|---|
committer | Karsten Heimrich <karsten.heimrich@qt.io> | 2021-01-29 15:33:27 +0100 |
commit | c990bdbf8ec922dd7702a2a0e33b9b70db3ac6ee (patch) | |
tree | d59427fed587c8407740fc4048dd12ef020fb144 /src/serialbus/qmodbusrtuserialmaster_p.h | |
parent | 99e8ee9877db25e1a5fa2bf5ce51a694bb70c461 (diff) |
Allow setting the RTU inter frame delay on slaves as well
Fixes: QTBUG-89995
Change-Id: I401d2511b336367801d941ec1f5e06cc4cd6cd08
Reviewed-by: André Hartmann <aha_1980@gmx.de>
Diffstat (limited to 'src/serialbus/qmodbusrtuserialmaster_p.h')
-rw-r--r-- | src/serialbus/qmodbusrtuserialmaster_p.h | 24 |
1 files changed, 0 insertions, 24 deletions
diff --git a/src/serialbus/qmodbusrtuserialmaster_p.h b/src/serialbus/qmodbusrtuserialmaster_p.h index 547aea7..9675611 100644 --- a/src/serialbus/qmodbusrtuserialmaster_p.h +++ b/src/serialbus/qmodbusrtuserialmaster_p.h @@ -318,29 +318,6 @@ public: }); } - /*! - According to the Modbus specification, in RTU mode message frames - are separated by a silent interval of at least 3.5 character times. - Calculate the timeout if we are less than 19200 baud, use a fixed - timeout for everything equal or greater than 19200 baud. - If the user set the timeout to be longer than the calculated one, - we'll keep the user defined. - */ - void calculateInterFrameDelay() - { - // The spec recommends a timeout value of 1.750 msec. Without such - // precise single-shot timers use a approximated value of 1.750 msec. - int delayMilliSeconds = 2; - if (m_baudRate < 19200) { - // Example: 9600 baud, 11 bit per packet -> 872 char/sec - // so: 1000 ms / 872 char = 1.147 ms/char * 3.5 character - // Always round up because the spec requests at least 3.5 char. - delayMilliSeconds = qCeil(3500. / (qreal(m_baudRate) / 11.)); - } - if (m_interFrameDelayMilliseconds < delayMilliSeconds) - m_interFrameDelayMilliseconds = delayMilliSeconds; - } - void setupEnvironment() { if (m_serialPort) { @@ -437,7 +414,6 @@ public: QQueue<QueueElement> m_queue; QSerialPort *m_serialPort = nullptr; - int m_interFrameDelayMilliseconds = 2; // A approximated value of 1.750 msec. int m_turnaroundDelay = 100; // Recommended value is between 100 and 200 msec. }; |