• I have the following code on my puck.js (firmware 2v21):

    require("puckjsv2-2v05-fix");
    
    function cPrint(s)
    {
      print("" + getTime() + " " + s);
    }
    
    Puck.on('accel',function(a) {
      cPrint(a.acc.x + " " + a.acc.y + " " + a.acc.z);
    });
    Puck.accelOn(1.6);
    

    With or without the first line, I get logs like this:

    1731157780.16738986968 -532 -93 16378
    1731157780.17236423492 -532 -93 16378
    1731157780.17709445953 -532 -93 16378
    1731157780.18216037750 -532 -93 16378
    1731157780.18740940093 -532 -93 16378
    1731157780.19213962554 -532 -93 16378
    1731157780.19705295562 -532 -93 16378
    1731157780.20242404937 -532 -93 16378
    1731157780.20715427398 -532 -93 16378
    1731157780.21359348297 -532 -93 16378
    1731157780.22110080718 -532 -93 16378
    1731157780.22857761383 -532 -93 16378
    1731157780.23605442047 -532 -93 16378
    1731157780.24325656890 -532 -93 16378
    1731157780.24865818023 -532 -93 16378
    1731157780.25369358062 -532 -93 16378
    1731157780.25875949859 -532 -93 16378
    1731157780.26608371734 -532 -93 16378
    1731157780.27359104156 -532 -93 16378
    1731157780.28106784820 -532 -93 16378
    1731157780.28854465484 -532 -93 16378
    1731157780.29602146148 -532 -93 16378
    1731157780.30142307281 -532 -93 16378
    1731157780.30655002593 -532 -93 16378
    1731157780.31152439117 -532 -93 16378
    1731157780.31860446929 -532 -93 16378
    1731157780.32608127593 -532 -93 16378
    1731157780.33355808258 -532 -93 16378
    1731157780.34106540679 -532 -93 16378
    1731157780.34854221343 -532 -93 16378
    1731157780.35391330718 -532 -93 16378
    1731157780.35904026031 -532 -93 16378
    1731157780.36401462554 -532 -93 16378
    1731157780.37109470367 -532 -93 16378
    1731157780.37860202789 -532 -93 16378
    1731157780.38607883453 -532 -93 16378
    1731157780.39593601226 -532 -93 16378
    1731157780.40087985992 -532 -93 16378
    1731157780.40924167633 -532 -93 16378
    1731157780.41455173492 -532 -93 16378
    1731157780.41989231109 -532 -93 16378
    1731157780.42462253570 -532 -93 16378
    1731157780.43087863922 -532 -93 16378
    1731157780.43832492828 -532 -93 16378
    1731157780.44580173492 -532 -93 16378
    1731157780.45327854156 -532 -93 16378
    1731157780.46078586578 -532 -93 16378
    1731157780.46612644195 -532 -93 16378
    1731157780.47116184234 -532 -93 16378
    1731157780.47619724273 -532 -93 16378
    1731157780.48336887359 -532 -93 16378
    1731157780.49081516265 -532 -93 16378
    1731157780.49829196929 -532 -93 16378
    1731157780.50579929351 -532 -93 16378
    1731157780.51327610015 -532 -93 16378
    1731157780.51864719390 -532 -93 16378
    1731157780.52365207672 -532 -93 16378
    1731157780.52868747711 -532 -93 16378
    1731157780.53588962554 -532 -93 16378
    1731157780.54336643218 -532 -93 16378
    1731157780.55081272125 -532 -93 16378
    1731157780.55828952789 -532 -93 16378
    1731157780.56576633453 -532 -93 16378
    1731157780.57299900054 -532 -93 16378
    1731157780.57837009429 -532 -93 16378
    1731157780.58337497711 -532 -93 16378
    1731157780.58841037750 -532 -93 16378
    1731157780.59582614898 -532 -93 16378
    1731157780.60330295562 -532 -93 16378
    1731157780.60922336578 -532 -93 16378
    1731157780.62036228179 -532 -93 16378
    1731157780.62576389312 -532 -93 16378
    1731157780.63104343414 -532 -93 16378
    1731157780.63607883453 -532 -93 16378
    1731157780.64138889312 -532 -93 16378
    1731157780.64831638336 -532 -93 16378
    1731157780.65585422515 -532 -93 16378
    1731157780.66330051422 -532 -93 16378
    1731157780.67077732086 -532 -93 16378
    1731157780.67828464508 -532 -93 16378
    1731157780.68365573883 -532 -93 16378
    1731157780.68866062164 -532 -93 16378
    1731157780.69372653961 -532 -93 16378
    1731157780.70086765289 -532 -93 16378
    1731157780.70831394195 -532 -93 16378
    1731157780.71579074859 -532 -93 16378
    1731157780.72329807281 -532 -93 16378
    1731157780.73077487945 -532 -93 16378
    1731157780.73800754547 -532 -93 16378
    1731157780.74337863922 -532 -93 16378
    1731157780.74838352203 -532 -93 16378
    1731157780.75341892242 -532 -93 16378
    1731157780.76089572906 -513 -176 16399
    1731157780.76837253570 -513 -176 16399
    1731157780.77587985992 -513 -176 16399
    1731157780.78329563140 -513 -176 16399
    

    The intervals at which the accelerometer values change are indeed about 1.6Hz but the function itself is called way too often! What is going on here? How can I fix this?

  • Okay, I solved it by repowering the puck. Hopefully this helps future users with the same problem

  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview
About

Puck.on('accel',function(a) {}) is called way too often

Posted by Avatar for user159242 @user159242

Actions