Fork to fix compiler warnings.
Fork of DS1820 by
Revision 17:eeb0edf0d2d5, committed 2018-03-23
- Comitter:
- Tejas Kale
- Date:
- Fri Mar 23 23:21:41 2018 +0100
- Parent:
- 16:794fb9d6a4ee
- Child:
- 18:688dc6dca163
- Commit message:
- Print error instead of killing the microcontroller.
Temperature sensors failing should not cause the entire system to fail.
The Mbed `error` function calls `exit(0)` and causes everything else to
stop working.
My testing with 7 DS18B20 sensors has shown that just ignoring this error
and searching again works fine.
Changed in this revision
DS1820.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/DS1820.cpp Mon Jan 29 23:24:28 2018 +0100 +++ b/DS1820.cpp Fri Mar 23 23:21:41 2018 +0100 @@ -48,8 +48,9 @@ ONEWIRE_INIT((&_datapin)); INIT_DELAY; - if (!unassignedProbe(&_datapin, _ROM)) - error("No unassigned DS1820 found!\n"); + if (!unassignedProbe(&_datapin, _ROM)) { + printf("DS18B20:No unassigned DS1820 found!\r\n"); + } else { _datapin.input(); probes.append(this);