Spark-dallas-temperature compile error


#1

Trying to use this library in a new app

Here is a sample of a newly created empty app

// This #include statement was automatically added by the Particle IDE.
#include <OneWire.h>

// This #include statement was automatically added by the Particle IDE.
#include <spark-dallas-temperature.h>

DallasTemperature dtSensors(new OneWire(D2));

void setup() {

}

void loop() {

}

The compile error is: lib/spark-dallas-temperature/spark-dallas-temperature.h:27:36: …/OneWire/OneWire.h: No such file or directory

Over the last few years, I have built a dozen or more applications using DS18B20 sensors and this code. The existing apps still compile without error. They have also been working without problems for a ;year or more each.

I’ve been away from buildiing apps for a year or so, So clearly something has changed with the build environment. I’m using the web IDE.

Can anyone offer a clue as to how I get this working again?

I can copy the code for the library into my application, make one change to the .h include statement, and it works. But seems like not the right thing to do for every app. It would be nice to have local libraries, but as I understand, they only work in the desktop IDE, and that will not run correctly on my windows 10 computer.

I’m obviously confused by the whole libraries 2.0 “feature”


#2

I would switch to using the DS18B20 library in the community libraries. This library is actively maintained and I use it and it works great.

https://build.particle.io/libs/DS18B20/0.1.8/tab/DS18B20.cpp

The OneWire and spark-dallas-temperature have not been updated in a long time and no longer work properly.


#3

I would if I could, but the new libraries are missing functionality.

Impossible to use in an application that must be responsive, as there is no asynchronous capability that I can find.

Specifically I make use of the following features:

setResolution()
with no sensor address sets resolution for all sensors
I can work around this one.

setWaitforConversion(false)
enables ansynchronus use

RequestTemperatures()
causes all sensors to update with no delay, then use:

After conversion timer has completed. (many iterations of loop() later

ReadTemperature()
for each sensor and there is no 750ms delay for each sensor


#4

In that case, the best option is probably to make a fork of spark-dallas-temperature and fix the include definition. It probably would also be a good idea to make it have a library dependency on OneWire so you only need to include spark-dallas-temperature in your project.