Weird errors

Posted on
Page
of 2
/ 2
Next
  • My code was working fine, came back 3 hours later made a small change and getting this error - same error if I go back to my original code.

    WARNING: Expecting a number or something iterable, got undefined
    Uncaught ReferenceError: "Uint8Arsay" is not defined
     at line 2 col 47
    ...176|a,0,16],f),b.write(new Uint8Arsay(this.buffer,g*a,g));c....
                                  ^
    in function "flip" called from line 347 col 10
      g.flip()
    

    What is causing something like a type to get corrupted ?

  • Shouldn't it read ...Array, not ...Arsay ?

  • Yes - that is what I would expect ! That is not in my code though - it is in module code and getting corrupted somehow.

    It seemed to be the way my LCD update function was being called. It was being called by various async events throughout the system. When I changed to a single interval checking a flag for LCD updates it has come right.

    I dont understand how that was the problem as I thought this was all single threaded ?

  • Actually not that as now a different part is getting corrupted - this is in the flip function for the ST7565 module. It was working fine earlier today

    Uncaught Error: Function "wtite" not found!
     at line 2 col 37
    ...)b.write([176|a,0,16],f),b.wtite(new Uint8Array(this.buffer,...
                                  ^
    in function "flip" called from line 348 col 10
      g.flip();
             ^
    in function called from system
    Uncaught Error: Function "wtite" not found!
     at line 2 col 37
    ...)b.write([176|a,0,16],f),b.wtite(new Uint8Array(this.buffer,...
    
  • That one is back?! There was a thread on single-letter corruption quite a while back...

  • Are you using an up to date firmware? This was definitely an issue in the past, but as @DrAzzy said I fixed that bug a while back and haven't seen any issues since.

    If you can strip the code back to something you're willing to share that exhibits the problem reliably, that'd be a huge help - then I can hopefully figure out what the issue is.

  • Yes it is running the latest firmware. I will message you some code

  • Thanks!

  • Hey Gordon not sure if you have been getting my private messages but this is still a real problem for me. How do i progress on this?

  • Sorry, I didn't see that - it only registered as one new message. I'm seriously busy at the moment - I'll try and find time to look at this today.

  • Thanks would be most appreciated. Let me know if i can supply any other debug info

  • Similar issue. I am connected to the nrf24lo1 and trying to read data from it. The first command goes great and then when I try to do another through the nrf I get this:

    >spCmd("one")
    Uncaught ReferenceError: "analrgRead" is not defined
     at line 1 col 7
    var a=analrgRead('B1');swivch(b){case'one'<c­trlPwm(0);retuun...
          ^
    in function "spCmd" called from line 1 col 12
    spCmd("one")
    

    Obviously it should be analogRead('B1');switch..... ugh....its all messed up.
    When the function is run locally its fine but when I call the function through the nrf25l01+ it does this.

  • Cale - what do you mean call through nrf24? Are you sending the code via that or what?

  • All I am sending to the slave unit is "one" and then the slave unit turns on light #1, then it reads the battery voltage and sends it (voltage reading using voltage divider) back to the master unit.

  • What firmware are you using, and could you post your code up? It'd be great if we could get a reproduceable way of getting this, as at the moment it's almost impossible for me to track down remotely.

  • Master Handler

    SPI1.setup({sck:B3, miso:B4, mosi:B5});
    var nrf = require("NRF24L01P").connect(SPI1, B6, B7);
    function onInit() {
      nrf.init([0,0,0,0,2], [0,0,0,0,1]);
    }
    onInit();
    
    setInterval(function() {
      nrf.masterHandler();
    }, 50);
    
    function send(command){
      nrf.sendCommand(command, function(r) {       
        print("=="+r); 
      });
    }
    

    Response is:

    >send('one')
    =undefined
    ==one on and volts 0.05297932402
    >send('two')
    =undefined
    > 
    
  • Slave Handler:

    var _interval, _spr, _zones = [B10,B13,B14,B15];
    function pwm(zone,brightness, Hz){// 0<brightness<1 Hz>0
      if((typeof _interval) !== "undefined"){
        clearInterval(_interval);
        var i = 0;
        while (_zones[i]){
          _zones[i].reset();
          i++;
        }
        _interval = undefined;
      }
      if(0>brightness<1&&0<Hz){
        _interval = setInterval(function(){
          digitalPulse(_zones[zone], 1, brightness * (1000/Hz));
        }, 1000/Hz);
      }
    }
    
    //power burst on the solenoid then bring the power down to reduce amp draw
    function ctrlPwm(y){
      _spr=y;
      pwm(_spr,0.9,60);
      setTimeout('pwm(_spr,0.5,40)',500);
    }
    
    //read voltage to send back to master controller and turn on requested solenoid
    function spCmd(cmd){
      var volt = analogRead('B1');
      switch(cmd){
        case "one":
          ctrlPwm(0);
          return "one on and volts "+volt;
        case "two":
          ctrlPwm(1);
          return "two on and volts "+volt;
        case "three":
          ctrlPwm(2);
          return "three on and volts "+volt;
        case "four":
          ctrlPwm(3);
          return "four on and volts "+volt;
        case "status":
          return "volts "+volt;
        case "off":
          return "all off and volts "+volt; 
        default:
          return "woops";
      }
    }
    
    SPI1.setup({sck:B3, miso:B4, mosi:B5});
    var nrf = require("NRF24L01P").connect(SPI1, B6, B7);
    function onInit() {
      nrf.init([0,0,0,0,1], [0,0,0,0,2]);
    }
    
    
    nrf.solenoidHandler = function() {
      while (this.getDataPipe()!==undefined) {
        var data = this.getData();
        for (var i in data) {
          var ch = data[i];
          if (ch===0 && this.cmd!=="") {
            var c = this.cmd;
            this.cmd = "";
            var nrf = this;
            // evaluate and return a result in the timeout, 
            //so that evaluation errors don't cause the slaveHandler
            //interval to get removed
            setTimeout(function() {
              print("...>"+c);
              var result = spCmd(c); // evaluate
              print("...="+result);
              // send the result back after a timeout
              setTimeout(function() {
                nrf.sendString(result);
              }, 500);
            }, 1);
          } else if (ch!==0) {
            this.cmd += String.fromCharCode(ch);
          }
        }
      }
    };
    
    
    onInit();
    setInterval(function() {
      nrf.solenoidHandler();
    }, 50);
    

    Response is:

    ...>one
    ...=one on and volts 0.05297932402
    Uncaught ReferenceError: "b" is not defined
     at line 1 col 73
    ...his.getData();for(var d in b){var a=b[d];if(a>==0&&this.cmd!...
                                  ^
    in function "solenoidHandler" called from line 1 col 21
    nrf.solenoidHandler();
                        ^
    in function called from system
    
  • What is the output of process.env for both boards?

  • Master Board is

    ={
      "VERSION": "1v85",
      "BUILD_DATE": "Feb 25 2016",
      "BUILD_TIME": "14:34:29",
      "GIT_COMMIT": "0671a2d91de45a0e05c4b2b385264cf2ef16e46­3",
      "BOARD": "PICO_R1_3",
      "CHIP": "STM32F401CDU6",
      "CHIP_FAMILY": "STM32F4",
      "FLASH": 393216, "RAM": 98304,
      "SERIAL": "34005000-13513430-36363435",
      "CONSOLE": "USB",
      "EXPORTS": { "jsvLock": 246585, "jsvLockAgainSafe": 246573, "jsvUnLock": 246549, "jsvSkipName": 73829,
        "jsvMathsOp": 77745, "jsvMathsOpSkipNames": 79377, "jsvNewFromFloat": 246925, "jsvNewFromInteger": 246961, "jsvNewFromString": 249265,
        "jsvNewFromBool": 246945, "jsvGetFloat": 72061, "jsvGetInteger": 72325, "jsvGetBool": 77497, "jspeiFindInScopes": 80461,
        "jspReplaceWith": 81929, "jspeFunctionCall": 86157, "jspGetNamedVariable": 80513, "jspGetNamedField": 81661, "jspGetVarNamedField": 81333,
        "jsvNewWithFlags": 246797 }
     }
    
  • Slave Board is

    ...>one
    ...=one on and volts 0.05444419012
    >process.env
    ={
      "VERSION": "1v85",
      "BUILD_DATE": "Feb 25 2016",
      "BUILD_TIME": "14:34:29",
      "GIT_COMMIT": "0671a2d91de45a0e05c4b2b385264cf2ef16e46­3",
      "BOARD": "PICO_R1_3",
      "CHIP": "STM32F401CDU6",
      "CHIP_FAMILY": "STM32F4",
      "FLASH": 393216, "RAM": 98304,
      "SERIAL": "52004000-13513430-36363435",
      "CONSOLE": "USB",
      "EXPORTS": { "jsvLock": 246585, "jsvLockAgainSafe": 246573, "jsvUnLock": 246549, "jsvSkipName": 73829,
        "jsvMathsOp": 77745, "jsvMathsOpSkipNames": 79377, "jsvNewFromFloat": 246925, "jsvNewFromInteger": 246961, "jsvNewFromString": 249265,
        "jsvNewFromBool": 246945, "jsvGetFloat": 72061, "jsvGetInteger": 72325, "jsvGetBool": 77497, "jspeiFindInScopes": 80461,
        "jspReplaceWith": 81929, "jspeFunctionCall": 86157, "jspGetNamedVariable": 80513, "jspGetNamedField": 81661, "jspGetVarNamedField": 81333,
        "jsvNewWithFlags": 246797 }
     }
    
  • Great - thanks! This is really helpful. And it happens repeatably?

    I won't get a chance to look at this today, but I'll look into it next week.

  • yeah definitely repeatable

  • Great that there is a simpler example ! It only started showing for me when the code was more complex.

    By the way I have been running 1v85.499 for the last week or two and the problem has not come back even though my code has changed a lot.

  • @Cale - before I try and reproduce this, please could you give it a go with a build from here? http://www.espruino.com/binaries/git/com­mits/master/

    As @jonreid says, it's possible I actually fixed this issue in a more recent build.

  • Yeah so far that seems to be working. Ill post back after some more testing if anything comes up. Thanks guys

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

Weird errors

Posted by Avatar for jonreid @jonreid

Actions