Avatar for user125091

user125091

Member since Feb 2021 • Last active Apr 2021
  • 2 conversations
  • 5 comments

Most recent activity

    • 6 comments
    • 2,396 views
  • in ESP32
    Avatar for user125091

    I'em frontend developer, and I know JS pretty well.

    everything works, the sensors are detected. The problem is that in one example ASSERT is an error, in the second one runs out of memory.
    you don't even need to look at my code, the same problem will be copying the example from the espuino website

    ASSERT(jsvGetLocks(var) < 15) FAILED AT src/jsvar.c:721
    

    this error also occurs if you call the ws.send("....") 15 times (by https://www.espruino.com/ws#websocket-se­rver)

    ....
    var server = require('ws').createServer(onPageRequest­);
    var clients = [];
    server.listen(8000);
    server.on("websocket", function(ws) {
        clients.push(ws);
        ws.on('message',function(msg) { print("[WS] "+JSON.stringify(msg)); });
        ws.send("Hello from Espruino!");
    });
    
    
      setInterval(function(){
        clients.forEach(ws => ws.send('....'));
    //after 14 events ERROR ASSERT(jsvGetLocks(var) < 15) FAILED AT src/jsvar.c:721 
      },5000);
    
    .....
    

    This dirty example helps, but not nice

      setInterval(function(){
          var cc = clients.map(ws => {
            ws.send('....');
            return ws.clone();
          } );
          clients =cc;
        
      },5000);
    
  • in ESP32
    Avatar for user125091

    How many sensors are attempted to be traversed using the forEach?

    About 8 sensors.

    I do not know enithing , i only use code from example

  • in ESP32
    Avatar for user125091

    does anyone have any ideas how to fix this?

  • in ESP32
    Avatar for user125091

    Any implementation works poorly, each approach has different problems
    this example by https://www.espruino.com/DS18B20

    owMultiSensors = new OneWire(D4);
    DSlib = require("DS18B20") ; 
    var sensors = owMultiSensors.search().map(function (device) {
        return DSlib.connect(owMultiSensors, device);
      });
     
      setInterval(function() {
        sensors.forEach(function (sensor, index) {
        sensor.getTemp(function (temp) {
          console.log(index + ": " + temp + "°C");
        });
      });
    
    }, 1000);
    
    

    After several seconds the error:

    ASSERT(jsvGetLocks(var) < 15) FAILED AT src/jsvar.c:721
      #1[r3,l2] Object {
        #2[r1,l2] ASSERT(jsvGetLocks(var) < 15) FAILED AT src/jsvar.c:701
    HALTING.
    

    If sensors search put to set Interval this problem disappears , but other appears

    owMultiSensors = new OneWire(D4);
    DSlib = require("DS18B20") ; 
    setInterval(function() {
      var sensors = owMultiSensors.search().map(function (device) {
        return DSlib.connect(owMultiSensors, device);
      });
        sensors.forEach(function (sensor, index) {
        sensor.getTemp(function (temp) {
          console.log(index + ": " + temp + "°C");
        });
      });
    }, 1000);
    

    This code fills all RAM in time and device stops working
    Interval time increase does not have any influence, it only delays the time of crash

  • in ESP32
    Avatar for user125091

    I have error after press the button

     pinMode(D35, 'input_pulldown');
      setWatch(function(e) {
        console.log('bttn pressed');
      }, D35, { repeat: true, edge: 'rising' });
      
    

    with D34 also this same error, D15 work

    This work fine, but I don want to use setInterval

    setInterval(function() {
      console.log( digitalRead(D34));
    }, 100);
    

    Error
    Guru Meditation Error: Core 0 panic'ed (LoadStoreAlignment). Exception was unhandled.
    Core 0 register dump:
    PC : 0x40096a27 PS : 0x00060f30 A0 : 0x800967df A1 : 0x3ffdcf20
    A2 : 0x4009b1ff A3 : 0x00000000 A4 : 0x00060423 A5 : 0x00000001
    A6 : 0x0006bd0e A7 : 0x00000000 A8 : 0x00000000 A9 : 0x00000000
    A10 : 0x00000000 A11 : 0x00000000 A12 : 0x00000024 A13 : 0x6bd00000
    A14 : 0xf4240000 A15 : 0x00000008 SAR : 0x0000001c EXCCAUSE: 0x00000009
    EXCVADDR: 0x4009b1ff LBEG : 0x4009b258 LEND : 0x4009b286 LCOUNT : 0xffffffff
    Backtrace: 0x40096a27:0x3ffdcf20

Actions