Skip to content

Commit bf8b733

Browse files
authored
Merge pull request milesburton#62 from webbes/master
Fixed single device conversion request bug. No way to ask a specific …
2 parents 7932037 + 89e2a43 commit bf8b733

File tree

2 files changed

+7
-22
lines changed

2 files changed

+7
-22
lines changed

DallasTemperature.cpp

Lines changed: 6 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -309,15 +309,6 @@ bool DallasTemperature::getCheckForConversion(){
309309
return checkForConversion;
310310
}
311311

312-
bool DallasTemperature::isConversionAvailable(const uint8_t* deviceAddress){
313-
314-
// Check if the clock has been raised indicating the conversion is complete
315-
ScratchPad scratchPad;
316-
readScratchPad(deviceAddress, scratchPad);
317-
return scratchPad[0];
318-
319-
}
320-
321312
bool DallasTemperature::isConversionComplete()
322313
{
323314
uint8_t b = _wire->read_bit();
@@ -333,7 +324,7 @@ void DallasTemperature::requestTemperatures(){
333324

334325
// ASYNC mode?
335326
if (!waitForConversion) return;
336-
blockTillConversionComplete(bitResolution, NULL);
327+
blockTillConversionComplete(bitResolution);
337328

338329
}
339330

@@ -347,31 +338,27 @@ bool DallasTemperature::requestTemperaturesByAddress(const uint8_t* deviceAddres
347338
return false; //Device disconnected
348339
}
349340

350-
if (_wire->reset() == 0){
351-
return false;
352-
}
353-
341+
_wire->reset();
354342
_wire->select(deviceAddress);
355343
_wire->write(STARTCONVO, parasite);
356344

357-
358345
// ASYNC mode?
359346
if (!waitForConversion) return true;
360347

361-
blockTillConversionComplete(bitResolution, deviceAddress);
348+
blockTillConversionComplete(bitResolution);
362349

363350
return true;
364351

365352
}
366353

367354

368355
// Continue to check if the IC has responded with a temperature
369-
void DallasTemperature::blockTillConversionComplete(uint8_t bitResolution, const uint8_t* deviceAddress){
356+
void DallasTemperature::blockTillConversionComplete(uint8_t bitResolution){
370357

371358
int delms = millisToWaitForConversion(bitResolution);
372-
if (deviceAddress != NULL && checkForConversion && !parasite){
359+
if (checkForConversion && !parasite){
373360
unsigned long now = millis();
374-
while(!isConversionAvailable(deviceAddress) && (millis() - delms < now));
361+
while(!isConversionComplete() && (millis() - delms < now));
375362
} else {
376363
delay(delms);
377364
}

DallasTemperature.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -146,8 +146,6 @@ class DallasTemperature
146146

147147
// returns true if the bus requires parasite power
148148
bool isParasitePowerMode(void);
149-
150-
bool isConversionAvailable(const uint8_t*);
151149

152150
// Is a conversion complete on the wire?
153151
bool isConversionComplete(void);
@@ -254,7 +252,7 @@ class DallasTemperature
254252

255253
int16_t millisToWaitForConversion(uint8_t);
256254

257-
void blockTillConversionComplete(uint8_t, const uint8_t*);
255+
void blockTillConversionComplete(uint8_t);
258256

259257
#if REQUIRESALARMS
260258

0 commit comments

Comments
 (0)