@@ -152,19 +152,19 @@ bool DallasTemperature::validAddress(const uint8_t* deviceAddress) {
152
152
// finds an address at a given index on the bus
153
153
// returns true if the device was found
154
154
bool DallasTemperature::getAddress (uint8_t * deviceAddress, uint8_t index) {
155
- if (index < devices) {
156
- uint8_t depth = 0 ;
157
155
158
- _wire-> reset_search () ;
156
+ uint8_t depth = 0 ;
159
157
160
- while (depth <= index && _wire->search (deviceAddress)) {
161
- if (depth == index && validAddress (deviceAddress))
162
- return true ;
163
- depth++;
164
- }
158
+ _wire->reset_search ();
159
+
160
+ while (depth <= index && _wire->search (deviceAddress)) {
161
+ if (depth == index && validAddress (deviceAddress))
162
+ return true ;
163
+ depth++;
165
164
}
166
165
167
166
return false ;
167
+
168
168
}
169
169
170
170
// attempt to determine if the device at the given address is connected to the bus
@@ -723,27 +723,22 @@ int32_t DallasTemperature::calculateTemperature(const uint8_t* deviceAddress,
723
723
// the numeric value of DEVICE_DISCONNECTED_RAW is defined in
724
724
// DallasTemperature.h. It is a large negative number outside the
725
725
// operating range of the device
726
- int32_t DallasTemperature::getTemp (const uint8_t * deviceAddress, byte retryCount = 0 ) {
726
+ int32_t DallasTemperature::getTemp (const uint8_t * deviceAddress) {
727
727
728
728
ScratchPad scratchPad;
729
-
730
- byte retries = 0 ;
731
-
732
- while (retries++ <= retryCount) {
733
- if (isConnected (deviceAddress, scratchPad))
734
- return calculateTemperature (deviceAddress, scratchPad);
735
- }
736
-
737
- return DEVICE_DISCONNECTED_RAW;
729
+ if (isConnected (deviceAddress, scratchPad))
730
+ return calculateTemperature (deviceAddress, scratchPad);
731
+ return DEVICE_DISCONNECTED_RAW;
732
+
738
733
}
739
734
740
735
// returns temperature in degrees C or DEVICE_DISCONNECTED_C if the
741
736
// device's scratch pad cannot be read successfully.
742
737
// the numeric value of DEVICE_DISCONNECTED_C is defined in
743
738
// DallasTemperature.h. It is a large negative number outside the
744
739
// operating range of the device
745
- float DallasTemperature::getTempC (const uint8_t * deviceAddress, byte retryCount = 0 ) {
746
- return rawToCelsius (getTemp (deviceAddress, retryCount ));
740
+ float DallasTemperature::getTempC (const uint8_t * deviceAddress) {
741
+ return rawToCelsius (getTemp (deviceAddress));
747
742
}
748
743
749
744
// returns temperature in degrees F or DEVICE_DISCONNECTED_F if the
0 commit comments