You are reading a single comment by @user125091 and its replies. Click here to read the full conversation.
  • 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

About

Avatar for user125091 @user125091 started