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
@user125091 started
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
Any implementation works poorly, each approach has different problems
this example by https://www.espruino.com/DS18B20
After several seconds the error:
If sensors search put to set Interval this problem disappears , but other appears
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