Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

don't wait for confirmation response if the write is a broadcast message #118

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

bobemoe
Copy link

@bobemoe bobemoe commented Jul 29, 2023

Fixes #117

I added a condition ctx->slave!=0 so that a response is not expected if its a broadcast message. This allows the endTransmission to return asap without blocking waiting for a response that will never come and eventually timing out.

I added this to modbus_write_bits and modbus_write_registers which are the only 2 functions called by endTransmission

This has fixed issue #117 for me.

Not sure if this may need to be added in any other places?

don't wait for confirmation response if the write is a broadcast (slave==0) message
@CLAassistant
Copy link

CLAassistant commented Jul 29, 2023

CLA assistant check
All committers have signed the CLA.

@github-actions
Copy link

Memory usage change @ df2ffbe

Board flash % RAM for global variables %
arduino:mbed_nano:nano33ble 0 - 0 0.0 - 0.0 0 - 0 0.0 - 0.0
arduino:mbed_opta:opta 0 - 0 0.0 - 0.0 0 - 0 0.0 - 0.0
arduino:mbed_portenta:envie_m7 N/A N/A N/A N/A
arduino:megaavr:uno2018:mode=off 🔺 0 - +24 0.0 - +0.05 0 - 0 0.0 - 0.0
arduino:samd:mkrwifi1010 🔺 0 - +16 0.0 - +0.01 0 - 0 0.0 - 0.0
Click for full report table
Board examples/RTU/ModbusRTUClientKitchenSink
flash
% examples/RTU/ModbusRTUClientKitchenSink
RAM for global variables
% examples/RTU/ModbusRTUClientParameters
flash
% examples/RTU/ModbusRTUClientParameters
RAM for global variables
% examples/RTU/ModbusRTUClientToggle
flash
% examples/RTU/ModbusRTUClientToggle
RAM for global variables
% examples/RTU/ModbusRTUServerKitchenSink
flash
% examples/RTU/ModbusRTUServerKitchenSink
RAM for global variables
% examples/RTU/ModbusRTUServerLED
flash
% examples/RTU/ModbusRTUServerLED
RAM for global variables
% examples/RTU/ModbusRTUTemperatureSensor
flash
% examples/RTU/ModbusRTUTemperatureSensor
RAM for global variables
% examples/TCP/EthernetModbusClientToggle
flash
% examples/TCP/EthernetModbusClientToggle
RAM for global variables
% examples/TCP/EthernetModbusServerLED
flash
% examples/TCP/EthernetModbusServerLED
RAM for global variables
% examples/TCP/WiFiModbusClientToggle
flash
% examples/TCP/WiFiModbusClientToggle
RAM for global variables
% examples/TCP/WiFiModbusServerLED
flash
% examples/TCP/WiFiModbusServerLED
RAM for global variables
%
arduino:mbed_nano:nano33ble 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0
arduino:mbed_opta:opta 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0
arduino:mbed_portenta:envie_m7 N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A
arduino:megaavr:uno2018:mode=off 24 0.05 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0
arduino:samd:mkrwifi1010 16 0.01 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0
Click for full report CSV
Board,examples/RTU/ModbusRTUClientKitchenSink<br>flash,%,examples/RTU/ModbusRTUClientKitchenSink<br>RAM for global variables,%,examples/RTU/ModbusRTUClientParameters<br>flash,%,examples/RTU/ModbusRTUClientParameters<br>RAM for global variables,%,examples/RTU/ModbusRTUClientToggle<br>flash,%,examples/RTU/ModbusRTUClientToggle<br>RAM for global variables,%,examples/RTU/ModbusRTUServerKitchenSink<br>flash,%,examples/RTU/ModbusRTUServerKitchenSink<br>RAM for global variables,%,examples/RTU/ModbusRTUServerLED<br>flash,%,examples/RTU/ModbusRTUServerLED<br>RAM for global variables,%,examples/RTU/ModbusRTUTemperatureSensor<br>flash,%,examples/RTU/ModbusRTUTemperatureSensor<br>RAM for global variables,%,examples/TCP/EthernetModbusClientToggle<br>flash,%,examples/TCP/EthernetModbusClientToggle<br>RAM for global variables,%,examples/TCP/EthernetModbusServerLED<br>flash,%,examples/TCP/EthernetModbusServerLED<br>RAM for global variables,%,examples/TCP/WiFiModbusClientToggle<br>flash,%,examples/TCP/WiFiModbusClientToggle<br>RAM for global variables,%,examples/TCP/WiFiModbusServerLED<br>flash,%,examples/TCP/WiFiModbusServerLED<br>RAM for global variables,%
arduino:mbed_nano:nano33ble,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0
arduino:mbed_opta:opta,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0
arduino:mbed_portenta:envie_m7,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,,,,,,,,
arduino:megaavr:uno2018:mode=off,24,0.05,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0
arduino:samd:mkrwifi1010,16,0.01,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0

@per1234 per1234 added type: imperfection Perceived defect in any part of project topic: code Related to content of the project itself labels Jul 29, 2023
@bobemoe
Copy link
Author

bobemoe commented Jul 30, 2023

I've just found this issue upstream and PR stephane/libmodbus#467

@PanzerFowst
Copy link

If that is the case, then shouldn't this PR be closed?

@bobemoe
Copy link
Author

bobemoe commented Jan 3, 2024

Yeah I guess, though I'm still having to use this as a patch as its not actually been merged in upstream.

@PanzerFowst
Copy link

PanzerFowst commented Jan 3, 2024 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: code Related to content of the project itself type: imperfection Perceived defect in any part of project
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Broadcast transmission blocks for TIMEOUT ms
4 participants