Giter VIP home page Giter VIP logo

Comments (11)

simenkid avatar simenkid commented on July 18, 2024 3

Hello kilianyusinyu,

I think I found the problem. The npm module did not direct to its repository properly (you will always install a v0.0.5 package). I just fix the link to the correct repository. You may like npm install [email protected] to ensure the lastest release is installed on your host.

Sorry, it's my fault.

from cc-znp.

jackchased avatar jackchased commented on July 18, 2024 1

Hi kilianyusinyu,

Sorry for the inconvenience. There is not event loop problem, the problem is stream broken in lower layer. We already fixed it, and tested. It should be ok. Would you please try it again, thanks :-)

(The package is now updated to v0.0.7)

from cc-znp.

jackchased avatar jackchased commented on July 18, 2024 1

Hi kilianyusinyu,

The following code is test ok.

const ccznp = require('cc-znp');
const spCfg = {
    path: '/dev/ttyACM0',
    options: {
        baudrate: 115200,
        flowControl: true,
        rtscts: true
    }
};

ccznp.on('ready', () => {  
    console.log('Device is ready.');

    ccznp.sapiRequest('startRequest', {}, () => {
    });
});

ccznp.on('AREQ', (Ind) => {
    // { subsys: 'ZDO', ind: 'stateChangeInd', data: { state: 8 } }
    console.dir(Ind);

    var data = Ind.data;
    if (data.state === 9) {
        ccznp.sapiRequest('permitJoiningRequest', {destination: 0xFFFC, timeout: 0xAA}, (error, result) => {
            if (error) {
                throw error;
            }

            // Verify the results
            console.log(result);
        });
    }
});

ccznp.init(spCfg, (error) => {
    console.log(error);
});

ccznp.on('close', function() {
    console.log('Serial port closed.');
});

and result:
1

from cc-znp.

simenkid avatar simenkid commented on July 18, 2024

Hi kilianyusinyu,

Thanks for your feedback. We encountered an issue of messages processing performance in RaspPi-2 before, so I was wondering if BBB has the same problem. I just extend the request timeout from 3 seconds to 20 seconds, and npm publish to version 0.0.5. Would you please try it again?

By the way, did you call reset in your script? Since reset will break the connection from cc2531 to your host, and many requests will be pended until they are timed out. (Just a notice for you if you are using cc2531)

from cc-znp.

kyusinyu avatar kyusinyu commented on July 18, 2024

Hi simenkid,

Many thanks for your quick response! The request timeout change from 3 to 20 seconds is quite noticeable with the new version 0.0.5 and I have tested again several times. Unfortunately, the problem still persists and I only get good results after several runs, whereby each run yields a timeout error after which one (i.e. the last run) suddenly yields expected results without any timeout errors - exactly as already described above. I guess the problem lies elsewhere inside the cc-znp package or inside one of its dependencies?

Just to answer your question regarding reset. No, I did not call reset in my script. But thanks all the same for the tip!

from cc-znp.

simenkid avatar simenkid commented on July 18, 2024

Hi, kilianyusinyu,

We are now tracing down the dependencies. We will fix this issue and let you know soon. :-)

from cc-znp.

simenkid avatar simenkid commented on July 18, 2024

Hi, kilianyusinyu,

It seems that something goes wrong with node.js event loop. We just fix the problem. Would you please try it again? And let us know if the problem is solved. ^^

(The package is now updated to v0.0.6.)

from cc-znp.

kyusinyu avatar kyusinyu commented on July 18, 2024

Hi simenkid,
I have just tested again and the problem is still persisting. After several runs (as already described above) it suddenly works but this is not user-friendly! This implies that the cause of this request timeout problem is still elsewhere in some package.

from cc-znp.

kyusinyu avatar kyusinyu commented on July 18, 2024

Hi jackchased,

I have tested several times with the updated version 0.0.7 and each time the AREQ event is not fired and the script keeps waiting for it for quite a very long time after which I simply stop it with CTRL+C. Unfortunately, no errors are thrown to inform me about the cause of the problem and this is not helping me either.

from cc-znp.

simenkid avatar simenkid commented on July 18, 2024

Hi kilianyusinyu,

What do you mean "each time the AREQ event is not fired and the script keeps waiting for it for quite a very long time"?

Is that possible to give us your code under test?

from cc-znp.

kyusinyu avatar kyusinyu commented on July 18, 2024

Hi jackchased,

What I mean is that the code above that worked for you did not work for me. In my case, I have a CC2531 USB Evaluation Kit connected to the USB port on my BeagleBoneBlack which in turn is connected to the USB port of my MacBook.
image
As you can see, the AREQ event is never fired and the script keeps waiting for it for quite a very long time.

from cc-znp.

Related Issues (8)

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.