Comments (6)
The original implementation returned immediately when the expected number of bytes were received, it only waited for the timeout if bytes were missing. Not sure if that broke with a recent commit or so
from everest-core.
I believe this check:
everest-core/modules/SerialCommHub/tiny_modbus_rtu.cpp
Lines 301 to 305 in c144d56
should be done after this block, not before:
everest-core/modules/SerialCommHub/tiny_modbus_rtu.cpp
Lines 307 to 310 in c144d56
Because, in the current code, if you have reached the buffer space limit, you wait one more select timeout to break out of the loop, instead of breaking out immediately (since no more data is being read anyway).
This is just a visual review, untested.
from everest-core.
As far as I see we always request the response of the maximum possible size
everest-core/modules/SerialCommHub/tiny_modbus_rtu.cpp
Lines 443 to 444 in c144d56
So we always will wait for time out if we want shorter response.
from everest-core.
As far as I see we always request the response of the maximum possible size
everest-core/modules/SerialCommHub/tiny_modbus_rtu.cpp
Lines 443 to 444 in c144d56
So we always will wait for time out if we want shorter response.
The read_reply function will not always fill the buffer, it is just the maximum size
from everest-core.
Because, in the current code, if you have reached the buffer space limit, you wait one more select timeout to break out of the loop, instead of breaking out immediately (since no more data is being read anyway).
This is just a visual review, untested.
Correct, this should be fixed. It should however only occur on transfers with 261 bytes, everything smaller will always have the "within_message_timeval" message timeout
from everest-core.
The default is configurable with a default of 100ms. In many implementations this can probably be reduced quite a bit, but I do not have enough hardware to find a good value. It is the inter character timeout once the peer started to send the reply message. It should be really quick.
If we want to make it faster we would need to calculate before hand how many bytes the reply should be, then we can stop immediatly when those are received without waiting until nothing more is received. We would however need to deal with modbus devices that just send more bytes then expected (this happens).
So for now I'd suggest to just reduce the 100ms timeout in your config if that is too long. You should be able to keep the initial timeout on a larger value. My guess is your power meter takes a long time to respond, but once it has sent the first bytes it will be quick sending the remaining bytes right?
In this case, it should not always wait for the first timeout:
The select should return whenever there is at least one byte available for reading, then the reading should not block and return some bytes (let's assume it was the complete reply).
The loop runs again, waiting for select (but now with the shorter timeout). If that times out, we assume there are no more bytes coming and return.
So there is always the "within_message_timeout_ms" timeout at the end, but it is not very easy to get rid of this one, as the read_reply does not know how many bytes to read. But since this is short, I do not think it is an issue.
@golovasteek Did you find another solution in the mean time? Would that resolve your issue?
from everest-core.
Related Issues (20)
- Support signed meter in EvseManager/Charger
- libiso15118: TLS 1.3 EOF error while performing handshake with libiso15118 HOT 3
- PacketSniffer: Incomplete trace in case of a SIGTERM
- EVSE Paused when using OCPP
- EvseV2G can not encode ServiceDiscoveryRes if both payment options are disabled
- Missing dependencies for cmake target `test`
- sqlite_cpp deprecation warning
- DC SIL remains in the authorization loop despite accepted authorization.
- Everest crashes when sending an OCPP201 InstallCertificate call from OCPP server with invalid data
- 0 kW power delivered while in the Charging phase HOT 1
- IEC 61851-23: 2023 CableCheck changes HOT 1
- EvseV2G: Plug&Charge does not work properly when resumed
- EvseV2G: No reaction if the contract is rejected during authorization HOT 1
- Everest-core Compilation Failure with EvseManager.hpp HOT 3
- python3 -m pip install --upgrade pip setuptools wheel jstyleson jsonschema error. HOT 2
- C++ objects within structure allocated via calloc() HOT 5
- EVSEManager: Module does not stop HLC in case of an unexpected CP state while charging HOT 1
- WIP: Behavior after failed charging sessions
- Setup module support for a wider range of SSID values
- isolation monitor missing Capacitance
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from everest-core.