Giter Site home page Giter Site logo

Comments (4)

robogeek avatar robogeek commented on May 27, 2024

I changed typeof data == "object" to typeof data === "object" and now get this:

$ sudo node mstemp.js 
<< automaton-123 0x[ 01, 04, 00, 01, 00, 01, 60, 0A ]
>> automaton-123 0x[ 01, 04, 02, 0C, 0F, FC, 34 ]
{ slaveId: 1,
  crc: 13564,
  expected_crc: 13564,
  pdu: <Buffer 04 02 0c 0f>,
  callback: [Function],
  response: { code: 'ReadInputRegisters', data: [ <Buffer 0c 0f> ] } }

This looks like a successful query -- I just need to do a bit of work to decode the value.

The same issue, using == instead of ===, exists in both the Request and Response functions.

from stream.

dresende avatar dresende commented on May 27, 2024

There's something missing there. It seems you might have replied in a way the module is not expecting. Do you have a complete example? Also, try the latest version as I fixed some bugs lately.

from stream.

dresende avatar dresende commented on May 27, 2024

I changed typeof data == "object" to typeof data === "object" and now get this:

This shouldn't be the reason you now get a valid response.

In your initial comment you had this:

>> automaton-123 0x[ 01, 04, 02, 0C ]

Which is an incomplete response. In your last comment you have the complete one:

>> automaton-123 0x[ 01, 04, 02, 0C, 0F, FC, 34 ]

Your data is there (0x0C, 0x0F), you can also see it in the object your printed. If that's a complete register and it is (u)int16 big endian, that would be 3087 (or 308,7 or 30,87 or .... if it's not in engineering units). You can read this data using the common Buffer methods.

from stream.

dresende avatar dresende commented on May 27, 2024

Please reopen if you find any problems.

from stream.

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.