Coder Social home page Coder Social logo

Comments (5)

lvgithub avatar lvgithub commented on May 20, 2024

stick/index.js

Line 130 in d249d0b

dataLen = headBuffer.readInt16BE() + _dataHeadLen;

dataLen = headBuffer.readInt16BE() + _dataHeadLen;
改成
dataLen = headBuffer.readInt16LE() + _dataHeadLen;

from stick.

lvgithub avatar lvgithub commented on May 20, 2024

代码已经升级支持配置大端和小端接收,见readme。支持对包头长度的定义
const stick = new Stick( {bufferLength:1024} ).setReadIntBE(16);
const stick = new Stick( {bufferLength:1024} ).setReadIntLE(16);
const stick = new Stick( {bufferLength:1024} ).setReadIntBE(32);
const stick = new Stick( {bufferLength:1024} ).setReadIntBE(36);

from stick.

songhongjiang avatar songhongjiang commented on May 20, 2024

谢谢!!!

from stick.

songhongjiang avatar songhongjiang commented on May 20, 2024

代码里有点问题
将 /**
* 设置小端接收
* type:16 包头长度为2,short类型
* type:32 包头长度为4,int类型
/
this.setReadIntLE = function (type) {
_readIntMethod = 'readInt' + type + 'lE'
return this
}
改成
/
*
* 设置小端接收
* type:16 包头长度为2,short类型
* type:32 包头长度为4,int类型
*/
this.setReadIntLE = function (type) {
_readIntMethod = 'readInt' + type + 'LE';
(+type === 16) && (_dataHeadLen = 2);
(+type === 32) && (_dataHeadLen = 4)
return this
}

好了

from stick.

lvgithub avatar lvgithub commented on May 20, 2024

谢谢,已修复

from stick.

Related Issues (13)

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.