Giter VIP home page Giter VIP logo

Comments (8)

yaacov avatar yaacov commented on August 16, 2024

Great !
a. can you make a pull request ?
b. can you add this case to the tests ?

from node-modbus-serial.

SuperJojo2001 avatar SuperJojo2001 commented on August 16, 2024

Hello Yaacov,

before I pull ... and excuse me that I am asking ... I want to understand the current code and what was the initial intention about it in order not destroy your "basic thinking" with my code.

In the buffer examining loop I see the code line
if (unitId !== self._id) continue;
So it loops until it finds the unitid as initial char in the load of the RX buffer ... am I correct that you intended to create a kind of synchronization of where a modbus receive telegram starts in the current load of the RX buffer? Please confirm.

Cause if answer is yes I do have doubts that this will work, cause in my life example you see that also modbus data itself can have the same combo set of unitid and function code. So with this method you will never detect a start of frame securely. Do you agree?

Also I recognized that you are checking for the length of an exception message ... you check for (0x80 | self.cmd) ... this is fine for me ... but don't you agree that the examination of just the unitid and function code | 0x80 you can never be 100% sure that is a real exception message without having also the checksum checked at this point?

from node-modbus-serial.

SuperJojo2001 avatar SuperJojo2001 commented on August 16, 2024

Hello Yaacov,

i have another dumb question.

Let us suppose I have a "bad working" Modbus RTU slave online that responds instead of an exception or a valid frame with endless chars like e.g. "aaaaaaaa....." forever and forever ... or frames that are anything else than Modbus RTU frames ... in this case the reception "self._buffer" will grow and grow and finally would generate if you wait long enough a "out of memory" error. Do you agree?

So we need also a mechanism to "throw" away frames that are no modbus frames. Do you agree?

from node-modbus-serial.

yaacov avatar yaacov commented on August 16, 2024

hi,

a. Yes, we need to deal with modbus frames that start not at the beginning of buffer.
b. Out of memory is something important to fix, maybe in a different pull request ?
c. Make the best you can do, if the tests work, it will be ok, if it start break things that we miss in the test, we will fix it again.

p.s.
Their is always a trade-off between something that we can do and works good, and something that is perfect, but we do not have time to do ... :-)

from node-modbus-serial.

SuperJojo2001 avatar SuperJojo2001 commented on August 16, 2024

Hi, I finished development but before I am pulling it I want to test it with the test environment

This is why I have extended the rtubufferedport.test.js file locally with my life example above.

But when I start it with "node rtubufferedport.test.js" it runs and exits without any feedback. How do I start this test correctly?

from node-modbus-serial.

yaacov avatar yaacov commented on August 16, 2024

run (from root of prject)
npm test

from node-modbus-serial.

yaacov avatar yaacov commented on August 16, 2024

p.s.
a. when you do a pull request, tests are run automatically.
b. other people can see what you are doing and comment about it.

from node-modbus-serial.

yaacov avatar yaacov commented on August 16, 2024

fixed by #60 and #59

from node-modbus-serial.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.