ArduinoModbus
ArduinoModbus copied to clipboard
don't wait for confirmation response if the write is a broadcast message
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?
Memory usage change @ df2ffbeb7c09208cd34db1210a2f4e7e0f509f48
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 |
:small_red_triangle: 0 - +24 | 0.0 - +0.05 | 0 - 0 | 0.0 - 0.0 |
arduino:samd:mkrwifi1010 |
:small_red_triangle: 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
I've just found this issue upstream and PR https://github.com/stephane/libmodbus/pull/467
If that is the case, then shouldn't this PR be closed?
Yeah I guess, though I'm still having to use this as a patch as its not actually been merged in upstream.
Gotcha, makes sense. I suppose that also assumes that the libmodbus would also need to be updated in this two too.
On Wed, Jan 3, 2024 at 04:46 bobemoe @.***> wrote:
Yeah I guess, though I'm still having to use this as a patch as its not actually been merged in upstream.
— Reply to this email directly, view it on GitHub https://github.com/arduino-libraries/ArduinoModbus/pull/118#issuecomment-1875169547, or unsubscribe https://github.com/notifications/unsubscribe-auth/AISWKL7P3CEC5G3NX2XTU3LYMUZINAVCNFSM6AAAAAA24YKYI6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQNZVGE3DSNJUG4 . You are receiving this because you commented.Message ID: @.***>
-- PanzerFowst™
"When life gives you lemons, BLOW 'EM UP!!" --Natsu Dragneel